summaryrefslogtreecommitdiff
path: root/src/cairo-gstate.c
diff options
context:
space:
mode:
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) {