summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-04-14 15:59:36 +0200
committerBenjamin Otte <otte@redhat.com>2010-04-15 18:31:00 +0200
commit7745ea21e104d0a5eec1814f19bacb7334f42185 (patch)
tree4e06434b9cc54b39b9801cc576f6db413259a047
parent596d3017a1b11cb9844e69330cdece7441929725 (diff)
gl: acquire/release properly in _cairo_gl_draw_image()
Fixes various testsuite failures, in particular ones related to masks.
-rw-r--r--src/cairo-gl-surface.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index ccad4c6d..df50db08 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -680,8 +680,14 @@ cairo_gl_surface_swapbuffers (cairo_surface_t *abstract_surface)
}
if (! surface->fb) {
- cairo_gl_context_t *ctx = (cairo_gl_context_t *) surface->base.device;
+ cairo_gl_context_t *ctx;
+
+ if (_cairo_gl_context_acquire (surface->base.device, &ctx))
+ return;
+
ctx->swap_buffers (ctx, surface);
+
+ _cairo_gl_context_release (ctx);
}
}
@@ -721,7 +727,7 @@ _cairo_gl_surface_draw_image (cairo_gl_surface_t *dst,
GLenum internal_format, format, type;
cairo_bool_t has_alpha;
cairo_image_surface_t *clone = NULL;
- cairo_gl_context_t *ctx = (cairo_gl_context_t *) dst->base.device;
+ cairo_gl_context_t *ctx;
int cpp;
cairo_status_t status = CAIRO_STATUS_SUCCESS;
@@ -749,6 +755,10 @@ _cairo_gl_surface_draw_image (cairo_gl_surface_t *dst,
cpp = PIXMAN_FORMAT_BPP (src->pixman_format) / 8;
+ status = _cairo_gl_context_acquire (dst->base.device, &ctx);
+ if (unlikely (status))
+ return status;
+
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
glPixelStorei (GL_UNPACK_ROW_LENGTH, src->stride / cpp);
if (dst->fb) {
@@ -876,6 +886,8 @@ _cairo_gl_surface_draw_image (cairo_gl_surface_t *dst,
fail:
glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
+ _cairo_gl_context_release (ctx);
+
cairo_surface_destroy (&clone->base);
return CAIRO_STATUS_SUCCESS;