summaryrefslogtreecommitdiff
path: root/boilerplate
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2011-07-21 15:28:18 +0200
committerUli Schlachter <psychon@znc.in>2011-07-21 16:51:26 +0200
commit83df0ab2b6ccaf623303b606a99303b5d054b145 (patch)
treeb5a8e918294945c7b20cd4d036b484ec791e05bd /boilerplate
parent99628d06cd7943bf20e84a050595c33da6e3ff7d (diff)
XCB: Store the flags per-connection only
Every xcb surface had its own copy of the flags from the time that it was created. This means that, if you want to make use of cairo_xcb_device_debug_cap_xrender_version() and cairo_xcb_device_debug_cap_xshm_version(), you first had to create a dummy xcb surface, use that to get access to the cairo_device_t so that you can use these functions and only then create your real surface, because the change only affected new surfaces. This commit changes everything to use the connection's flag and removes the per-surface flags. This avoids the dummy surfaces completely. Signed-off-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'boilerplate')
-rw-r--r--boilerplate/cairo-boilerplate-xcb.c45
1 files changed, 16 insertions, 29 deletions
diff --git a/boilerplate/cairo-boilerplate-xcb.c b/boilerplate/cairo-boilerplate-xcb.c
index b607a2936..34a0b029c 100644
--- a/boilerplate/cairo-boilerplate-xcb.c
+++ b/boilerplate/cairo-boilerplate-xcb.c
@@ -562,7 +562,7 @@ _cairo_boilerplate_xcb_create_render_0_0 (const char *name,
xcb_render_pictforminfo_t *render_format;
int depth;
xcb_void_cookie_t cookie;
- cairo_surface_t *surface, *tmp;
+ cairo_surface_t *surface;
cairo_status_t status;
void *formats;
@@ -621,27 +621,20 @@ _cairo_boilerplate_xcb_create_render_0_0 (const char *name,
return NULL;
}
- tmp = cairo_xcb_surface_create_with_xrender_format (c, root,
- xtc->drawable,
- render_format,
- width, height);
- if (cairo_surface_status (tmp)) {
+ surface = cairo_xcb_surface_create_with_xrender_format (c, root,
+ xtc->drawable,
+ render_format,
+ width, height);
+ if (cairo_surface_status (surface)) {
free (formats);
xcb_disconnect (c);
free (xtc);
- return tmp;
+ return surface;
}
- xtc->device = cairo_device_reference (cairo_surface_get_device (tmp));
+ xtc->device = cairo_device_reference (cairo_surface_get_device (surface));
cairo_xcb_device_debug_cap_xrender_version (xtc->device, 0, 0);
- /* recreate with impaired connection */
- surface = cairo_xcb_surface_create_with_xrender_format (c, root,
- xtc->drawable,
- render_format,
- width, height);
- cairo_surface_destroy (tmp);
-
assert (cairo_surface_get_device (surface) == xtc->device);
status = cairo_surface_set_user_data (surface, &xcb_closure_key, xtc, NULL);
@@ -669,7 +662,7 @@ _cairo_boilerplate_xcb_create_fallback (const char *name,
xcb_connection_t *c;
xcb_screen_t *s;
xcb_void_cookie_t cookie;
- cairo_surface_t *tmp, *surface;
+ cairo_surface_t *surface;
cairo_status_t status;
uint32_t values[] = { 1 };
@@ -714,24 +707,18 @@ _cairo_boilerplate_xcb_create_fallback (const char *name,
return NULL;
}
- tmp = cairo_xcb_surface_create (c,
- xtc->drawable,
- lookup_visual (s, s->root_visual),
- width, height);
- if (cairo_surface_status (tmp)) {
+ surface = cairo_xcb_surface_create (c,
+ xtc->drawable,
+ lookup_visual (s, s->root_visual),
+ width, height);
+ if (cairo_surface_status (surface)) {
xcb_disconnect (c);
free (xtc);
- return tmp;
+ return surface;
}
- cairo_xcb_device_debug_cap_xrender_version (cairo_surface_get_device (tmp),
+ cairo_xcb_device_debug_cap_xrender_version (cairo_surface_get_device (surface),
-1, -1);
- /* recreate with impaired connection */
- surface = cairo_xcb_surface_create (c,
- xtc->drawable,
- lookup_visual (s, s->root_visual),
- width, height);
- cairo_surface_destroy (tmp);
xtc->device = cairo_device_reference (cairo_surface_get_device (surface));
status = cairo_surface_set_user_data (surface, &xcb_closure_key, xtc, NULL);