[cairo-commit] 2 commits - boilerplate/cairo-boilerplate-gl.c src/cairo-image-surface.c src/cairo-xcb-surface-render.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Feb 12 06:08:52 PST 2010


 boilerplate/cairo-boilerplate-gl.c |    3 +++
 src/cairo-image-surface.c          |   26 ++++++++++++++------------
 src/cairo-xcb-surface-render.c     |   26 ++++++++++++++------------
 3 files changed, 31 insertions(+), 24 deletions(-)

New commits:
commit 37dbf157f354234d04cd4f0c5d069ff0d535e862
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Feb 12 14:08:32 2010 +0000

    clip: Avoiding derefencing NULL clip_region

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 76f50f7..8dbf2e7 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -2025,9 +2025,6 @@ _clip_and_composite (cairo_image_surface_t	*dst,
     cairo_bool_t need_clip_surface = FALSE;
 
     if (clip != NULL) {
-	cairo_rectangle_int_t rect;
-	cairo_bool_t is_empty;
-
 	status = _cairo_clip_get_region (clip, &clip_region);
 	if (unlikely (status == CAIRO_INT_STATUS_NOTHING_TO_DO))
 	    return CAIRO_STATUS_SUCCESS;
@@ -2035,17 +2032,22 @@ _clip_and_composite (cairo_image_surface_t	*dst,
 	assert (! _cairo_status_is_error (status));
 	need_clip_surface = status == CAIRO_INT_STATUS_UNSUPPORTED;
 
-	cairo_region_get_extents (clip_region, &rect);
-	is_empty = ! _cairo_rectangle_intersect (&extents->unbounded, &rect);
-	if (unlikely (is_empty))
-	    return CAIRO_STATUS_SUCCESS;
+	if (clip_region != NULL) {
+	    cairo_rectangle_int_t rect;
+	    cairo_bool_t is_empty;
 
-	is_empty = ! _cairo_rectangle_intersect (&extents->bounded, &rect);
-	if (unlikely (is_empty && extents->is_bounded))
-	    return CAIRO_STATUS_SUCCESS;
+	    cairo_region_get_extents (clip_region, &rect);
+	    is_empty = ! _cairo_rectangle_intersect (&extents->unbounded, &rect);
+	    if (unlikely (is_empty))
+		return CAIRO_STATUS_SUCCESS;
 
-	if (clip_region != NULL && cairo_region_num_rectangles (clip_region) == 1)
-	    clip_region = NULL;
+	    is_empty = ! _cairo_rectangle_intersect (&extents->bounded, &rect);
+	    if (unlikely (is_empty && extents->is_bounded))
+		return CAIRO_STATUS_SUCCESS;
+
+	    if (cairo_region_num_rectangles (clip_region) == 1)
+		clip_region = NULL;
+	}
     }
 
     if (clip_region != NULL) {
diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index 9122d64..5212cae 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -2352,9 +2352,6 @@ _clip_and_composite (cairo_xcb_surface_t	*dst,
     cairo_bool_t need_clip_surface = FALSE;
 
     if (clip != NULL) {
-	cairo_rectangle_int_t rect;
-	cairo_bool_t is_empty;
-
 	status = _cairo_clip_get_region (clip, &clip_region);
 	if (unlikely (status == CAIRO_INT_STATUS_NOTHING_TO_DO))
 	    return CAIRO_STATUS_SUCCESS;
@@ -2362,17 +2359,22 @@ _clip_and_composite (cairo_xcb_surface_t	*dst,
 	assert (! _cairo_status_is_error (status));
 	need_clip_surface = status == CAIRO_INT_STATUS_UNSUPPORTED;
 
-	cairo_region_get_extents (clip_region, &rect);
-	is_empty = ! _cairo_rectangle_intersect (&extents->unbounded, &rect);
-	if (unlikely (is_empty))
-	    return CAIRO_STATUS_SUCCESS;
+	if (clip_region != NULL) {
+	    cairo_rectangle_int_t rect;
+	    cairo_bool_t is_empty;
 
-	is_empty = ! _cairo_rectangle_intersect (&extents->bounded, &rect);
-	if (unlikely (is_empty && extents->is_bounded))
-	    return CAIRO_STATUS_SUCCESS;
+	    cairo_region_get_extents (clip_region, &rect);
+	    is_empty = ! _cairo_rectangle_intersect (&extents->unbounded, &rect);
+	    if (unlikely (is_empty))
+		return CAIRO_STATUS_SUCCESS;
 
-	if (clip_region != NULL && cairo_region_num_rectangles (clip_region) == 1)
-	    clip_region = NULL;
+	    is_empty = ! _cairo_rectangle_intersect (&extents->bounded, &rect);
+	    if (unlikely (is_empty && extents->is_bounded))
+		return CAIRO_STATUS_SUCCESS;
+
+	    if (cairo_region_num_rectangles (clip_region) == 1)
+		clip_region = NULL;
+	}
     }
 
     status = _cairo_xcb_connection_acquire (dst->connection);
commit 6995e1d982a3ad84a1b74730ce557840745fcd8e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Feb 12 14:08:14 2010 +0000

    boilerplate: Include X11.h for GL/GLX

diff --git a/boilerplate/cairo-boilerplate-gl.c b/boilerplate/cairo-boilerplate-gl.c
index 05c2d04..d8e4059 100644
--- a/boilerplate/cairo-boilerplate-gl.c
+++ b/boilerplate/cairo-boilerplate-gl.c
@@ -34,6 +34,9 @@
 
 #include <cairo-gl.h>
 
+#include <X11/X.h>
+#include <X11/Xutil.h> /* for XDestroyImage */
+
 typedef struct _gl_target_closure {
     Display *dpy;
     int screen;


More information about the cairo-commit mailing list