summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-09-30 20:11:12 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-09-30 20:11:12 +0100
commit39284159234d5318c90fa3a72178cd3d14fe0fbb (patch)
tree0eba9162c322070ad2a47dfeec9a1d5476f530a1
parente9bc2180d73acc7133d715ed4380ed20fb4364c0 (diff)
[boilerplate/xcb] Fix pixmap depth
All the error checking, finally pointed out that I was creating a pixmap with the wrong depth! Oops.
-rw-r--r--boilerplate/cairo-boilerplate-xcb.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/boilerplate/cairo-boilerplate-xcb.c b/boilerplate/cairo-boilerplate-xcb.c
index 51fde397..0ab2026f 100644
--- a/boilerplate/cairo-boilerplate-xcb.c
+++ b/boilerplate/cairo-boilerplate-xcb.c
@@ -73,6 +73,7 @@ _cairo_boilerplate_xcb_create_surface (const char *name,
xcb_connection_t *c;
xcb_render_pictforminfo_t *render_format;
xcb_pict_standard_t format;
+ xcb_void_cookie_t cookie;
cairo_surface_t *surface;
cairo_status_t status;
@@ -92,22 +93,34 @@ _cairo_boilerplate_xcb_create_surface (const char *name,
root = xcb_setup_roots_iterator(xcb_get_setup(c)).data;
xtc->pixmap = xcb_generate_id (c);
- xcb_create_pixmap (c, 32, xtc->pixmap, root->root,
- width, height);
-
switch (content) {
case CAIRO_CONTENT_COLOR:
+ cookie = xcb_create_pixmap_checked (c, 24,
+ xtc->pixmap, root->root,
+ width, height);
format = XCB_PICT_STANDARD_RGB_24;
break;
+
case CAIRO_CONTENT_COLOR_ALPHA:
+ cookie = xcb_create_pixmap_checked (c, 32,
+ xtc->pixmap, root->root,
+ width, height);
format = XCB_PICT_STANDARD_ARGB_32;
break;
+
case CAIRO_CONTENT_ALPHA: /* would be XCB_PICT_STANDARD_A_8 */
default:
fprintf (stderr, "Invalid content for XCB test: %d\n", content);
return NULL;
}
+ /* slow, but sure */
+ if (xcb_request_check (c, cookie) != NULL) {
+ xcb_disconnect (c);
+ free (xtc);
+ return NULL;
+ }
+
render_format = xcb_render_util_find_standard_format (xcb_render_util_query_formats (c), format);
if (render_format->id == 0)
return NULL;