diff options
author | Benjamin Otte <otte@redhat.com> | 2010-05-28 21:56:57 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-06-07 13:37:48 +0200 |
commit | 467d5e7f90b9edfb62ca71e67608704424a10aca (patch) | |
tree | cfe2399a15cd7cdcbc50cdf6595300fb314ae15f | |
parent | e15348d8d0bbff6968b1f640e63315d159f143f5 (diff) |
gl: Flush properly in set_destination
-rw-r--r-- | src/cairo-gl-device.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/cairo-gl-device.c b/src/cairo-gl-device.c index a957381c..1741ac07 100644 --- a/src/cairo-gl-device.c +++ b/src/cairo-gl-device.c @@ -223,23 +223,24 @@ _cairo_gl_context_init (cairo_gl_context_t *ctx) void _cairo_gl_context_set_destination (cairo_gl_context_t *ctx, - cairo_gl_surface_t *surface) + cairo_gl_surface_t *surface) { - cairo_surface_flush (&surface->base); - - if (ctx->current_target != surface) { - ctx->current_target = surface; - - if (_cairo_gl_surface_is_texture (surface)) { - glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, surface->fb); - glDrawBuffer (GL_COLOR_ATTACHMENT0_EXT); - glReadBuffer (GL_COLOR_ATTACHMENT0_EXT); - } else { - ctx->make_current (ctx, surface); - glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0); - glDrawBuffer (GL_BACK_LEFT); - glReadBuffer (GL_BACK_LEFT); - } + if (ctx->current_target == surface) + return; + + _cairo_gl_composite_flush (ctx); + + ctx->current_target = surface; + + if (_cairo_gl_surface_is_texture (surface)) { + glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, surface->fb); + glDrawBuffer (GL_COLOR_ATTACHMENT0_EXT); + glReadBuffer (GL_COLOR_ATTACHMENT0_EXT); + } else { + ctx->make_current (ctx, surface); + glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0); + glDrawBuffer (GL_BACK_LEFT); + glReadBuffer (GL_BACK_LEFT); } glViewport (0, 0, surface->width, surface->height); |