summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-05-05 12:28:24 +0200
committerBenjamin Otte <otte@redhat.com>2010-05-05 12:30:01 +0200
commita354f1f92a17378f42d0b703482ae2b8168c7f68 (patch)
tree92abc9c60d7146d51eb4def5c69c09e9f9a78886
parent36210ee51444979271f7ba1cc0ac452cd30df0af (diff)
gl: Another case of proper device acquiring
This patch isn't strictly necessary, but it cleans up the code.
-rw-r--r--src/cairo-gl-surface.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 5576a995..c6aacdf4 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -536,20 +536,23 @@ _cairo_gl_surface_create_similar (void *abstract_surface,
int height)
{
cairo_surface_t *surface = abstract_surface;
- cairo_gl_context_t *ctx = (cairo_gl_context_t *) surface->device;
+ cairo_gl_context_t *ctx;
cairo_status_t status;
+ status = _cairo_gl_context_acquire (surface->device, &ctx);
+ if (unlikely (status))
+ return _cairo_surface_create_in_error (status);
+
if (width > ctx->max_framebuffer_size ||
height > ctx->max_framebuffer_size)
{
- return NULL;
+ surface = NULL;
+ goto RELEASE;
}
- status = _cairo_gl_context_acquire (surface->device, &ctx);
- if (unlikely (status))
- return _cairo_surface_create_in_error (status);
-
surface = _cairo_gl_surface_create_scratch (ctx, content, width, height);
+
+RELEASE:
_cairo_gl_context_release (ctx);
return surface;