diff options
author | Benjamin Otte <otte@redhat.com> | 2010-05-28 17:37:19 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-06-07 13:37:48 +0200 |
commit | e11d8370e0503f085beaa355d85fa6991cd497da (patch) | |
tree | bb716be7d778d1ac1a3e4be41238f47a955de35c | |
parent | 7747f6d9146c19419fdc4fbbdf72eed42dfa731d (diff) |
gl: Set GL_BLEND and GL_SCISSOR_TEST globally
Note that we do set them unconditionally in _begin() because a flush
might have cleared them.
-rw-r--r-- | src/cairo-gl-composite.c | 11 | ||||
-rw-r--r-- | src/cairo-gl-device.c | 8 | ||||
-rw-r--r-- | src/cairo-gl-surface.c | 1 |
3 files changed, 12 insertions, 8 deletions
diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c index 7691ef94..29e26e7b 100644 --- a/src/cairo-gl-composite.c +++ b/src/cairo-gl-composite.c @@ -816,7 +816,6 @@ _cairo_gl_set_operator (cairo_gl_surface_t *dst, cairo_operator_t op, dst_factor = GL_SRC_COLOR; } - glEnable (GL_BLEND); if (dst->base.content == CAIRO_CONTENT_ALPHA) { glBlendFuncSeparate (GL_ZERO, GL_ZERO, src_factor, dst_factor); } else { @@ -956,6 +955,7 @@ _cairo_gl_composite_begin (cairo_gl_composite_t *setup, return status; assert (! _cairo_gl_context_is_in_progress (ctx)); + glEnable (GL_BLEND); component_alpha = ((setup->mask.type == CAIRO_GL_OPERAND_TEXTURE) && setup->mask.texture.attributes.has_component_alpha); @@ -1004,6 +1004,8 @@ _cairo_gl_composite_begin (cairo_gl_composite_t *setup, ctx->clip_region = cairo_region_reference (setup->clip_region); if (ctx->clip_region) glEnable (GL_SCISSOR_TEST); + else + glDisable (GL_SCISSOR_TEST); *ctx_out = ctx; @@ -1207,16 +1209,9 @@ _cairo_gl_composite_end (cairo_gl_context_t *ctx, { _cairo_gl_composite_flush (ctx); - if (ctx->clip_region) { - glDisable (GL_SCISSOR_TEST); - cairo_region_destroy (ctx->clip_region); - ctx->clip_region = NULL; - } - glBindBufferARB (GL_ARRAY_BUFFER_ARB, 0); _cairo_gl_set_shader (ctx, NULL); - glDisable (GL_BLEND); glDisableClientState (GL_VERTEX_ARRAY); diff --git a/src/cairo-gl-device.c b/src/cairo-gl-device.c index bf570386..385cb682 100644 --- a/src/cairo-gl-device.c +++ b/src/cairo-gl-device.c @@ -75,6 +75,14 @@ _gl_flush (void *device) _cairo_gl_context_destroy_operand (ctx, CAIRO_GL_TEX_SOURCE); _cairo_gl_context_destroy_operand (ctx, CAIRO_GL_TEX_MASK); + if (ctx->clip_region) { + cairo_region_destroy (ctx->clip_region); + ctx->clip_region = NULL; + } + + glDisable (GL_SCISSOR_TEST); + glDisable (GL_BLEND); + _cairo_gl_context_release (ctx); return CAIRO_STATUS_SUCCESS; diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c index e64a05ae..1d264133 100644 --- a/src/cairo-gl-surface.c +++ b/src/cairo-gl-surface.c @@ -334,6 +334,7 @@ _cairo_gl_surface_clear (cairo_gl_surface_t *surface, a = 1.0; } + glDisable (GL_SCISSOR_TEST); glClearColor (r, g, b, a); glClear (GL_COLOR_BUFFER_BIT); _cairo_gl_context_release (ctx); |