[cairo-commit] 4 commits - boilerplate/cairo-boilerplate-xcb.c src/cairoint.h test/README

Chris Wilson ickle at kemper.freedesktop.org
Sun Nov 7 04:55:22 PST 2010


 boilerplate/cairo-boilerplate-xcb.c |   12 ++++++++++++
 src/cairoint.h                      |    8 ++++++--
 test/README                         |    2 +-
 3 files changed, 19 insertions(+), 3 deletions(-)

New commits:
commit b4e55b84e20999e410d0ba04ebb83b81c21c8447
Author: Uli Schlachter <psychon at znc.in>
Date:   Sat Oct 30 10:43:46 2010 +0200

    test/README: Change suggested screen size
    
    The dash-state test needs a surface with a width of 1500 pixels. If the screen
    size is smaller than that, the boilerplate backends that create a window on the
    X server can't properly do their job because part of the window would be outside
    of the screen. This means people should use a screen large enough for all the
    needed test surfaces. 1680 seemed like a more-or-less realistic value here.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/README b/test/README
index 0cd3433..f753ccb 100644
--- a/test/README
+++ b/test/README
@@ -128,7 +128,7 @@ Here are some of the relevant details:
     X server that uses only software for all rendering. One such X
     server is Xvfb which can be started like this:
 
-	Xvfb -screen 0 1280x1024x24 -ac -nolisten tcp :2
+	Xvfb -screen 0 1680x1024x24 -ac -nolisten tcp :2
 
     after which the test suite can be run against it like so:
 
commit 95f6f7a174ca096a3d3dbe84ff220d166d1e2baa
Author: Uli Schlachter <psychon at znc.in>
Date:   Fri Oct 22 11:54:57 2010 +0200

    Make both versions of _cairo_lround consistent again
    
    Commit c0008242b0f made cairo use libm's lround instead of its own _cairo_lround
    by default. However, since commit ce58f874 from 2006, _cairo_lround does
    arithmetic rounding instead of away-from-zero rounding (before said commit, it
    was using baker's rounding).
    
    So to make the rounding of _cairo_lround be independent from
    DISABLE_SOME_FLOATING_POINT, we have to use another function. Turns out that
    _cairo_round already does the same thing that _cairo_lround does. Their only
    difference is the return type.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairoint.h b/src/cairoint.h
index 53c87e5..539d92e 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -968,7 +968,11 @@ _cairo_round (double r)
 cairo_private int
 _cairo_lround (double d) cairo_const;
 #else
-#define _cairo_lround lround
+static inline int cairo_const
+_cairo_lround (double r)
+{
+    return _cairo_round (r);
+}
 #endif
 
 cairo_private uint16_t
commit 5d5a7d6b22156e5bbb9bf6d4f706740af3ca05ac
Author: Uli Schlachter <psychon at znc.in>
Date:   Fri Oct 22 16:33:55 2010 +0200

    _cairo_round: Fix documentation
    
    Despite what the comment says, this function rounds halfway cases towards
    positive infinity.
    
    _cairo_round ( 0.5) => floor ( 1.0) =>  1.0
    _cairo_round (-0.5) => floor ( 0.0) =>  0.0
    _cairo_round (-1.5) => floor (-1.0) => -1.0
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairoint.h b/src/cairoint.h
index 5836101..53c87e5 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -956,7 +956,7 @@ _cairo_restrict_value (double value, double min, double max)
 }
 
 /* C99 round() rounds to the nearest integral value with halfway cases rounded
- * away from 0. _cairo_round rounds halfway cases toward negative infinity.
+ * away from 0. _cairo_round rounds halfway cases toward positive infinity.
  * This matches the rounding behaviour of _cairo_lround. */
 static inline double cairo_const
 _cairo_round (double r)
commit 6383e1442cf3918ea71378ce46144e1bb5707882
Author: Uli Schlachter <psychon at znc.in>
Date:   Mon Oct 25 09:11:05 2010 +0200

    XCB: Check screen size in boilerplate
    
    Trying to create a window for drawing that is larger than the available screen
    space is a bad idea. When the test finishes and tries to grab the resulting
    image from the X server, the window's area that is outside of the screen will
    have undefined content.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/boilerplate/cairo-boilerplate-xcb.c b/boilerplate/cairo-boilerplate-xcb.c
index 0cac82b..c3b059c 100644
--- a/boilerplate/cairo-boilerplate-xcb.c
+++ b/boilerplate/cairo-boilerplate-xcb.c
@@ -248,6 +248,12 @@ _cairo_boilerplate_xcb_create_window (const char		*name,
     xtc->surface = NULL;
 
     s = xcb_setup_roots_iterator (xcb_get_setup (c)).data;
+    if (width > s->width_in_pixels || height > s->height_in_pixels) {
+	xcb_disconnect (c);
+	free (xtc);
+	return NULL;
+    }
+
     xtc->is_pixmap = FALSE;
     xtc->drawable = xcb_generate_id (c);
     cookie = xcb_create_window_checked (c,
@@ -319,6 +325,12 @@ _cairo_boilerplate_xcb_create_window_db (const char		   *name,
     xtc->surface = NULL;
 
     s = xcb_setup_roots_iterator (xcb_get_setup (c)).data;
+    if (width > s->width_in_pixels || height > s->height_in_pixels) {
+	xcb_disconnect (c);
+	free (xtc);
+	return NULL;
+    }
+
     xtc->is_pixmap = FALSE;
     xtc->drawable = xcb_generate_id (c);
     cookie = xcb_create_window_checked (c,


More information about the cairo-commit mailing list