summaryrefslogtreecommitdiff
path: root/src/cairo-gstate.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-04-03 14:09:56 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-05-12 20:54:48 +0100
commita85c6c1e36273d534f01ade0714b0592b6bed5ab (patch)
treebe3aa3a1b382630b3175228189264d2c3a08ee82 /src/cairo-gstate.c
parenta3cb52e4037db9e565d32f85d69c364b606555e9 (diff)
gstate: reduce a couple more operators
Diffstat (limited to 'src/cairo-gstate.c')
-rw-r--r--src/cairo-gstate.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index 5a8664a0..caed88b5 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -993,8 +993,21 @@ _reduce_op (cairo_gstate_t *gstate)
const cairo_pattern_t *pattern;
op = gstate->op;
- if (op != CAIRO_OPERATOR_SOURCE)
+ if (op == CAIRO_OPERATOR_IN &&
+ gstate->target->is_clear &&
+ gstate->target->content & CAIRO_CONTENT_ALPHA)
+ {
+ return CAIRO_OPERATOR_CLEAR;
+ }
+
+ if (op != CAIRO_OPERATOR_SOURCE &&
+ ! (gstate->target->is_clear &&
+ (op == CAIRO_OPERATOR_OVER ||
+ (op == CAIRO_OPERATOR_ADD &&
+ gstate->target->content & CAIRO_CONTENT_ALPHA))))
+ {
return op;
+ }
pattern = gstate->source;
if (pattern->type == CAIRO_PATTERN_TYPE_SOLID) {