diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-01-18 23:37:11 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-01-22 23:01:50 +0000 |
commit | ccea7fd7c1a2d7144e892c19615488e368529bc0 (patch) | |
tree | 47bb1d29d67f1f96bbc76b4ee628b4260e938bb3 /boilerplate | |
parent | 3acd520c9dec89e72d7ff61adb1ae30bab12e256 (diff) |
gl: Port to cairo_device_t
Diffstat (limited to 'boilerplate')
-rw-r--r-- | boilerplate/cairo-boilerplate-gl.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/boilerplate/cairo-boilerplate-gl.c b/boilerplate/cairo-boilerplate-gl.c index 8f3669a0..8dfe6e92 100644 --- a/boilerplate/cairo-boilerplate-gl.c +++ b/boilerplate/cairo-boilerplate-gl.c @@ -37,9 +37,10 @@ typedef struct _gl_target_closure { Display *dpy; int screen; + Window drawable; - GLXContext gl_ctx; - cairo_gl_context_t *ctx; + GLXContext ctx; + cairo_device_t *device; cairo_surface_t *surface; } gl_target_closure_t; @@ -48,9 +49,15 @@ _cairo_boilerplate_gl_cleanup (void *closure) { gl_target_closure_t *gltc = closure; - cairo_gl_context_destroy (gltc->ctx); - glXDestroyContext (gltc->dpy, gltc->gl_ctx); + cairo_device_finish (gltc->device); + cairo_device_destroy (gltc->device); + + glXDestroyContext (gltc->dpy, gltc->ctx); + + if (gltc->drawable) + XDestroyWindow (gltc->dpy, gltc->drawable); XCloseDisplay (gltc->dpy); + free (gltc); } @@ -79,12 +86,12 @@ _cairo_boilerplate_gl_create_surface (const char *name, GLX_DOUBLEBUFFER, None }; XVisualInfo *visinfo; - GLXContext gl_ctx; + GLXContext ctx; gl_target_closure_t *gltc; cairo_surface_t *surface; Display *dpy; - gltc = malloc (sizeof (gl_target_closure_t)); + gltc = calloc (1, sizeof (gl_target_closure_t)); *closure = gltc; if (width == 0) @@ -115,13 +122,14 @@ _cairo_boilerplate_gl_create_surface (const char *name, return NULL; } - gl_ctx = glXCreateContext (dpy, visinfo, NULL, True); + ctx = glXCreateContext (dpy, visinfo, NULL, True); XFree (visinfo); - gltc->gl_ctx = gl_ctx; - gltc->ctx = cairo_glx_context_create (dpy, gl_ctx); + gltc->ctx = ctx; + gltc->device = cairo_glx_device_create (dpy, ctx); - gltc->surface = surface = cairo_gl_surface_create (gltc->ctx, content, + gltc->surface = surface = cairo_gl_surface_create (gltc->device, + content, ceil (width), ceil (height)); if (cairo_surface_status (surface)) |