[cairo-commit] 3 commits - src/cairo-xcb-screen.c src/cairo-xcb-surface-render.c src/cairo-xlib-xcb-surface.c

Uli Schlachter psychon at kemper.freedesktop.org
Wed Jul 20 01:55:50 PDT 2011


 src/cairo-xcb-screen.c         |    5 +++++
 src/cairo-xcb-surface-render.c |   34 +++++++++++++++++++++++++++-------
 src/cairo-xlib-xcb-surface.c   |   14 +++++++-------
 3 files changed, 39 insertions(+), 14 deletions(-)

New commits:
commit 73ff0de345f0974652de4888220fa12ed86c08a5
Author: Uli Schlachter <psychon at znc.in>
Date:   Wed Jul 20 10:55:32 2011 +0200

    xlib-xcb: Fix 'incompatible pointer type' warnings
    
    This was introduced in b132fae5e843c329d14.
    
    Fixes warnings of the following kind:
    
    cairo-xlib-xcb-surface.c:261:5: warning: initialization from incompatible
    pointer type
    cairo-xlib-xcb-surface.c:261:5: warning: (near initialization for
    '_cairo_xlib_xcb_surface_backend.paint')
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-xlib-xcb-surface.c b/src/cairo-xlib-xcb-surface.c
index 335a33a..f4e25a1 100644
--- a/src/cairo-xlib-xcb-surface.c
+++ b/src/cairo-xlib-xcb-surface.c
@@ -142,7 +142,7 @@ static cairo_int_status_t
 _cairo_xlib_xcb_surface_paint (void			*abstract_surface,
 			       cairo_operator_t		 op,
 			       const cairo_pattern_t	*source,
-			       cairo_clip_t		*clip)
+			       const cairo_clip_t	*clip)
 {
     cairo_xlib_xcb_surface_t *surface = abstract_surface;
     return _cairo_surface_paint (&surface->xcb->base, op, source, clip);
@@ -153,7 +153,7 @@ _cairo_xlib_xcb_surface_mask (void			*abstract_surface,
 			      cairo_operator_t		 op,
 			      const cairo_pattern_t	*source,
 			      const cairo_pattern_t	*mask,
-			      cairo_clip_t		*clip)
+			      const cairo_clip_t	*clip)
 {
     cairo_xlib_xcb_surface_t *surface = abstract_surface;
     return _cairo_surface_mask (&surface->xcb->base, op, source, mask, clip);
@@ -163,13 +163,13 @@ static cairo_int_status_t
 _cairo_xlib_xcb_surface_stroke (void				*abstract_surface,
 				cairo_operator_t		 op,
 				const cairo_pattern_t		*source,
-				cairo_path_fixed_t		*path,
+				const cairo_path_fixed_t	*path,
 				const cairo_stroke_style_t	*style,
 				const cairo_matrix_t		*ctm,
 				const cairo_matrix_t		*ctm_inverse,
 				double				 tolerance,
 				cairo_antialias_t		 antialias,
-				cairo_clip_t			*clip)
+				const cairo_clip_t		*clip)
 {
     cairo_xlib_xcb_surface_t *surface = abstract_surface;
     return _cairo_surface_stroke (&surface->xcb->base,
@@ -181,11 +181,11 @@ static cairo_int_status_t
 _cairo_xlib_xcb_surface_fill (void			*abstract_surface,
 			      cairo_operator_t		 op,
 			      const cairo_pattern_t	*source,
-			      cairo_path_fixed_t	*path,
+			      const cairo_path_fixed_t	*path,
 			      cairo_fill_rule_t		 fill_rule,
 			      double			 tolerance,
 			      cairo_antialias_t		 antialias,
-			      cairo_clip_t		*clip)
+			      const cairo_clip_t	*clip)
 {
     cairo_xlib_xcb_surface_t *surface = abstract_surface;
     return _cairo_surface_fill (&surface->xcb->base,
@@ -201,7 +201,7 @@ _cairo_xlib_xcb_surface_glyphs (void			*abstract_surface,
 				cairo_glyph_t		*glyphs,
 				int			 num_glyphs,
 				cairo_scaled_font_t	*scaled_font,
-				cairo_clip_t		*clip,
+				const cairo_clip_t	*clip,
 				int *num_remaining)
 {
     cairo_xlib_xcb_surface_t *surface = abstract_surface;
commit ac9482bdf00ec2295273ec69d3bca3e93e2ce183
Author: Uli Schlachter <psychon at znc.in>
Date:   Wed Jul 20 10:42:52 2011 +0200

    xcb: Fix a GC leak when a screen is finished
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-xcb-screen.c b/src/cairo-xcb-screen.c
index 2097475..a7802c2 100644
--- a/src/cairo-xcb-screen.c
+++ b/src/cairo-xcb-screen.c
@@ -80,6 +80,11 @@ _cairo_xcb_screen_finish (cairo_xcb_screen_t *screen)
     for (i = 0; i < ARRAY_LENGTH (screen->stock_colors); i++)
 	cairo_surface_destroy (screen->stock_colors[i]);
 
+    for (i = 0; i < ARRAY_LENGTH (screen->gc); i++) {
+	if (((screen->gc_depths >> (8*i)) & 0xff) != 0)
+	    _cairo_xcb_connection_free_gc (screen->connection, screen->gc[i]);
+    }
+
     _cairo_cache_fini (&screen->linear_pattern_cache);
     _cairo_cache_fini (&screen->radial_pattern_cache);
     _cairo_freelist_fini (&screen->pattern_cache_entry_freelist);
commit c28196d9451f006b91906b68564f3959ce48af46
Author: Uli Schlachter <psychon at znc.in>
Date:   Mon Jul 18 20:03:18 2011 +0200

    xcb: Fix _set_clip_region for many rectangles
    
    Fixes a failed assert in the hatchings test.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index 000f00f..66e933e 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -210,15 +210,22 @@ _render_operator (cairo_operator_t op)
     }
 }
 
-static void
+static cairo_status_t
 _cairo_xcb_surface_set_clip_region (cairo_xcb_surface_t *surface,
 				    cairo_region_t	*region)
 {
-    xcb_rectangle_t rects[CAIRO_STACK_ARRAY_LENGTH (xcb_rectangle_t)];
+    xcb_rectangle_t stack_rects[CAIRO_STACK_ARRAY_LENGTH (xcb_rectangle_t)];
+    xcb_rectangle_t *rects = stack_rects;
     int i, num_rects;
 
     num_rects = cairo_region_num_rectangles (region);
-    assert (num_rects < ARRAY_LENGTH (rects)); /* XXX somebody will! */
+
+    if (num_rects > ARRAY_LENGTH (stack_rects)) {
+	rects = _cairo_malloc_ab (num_rects, sizeof (xcb_rectangle_t));
+	if (unlikely (rects == NULL)) {
+	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+	}
+    }
 
     for (i = 0; i < num_rects; i++) {
 	cairo_rectangle_int_t rect;
@@ -235,6 +242,11 @@ _cairo_xcb_surface_set_clip_region (cairo_xcb_surface_t *surface,
 							      surface->picture,
 							      0, 0,
 							      num_rects, rects);
+
+    if (rects != stack_rects)
+	free (rects);
+
+    return CAIRO_STATUS_SUCCESS;
 }
 
 static void
@@ -2214,8 +2226,13 @@ _clip_and_composite (cairo_xcb_surface_t	*dst,
 
     _cairo_xcb_surface_ensure_picture (dst);
 
-    if (clip_region != NULL)
-	_cairo_xcb_surface_set_clip_region (dst, clip_region);
+    if (clip_region != NULL) {
+	status = _cairo_xcb_surface_set_clip_region (dst, clip_region);
+	if (unlikely (status)) {
+	    _cairo_xcb_connection_release (dst->connection);
+	    return status;
+	}
+    }
 
     if (reduce_alpha_op (&dst->base, op, src)) {
 	op = CAIRO_OPERATOR_ADD;
@@ -2870,8 +2887,11 @@ _cairo_xcb_surface_render_composite_polygon (cairo_xcb_surface_t *dst,
 		    clip_region = NULL;
 
 	    if (clip_surface == FALSE) {
-		if (clip_region != NULL)
-		    _cairo_xcb_surface_set_clip_region (dst, clip_region);
+		if (clip_region != NULL) {
+		    status = _cairo_xcb_surface_set_clip_region (dst, clip_region);
+		    if (unlikely (status))
+			return status;
+		}
 
 		status = _cairo_xcb_surface_fixup_unbounded (dst, extents);
 


More information about the cairo-commit mailing list