summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-05-28 13:18:28 +0200
committerBenjamin Otte <otte@redhat.com>2010-06-07 13:37:47 +0200
commitae9517a39fdddec389553a64116140e222970ef0 (patch)
tree05ab81c18638e0afcba8b26fc4f37db0dc2e7be8
parentf72afc09d0b99030f5766e7bbbb05f6db606e195 (diff)
gl: Check mask's attributes for component alpha
... and don't duplicate that information into the cairo_gl_composite_t
-rw-r--r--src/cairo-gl-composite.c14
-rw-r--r--src/cairo-gl-private.h1
2 files changed, 8 insertions, 7 deletions
diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c
index 32940af8..3067be40 100644
--- a/src/cairo-gl-composite.c
+++ b/src/cairo-gl-composite.c
@@ -462,7 +462,6 @@ _cairo_gl_composite_set_mask (cairo_gl_composite_t *setup,
int width, int height)
{
_cairo_gl_operand_destroy (&setup->mask);
- setup->has_component_alpha = pattern && pattern->has_component_alpha;
if (pattern == NULL)
return CAIRO_STATUS_SUCCESS;
@@ -478,7 +477,6 @@ _cairo_gl_composite_set_mask_spans (cairo_gl_composite_t *setup)
{
_cairo_gl_operand_destroy (&setup->mask);
setup->mask.type = CAIRO_GL_OPERAND_SPANS;
- setup->has_component_alpha = FALSE;
}
void
@@ -922,6 +920,7 @@ _cairo_gl_composite_begin (cairo_gl_composite_t *setup,
unsigned int dst_size, src_size, mask_size;
cairo_gl_context_t *ctx;
cairo_status_t status;
+ cairo_bool_t component_alpha;
assert (setup->dst);
@@ -931,8 +930,11 @@ _cairo_gl_composite_begin (cairo_gl_composite_t *setup,
assert (! _cairo_gl_context_is_in_progress (ctx));
+ component_alpha = ((setup->mask.type == CAIRO_GL_OPERAND_TEXTURE) &&
+ setup->mask.texture.attributes.has_component_alpha);
+
/* Do various magic for component alpha */
- if (setup->has_component_alpha) {
+ if (component_alpha) {
status = _cairo_gl_composite_begin_component_alpha (ctx, setup);
if (unlikely (status))
goto FAIL;
@@ -941,8 +943,8 @@ _cairo_gl_composite_begin (cairo_gl_composite_t *setup,
status = _cairo_gl_set_shader_by_type (ctx,
setup->src.type,
setup->mask.type,
- setup->has_component_alpha ? CAIRO_GL_SHADER_IN_CA_SOURCE
- : CAIRO_GL_SHADER_IN_NORMAL);
+ component_alpha ? CAIRO_GL_SHADER_IN_CA_SOURCE
+ : CAIRO_GL_SHADER_IN_NORMAL);
if (unlikely (status)) {
ctx->pre_shader = NULL;
goto FAIL;
@@ -959,7 +961,7 @@ _cairo_gl_composite_begin (cairo_gl_composite_t *setup,
_cairo_gl_context_set_destination (ctx, setup->dst);
_cairo_gl_set_operator (setup->dst,
setup->op,
- setup->has_component_alpha);
+ component_alpha);
_cairo_gl_composite_bind_to_shader (ctx, setup);
diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h
index c2a1e13f..d8520dfe 100644
--- a/src/cairo-gl-private.h
+++ b/src/cairo-gl-private.h
@@ -202,7 +202,6 @@ typedef struct _cairo_gl_context {
typedef struct _cairo_gl_composite {
cairo_gl_surface_t *dst;
cairo_operator_t op;
- cairo_bool_t has_component_alpha;
cairo_region_t *clip_region;
cairo_gl_operand_t src;