summaryrefslogtreecommitdiff
path: root/test/xlib-surface-source.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-01-22 19:47:58 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2010-01-22 23:01:51 +0000
commit005b0c4eb2a1fe2c4de31ebe2a3244bea8bd2625 (patch)
treea4e0c0fac39b16b2748b53efd98f125728607320 /test/xlib-surface-source.c
parentca02b51ef6d058b6fb492258177f0396a5819e26 (diff)
downloadcairo-005b0c4eb2a1fe2c4de31ebe2a3244bea8bd2625.tar.gz
test: Add explicit device management to xlib-surface-source
Mostly pedagogical example.
Diffstat (limited to 'test/xlib-surface-source.c')
-rw-r--r--test/xlib-surface-source.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/xlib-surface-source.c b/test/xlib-surface-source.c
index b99f0888d..65a9fdfe4 100644
--- a/test/xlib-surface-source.c
+++ b/test/xlib-surface-source.c
@@ -34,6 +34,7 @@
static cairo_user_data_key_t closure_key;
struct closure {
+ cairo_device_t *device;
Display *dpy;
Pixmap pix;
};
@@ -43,6 +44,9 @@ cleanup (void *data)
{
struct closure *arg = data;
+ cairo_device_finish (arg->device);
+ cairo_device_destroy (arg->device);
+
XFreePixmap (arg->dpy, arg->pix);
XCloseDisplay (arg->dpy);
@@ -74,6 +78,7 @@ create_source_surface (int size)
DefaultScreenOfDisplay (data->dpy),
xrender_format,
size, size);
+ data->device = cairo_device_reference (cairo_surface_get_device (surface));
cairo_surface_set_user_data (surface, &closure_key, data, cleanup);
return surface;