diff options
author | Uli Schlachter <psychon@znc.in> | 2012-09-25 11:12:58 +0200 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2012-09-25 11:27:59 +0200 |
commit | b33d83ad49343ce226f76ceb6c83659c72442e91 (patch) | |
tree | 7cd3ac37ac7a7d6fea685372efb16ad445227fde | |
parent | de31018bdd1cc78fd54cf9fd7b220117008c33a8 (diff) |
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@znc.in>
-rw-r--r-- | src/cairo-xcb-connection-render.c | 20 | ||||
-rw-r--r-- | src/cairo-xcb-connection-shm.c | 4 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/cairo-xcb-connection-render.c b/src/cairo-xcb-connection-render.c index 8d95509b..61119653 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 2ba95831..8c1d5069 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); } |