[PATCH] gl: Do operator conversion and judgement in beginning of composite_boxes.

Chuanbo Weng <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
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

--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.