summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-04-13 20:53:47 +0200
committerBenjamin Otte <otte@redhat.com>2010-04-15 18:31:00 +0200
commit596d3017a1b11cb9844e69330cdece7441929725 (patch)
treeff808ea012318f9f76412c8b3b11b481fad3e410
parent46ef05c3d73af2b222602954b986832e77355a12 (diff)
gl: acquire/release context when getting images
Avoids Mesa complaining about no current context.
-rw-r--r--src/cairo-gl-surface.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 5fca0181..ccad4c6d 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -888,10 +888,12 @@ _cairo_gl_surface_get_image (cairo_gl_surface_t *surface,
cairo_rectangle_int_t *rect_out)
{
cairo_image_surface_t *image;
+ cairo_gl_context_t *ctx;
GLenum err;
GLenum format, type;
cairo_format_t cairo_format;
unsigned int cpp;
+ cairo_status_t status;
/* Want to use a switch statement here but the compiler gets whiny. */
if (surface->base.content == CAIRO_CONTENT_COLOR_ALPHA) {
@@ -924,6 +926,9 @@ _cairo_gl_surface_get_image (cairo_gl_surface_t *surface,
* it the destination. But then, this is the fallback path, so let's not
* fall back instead.
*/
+ status = _cairo_gl_context_acquire (surface->base.device, &ctx);
+ if (unlikely (status))
+ return status;
_cairo_gl_set_destination (surface);
glPixelStorei (GL_PACK_ALIGNMENT, 1);
@@ -939,6 +944,8 @@ _cairo_gl_surface_get_image (cairo_gl_surface_t *surface,
while ((err = glGetError ()))
fprintf (stderr, "GL error 0x%08x\n", (int) err);
+ _cairo_gl_context_release (ctx);
+
*image_out = image;
if (rect_out != NULL)
*rect_out = *interest;