diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-09-03 09:20:46 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-09-03 09:22:23 +0100 |
commit | a1bac73f24069990842fa8f31e776b4d2c72546e (patch) | |
tree | c62f415f6a0d6ff3635d2c0c48910eb722aa9e53 /boilerplate | |
parent | f1d284f9976d38f636c6791f11479ae75d7bd199 (diff) |
[boilerplate] Handle errors whilst creating GL surface
Diffstat (limited to 'boilerplate')
-rw-r--r-- | boilerplate/cairo-boilerplate-gl.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/boilerplate/cairo-boilerplate-gl.c b/boilerplate/cairo-boilerplate-gl.c index 0facc5cb..8f3669a0 100644 --- a/boilerplate/cairo-boilerplate-gl.c +++ b/boilerplate/cairo-boilerplate-gl.c @@ -81,6 +81,7 @@ _cairo_boilerplate_gl_create_surface (const char *name, XVisualInfo *visinfo; GLXContext gl_ctx; gl_target_closure_t *gltc; + cairo_surface_t *surface; Display *dpy; gltc = malloc (sizeof (gl_target_closure_t)); @@ -120,13 +121,13 @@ _cairo_boilerplate_gl_create_surface (const char *name, gltc->gl_ctx = gl_ctx; gltc->ctx = cairo_glx_context_create (dpy, gl_ctx); - gltc->surface = cairo_gl_surface_create (gltc->ctx, content, - ceil (width), ceil (height)); - - if (gltc->surface == NULL || cairo_surface_status (gltc->surface)) + gltc->surface = surface = cairo_gl_surface_create (gltc->ctx, content, + ceil (width), + ceil (height)); + if (cairo_surface_status (surface)) _cairo_boilerplate_gl_cleanup (gltc); - return gltc->surface; + return surface; } static void |