[cairo] [PATCH] gl: Do operator conversion and judgement in beginning of composite_boxes.
Chuanbo Weng
strgnm at gmail.com
Thu May 10 08:45:13 PDT 2012
The main purpose is to convert CLEAR to DEST_OUT when there's a mask.
This fix zero-mask case in cairo-test-suite.
---
src/cairo-gl-spans-compositor.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/cairo-gl-spans-compositor.c b/src/cairo-gl-spans-compositor.c
index 0c2134f..e1fc966 100644
--- a/src/cairo-gl-spans-compositor.c
+++ b/src/cairo-gl-spans-compositor.c
@@ -362,6 +362,25 @@ composite_boxes (void *_dst,
TRACE ((stderr, "%s mask=(%d,%d), dst=(%d, %d)\n", __FUNCTION__,
mask_x, mask_y, dst_x, dst_y));
+
+ if (((cairo_surface_t *)_dst)->is_clear &&
+ (op == CAIRO_OPERATOR_SOURCE ||
+ op == CAIRO_OPERATOR_OVER ||
+ op == CAIRO_OPERATOR_ADD)) {
+ op = CAIRO_OPERATOR_SOURCE;
+ } else if (abstract_mask) {
+ if (op == CAIRO_OPERATOR_CLEAR) {
+ _cairo_gl_solid_operand_init (source_to_operand (abstract_src), CAIRO_COLOR_WHITE);
+ op = CAIRO_OPERATOR_DEST_OUT;
+ } else if (op == CAIRO_OPERATOR_SOURCE) {
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+ } else if(! _cairo_gl_operator_is_supported (op)){
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
+ } else if (! _cairo_gl_operator_is_supported (op)){
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
+
status = _cairo_gl_composite_init (&setup, op, _dst, FALSE);
if (unlikely (status))
goto FAIL;
--
1.7.5.4
More information about the cairo
mailing list