[cairo-commit] 5 commits - src/cairo-surface.c src/cairo-xcb-connection-render.c src/cairo-xcb-connection-shm.c src/cairo-xcb-surface-render.c

Uli Schlachter psychon at kemper.freedesktop.org
Tue Sep 25 02:50:37 PDT 2012


 src/cairo-surface.c               |    6 +++---
 src/cairo-xcb-connection-render.c |   20 ++++++++++++++++++++
 src/cairo-xcb-connection-shm.c    |    4 ++++
 src/cairo-xcb-surface-render.c    |   18 ++++++++++++------
 4 files changed, 39 insertions(+), 9 deletions(-)

New commits:
commit 2be125817ade58ca25cc6cc6b23e2f4dbea722c6
Author: Uli Schlachter <psychon at znc.in>
Date:   Tue Sep 25 11:40:22 2012 +0200

    surface: Check reference count right before free
    
    This makes sure that nothing took a reference during finishing and during
    detaching user and mime-data.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index dcce41e..cbb2cfe 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -943,8 +943,6 @@ cairo_surface_destroy (cairo_surface_t *surface)
 	    return;
 
 	_cairo_surface_finish (surface);
-	/* paranoid check that nobody took a reference whilst finishing */
-	assert (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count));
     }
 
     if (surface->damage)
@@ -957,7 +955,9 @@ cairo_surface_destroy (cairo_surface_t *surface)
         cairo_device_destroy (surface->device);
 
     assert (surface->snapshot_of == NULL);
-    assert (!_cairo_surface_has_snapshots (surface));
+    assert (! _cairo_surface_has_snapshots (surface));
+    /* paranoid check that nobody took a reference whilst finishing */
+    assert (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count));
 
     free (surface);
 }
commit f2720e2ba1f68e9ec8f8822e41f4045663e99ad8
Author: Uli Schlachter <psychon at znc.in>
Date:   Tue Sep 25 11:39:42 2012 +0200

    xcb: Add a missing check for FillRectangles
    
    Fixes: big-empty-box big-little-box operator operator-alpha
    surface-pattern-operator unbounded-operator
    
    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 09a0236..dff62af 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -2384,10 +2384,15 @@ _cairo_xcb_surface_fixup_unbounded_boxes (cairo_xcb_surface_t *dst,
     }
 
     if (likely (status == CAIRO_STATUS_SUCCESS)) {
-	status = _render_fill_boxes (dst,
-				     CAIRO_OPERATOR_CLEAR,
-				     CAIRO_COLOR_TRANSPARENT,
-				     &clear);
+	if (dst->connection->flags & CAIRO_XCB_RENDER_HAS_FILL_RECTANGLES)
+	    status = _render_fill_boxes (dst,
+					 CAIRO_OPERATOR_CLEAR,
+					 CAIRO_COLOR_TRANSPARENT,
+					 &clear);
+	else
+	    status = _cairo_xcb_surface_core_fill_boxes (dst,
+							 CAIRO_COLOR_TRANSPARENT,
+							 &clear);
     }
 
     _cairo_boxes_fini (&clear);
commit b264ae76bd2621363cbc1e2b5bcdc4b0583d4b1f
Author: Uli Schlachter <psychon at znc.in>
Date:   Tue Sep 25 11:34:52 2012 +0200

    xcb: Check if traps are supported before using them
    
    This code tried to optimize the clip away by intersecting the boxes with the
    clip polygon. However, it also did so when the server didn't support traps.
    
    Fixes: clip-stroke-unbounded clip-fill-nz-unbounded clip-fill-eo-unbounded
    clip-fill clip-fill-rule a1-clip-fill-rule clip-group-shapes-circles
    clip-intersect clip-nesting clip-operator clip-push-group clip-polygons
    clip-shape clip-text clip-twice inverted-clip mask random-clip
    rotate-clip-image-surface-paint trap-clip unantialiased-shapes
    
    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 6f86a4f..09a0236 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -3106,7 +3106,8 @@ _clip_and_composite_boxes (cairo_xcb_surface_t *dst,
     }
 
     /* Can we reduce drawing through a clip-mask to simply drawing the clip? */
-    if (extents->clip->path != NULL && extents->is_bounded) {
+    if (dst->connection->flags & CAIRO_XCB_RENDER_HAS_COMPOSITE_TRAPEZOIDS &&
+	    extents->clip->path != NULL && extents->is_bounded) {
 	cairo_polygon_t polygon;
 	cairo_fill_rule_t fill_rule;
 	cairo_antialias_t antialias;
commit 0ccbb83eb892aca51838aeb1da45070b385a6d88
Author: Uli Schlachter <psychon at znc.in>
Date:   Tue Sep 25 11:31:04 2012 +0200

    xcb: Check the right flag for FillRectangles
    
    Fixes: operator-source
    
    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 959d380..6f86a4f 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -2410,7 +2410,7 @@ _cairo_xcb_surface_clear (cairo_xcb_surface_t *dst)
     rect.width  = dst->width;
     rect.height = dst->height;
 
-    if (dst->connection->flags & CAIRO_XCB_RENDER_HAS_COMPOSITE) {
+    if (dst->connection->flags & CAIRO_XCB_RENDER_HAS_FILL_RECTANGLES) {
 	xcb_render_color_t color;
 	uint8_t op;
 
commit b33d83ad49343ce226f76ceb6c83659c72442e91
Author: Uli Schlachter <psychon at znc.in>
Date:   Tue Sep 25 11:12:58 2012 +0200

    xcb: Verify extension support before sending
    
    This commit adds lots of asserts. These asserts verify for each extension
    request that we send that the server really supports this.
    
    Sadly, this causes 28 assertion failures in the test suite with xcb-render-0.0.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-xcb-connection-render.c b/src/cairo-xcb-connection-render.c
index 8d95509..6111965 100644
--- a/src/cairo-xcb-connection-render.c
+++ b/src/cairo-xcb-connection-render.c
@@ -43,6 +43,7 @@ _cairo_xcb_connection_render_create_picture (cairo_xcb_connection_t  *connection
 					     uint32_t                 value_mask,
 					     uint32_t	             *value_list)
 {
+    assert (connection->flags & CAIRO_XCB_HAS_RENDER);
     xcb_render_create_picture (connection->xcb_connection, picture, drawable,
 			       format, value_mask, value_list);
 }
@@ -53,6 +54,7 @@ _cairo_xcb_connection_render_change_picture (cairo_xcb_connection_t     *connect
 					     uint32_t              value_mask,
 					     uint32_t             *value_list)
 {
+    assert (connection->flags & CAIRO_XCB_HAS_RENDER);
     xcb_render_change_picture (connection->xcb_connection, picture,
 			       value_mask, value_list);
 }
@@ -65,6 +67,7 @@ _cairo_xcb_connection_render_set_picture_clip_rectangles (cairo_xcb_connection_t
 							  uint32_t               rectangles_len,
 							  xcb_rectangle_t *rectangles)
 {
+    assert (connection->flags & CAIRO_XCB_HAS_RENDER);
     xcb_render_set_picture_clip_rectangles (connection->xcb_connection, picture,
 					    clip_x_origin, clip_y_origin,
 					    rectangles_len, rectangles);
@@ -74,6 +77,7 @@ void
 _cairo_xcb_connection_render_free_picture (cairo_xcb_connection_t *connection,
 					   xcb_render_picture_t  picture)
 {
+    assert (connection->flags & CAIRO_XCB_HAS_RENDER);
     xcb_render_free_picture (connection->xcb_connection, picture);
     _cairo_xcb_connection_put_xid (connection, picture);
 }
@@ -93,6 +97,7 @@ _cairo_xcb_connection_render_composite (cairo_xcb_connection_t     *connection,
 					uint16_t              width,
 					uint16_t              height)
 {
+    assert (connection->flags & CAIRO_XCB_RENDER_HAS_COMPOSITE);
     xcb_render_composite (connection->xcb_connection, op, src, mask, dst,
 			  src_x, src_y, mask_x, mask_y, dst_x, dst_y, width, height);
 }
@@ -108,6 +113,7 @@ _cairo_xcb_connection_render_trapezoids (cairo_xcb_connection_t *connection,
 					 uint32_t                      traps_len,
 					 xcb_render_trapezoid_t *traps)
 {
+    assert (connection->flags & CAIRO_XCB_RENDER_HAS_COMPOSITE_TRAPEZOIDS);
     xcb_render_trapezoids (connection->xcb_connection, op, src, dst,
 			   mask_format, src_x, src_y, traps_len, traps);
 }
@@ -117,6 +123,7 @@ _cairo_xcb_connection_render_create_glyph_set (cairo_xcb_connection_t	*connectio
 					       xcb_render_glyphset_t	 id,
 					       xcb_render_pictformat_t  format)
 {
+    assert (connection->flags & CAIRO_XCB_HAS_RENDER);
     xcb_render_create_glyph_set (connection->xcb_connection, id, format);
 }
 
@@ -124,6 +131,7 @@ void
 _cairo_xcb_connection_render_free_glyph_set (cairo_xcb_connection_t      *connection,
 					     xcb_render_glyphset_t  glyphset)
 {
+    assert (connection->flags & CAIRO_XCB_HAS_RENDER);
     xcb_render_free_glyph_set (connection->xcb_connection, glyphset);
     _cairo_xcb_connection_put_xid (connection, glyphset);
 }
@@ -137,6 +145,7 @@ _cairo_xcb_connection_render_add_glyphs (cairo_xcb_connection_t             *con
 					 uint32_t                      data_len,
 					 uint8_t                *data)
 {
+    assert (connection->flags & CAIRO_XCB_HAS_RENDER);
     xcb_render_add_glyphs (connection->xcb_connection, glyphset, num_glyphs,
 				   glyphs_id, glyphs, data_len, data);
 }
@@ -147,6 +156,7 @@ _cairo_xcb_connection_render_free_glyphs (cairo_xcb_connection_t         *connec
 					  uint32_t                  num_glyphs,
 					  xcb_render_glyph_t *glyphs)
 {
+    assert (connection->flags & CAIRO_XCB_HAS_RENDER);
     xcb_render_free_glyphs (connection->xcb_connection, glyphset, num_glyphs, glyphs);
 }
 
@@ -162,6 +172,7 @@ _cairo_xcb_connection_render_composite_glyphs_8 (cairo_xcb_connection_t        *
 						 uint32_t                 glyphcmds_len,
 						 uint8_t           *glyphcmds)
 {
+    assert (connection->flags & CAIRO_XCB_HAS_RENDER);
     xcb_render_composite_glyphs_8 (connection->xcb_connection, op, src, dst, mask_format,
 				   glyphset, src_x, src_y, glyphcmds_len, glyphcmds);
 }
@@ -178,6 +189,7 @@ _cairo_xcb_connection_render_composite_glyphs_16 (cairo_xcb_connection_t
 						  uint32_t                 glyphcmds_len,
 						  uint8_t           *glyphcmds)
 {
+    assert (connection->flags & CAIRO_XCB_HAS_RENDER);
     xcb_render_composite_glyphs_16 (connection->xcb_connection, op, src, dst, mask_format,
 				    glyphset, src_x, src_y, glyphcmds_len, glyphcmds);
 }
@@ -194,6 +206,7 @@ _cairo_xcb_connection_render_composite_glyphs_32 (cairo_xcb_connection_t
 						  uint32_t                 glyphcmds_len,
 						  uint8_t           *glyphcmds)
 {
+    assert (connection->flags & CAIRO_XCB_HAS_RENDER);
     xcb_render_composite_glyphs_32 (connection->xcb_connection, op, src, dst, mask_format,
 				    glyphset, src_x, src_y, glyphcmds_len, glyphcmds);
 }
@@ -206,6 +219,7 @@ _cairo_xcb_connection_render_fill_rectangles (cairo_xcb_connection_t      *conne
 					      uint32_t               num_rects,
 					      xcb_rectangle_t *rects)
 {
+    assert (connection->flags & CAIRO_XCB_RENDER_HAS_FILL_RECTANGLES);
     xcb_render_fill_rectangles (connection->xcb_connection, op, dst, color,
 				num_rects, rects);
 }
@@ -215,6 +229,7 @@ _cairo_xcb_connection_render_set_picture_transform (cairo_xcb_connection_t
 						    xcb_render_picture_t    picture,
 						    xcb_render_transform_t  *transform)
 {
+    assert (connection->flags & CAIRO_XCB_RENDER_HAS_PICTURE_TRANSFORM);
     xcb_render_set_picture_transform (connection->xcb_connection, picture, *transform);
 }
 
@@ -224,6 +239,7 @@ _cairo_xcb_connection_render_set_picture_filter (cairo_xcb_connection_t
 						 uint16_t                  filter_len,
 						 char               *filter)
 {
+    assert (connection->flags & CAIRO_XCB_RENDER_HAS_FILTERS);
     xcb_render_set_picture_filter (connection->xcb_connection, picture,
 				   filter_len, filter, 0, NULL);
 }
@@ -233,6 +249,7 @@ _cairo_xcb_connection_render_create_solid_fill (cairo_xcb_connection_t     *conn
 						xcb_render_picture_t  picture,
 						xcb_render_color_t    color)
 {
+    assert (connection->flags & CAIRO_XCB_RENDER_HAS_GRADIENTS);
     xcb_render_create_solid_fill (connection->xcb_connection, picture, color);
 }
 
@@ -245,6 +262,7 @@ _cairo_xcb_connection_render_create_linear_gradient (cairo_xcb_connection_t
 						     xcb_render_fixed_t *stops,
 						     xcb_render_color_t *colors)
 {
+    assert (connection->flags & CAIRO_XCB_RENDER_HAS_GRADIENTS);
     xcb_render_create_linear_gradient (connection->xcb_connection, picture,
 				       p1, p2, num_stops, stops, colors);
 }
@@ -260,6 +278,7 @@ _cairo_xcb_connection_render_create_radial_gradient (cairo_xcb_connection_t
 						     xcb_render_fixed_t *stops,
 						     xcb_render_color_t *colors)
 {
+    assert (connection->flags & CAIRO_XCB_RENDER_HAS_GRADIENTS);
     xcb_render_create_radial_gradient (connection->xcb_connection, picture,
 				       inner, outer, inner_radius, outer_radius,
 				       num_stops, stops, colors);
@@ -274,6 +293,7 @@ _cairo_xcb_connection_render_create_conical_gradient (cairo_xcb_connection_t
 						      xcb_render_fixed_t *stops,
 						      xcb_render_color_t *colors)
 {
+    assert (connection->flags & CAIRO_XCB_RENDER_HAS_GRADIENTS);
     xcb_render_create_conical_gradient (connection->xcb_connection, picture,
 				       center, angle, num_stops, stops, colors);
 }
diff --git a/src/cairo-xcb-connection-shm.c b/src/cairo-xcb-connection-shm.c
index 2ba9583..8c1d506 100644
--- a/src/cairo-xcb-connection-shm.c
+++ b/src/cairo-xcb-connection-shm.c
@@ -44,6 +44,7 @@ _cairo_xcb_connection_shm_attach (cairo_xcb_connection_t *connection,
 				  cairo_bool_t readonly)
 {
     uint32_t segment = _cairo_xcb_connection_get_xid (connection);
+    assert (connection->flags & CAIRO_XCB_HAS_SHM);
     xcb_shm_attach (connection->xcb_connection, segment, id, readonly);
     return segment;
 }
@@ -64,6 +65,7 @@ _cairo_xcb_connection_shm_put_image (cairo_xcb_connection_t *connection,
 				     uint32_t shm,
 				     uint32_t offset)
 {
+    assert (connection->flags & CAIRO_XCB_HAS_SHM);
     xcb_shm_put_image (connection->xcb_connection, dst, gc, total_width, total_height,
 		       src_x, src_y, width, height, dst_x, dst_y, depth,
 		       XCB_IMAGE_FORMAT_Z_PIXMAP, 0, shm, offset);
@@ -82,6 +84,7 @@ _cairo_xcb_connection_shm_get_image (cairo_xcb_connection_t *connection,
     xcb_shm_get_image_reply_t *reply;
     xcb_generic_error_t *error;
 
+    assert (connection->flags & CAIRO_XCB_HAS_SHM);
     reply = xcb_shm_get_image_reply (connection->xcb_connection,
 				     xcb_shm_get_image (connection->xcb_connection,
 							src,
@@ -106,6 +109,7 @@ void
 _cairo_xcb_connection_shm_detach (cairo_xcb_connection_t *connection,
 				  uint32_t segment)
 {
+    assert (connection->flags & CAIRO_XCB_HAS_SHM);
     xcb_shm_detach (connection->xcb_connection, segment);
     _cairo_xcb_connection_put_xid (connection, segment);
 }


More information about the cairo-commit mailing list