mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-24 04:00:26 +01:00
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.
This commit is contained in:
parent
7747f6d914
commit
e11d8370e0
3 changed files with 12 additions and 8 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue