From 117a44a33526a7738cac6643ea35fb73dc8a710f Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 11 May 2012 17:17:05 +0100 Subject: [PATCH] gl: Reject SOURCE + mask in composite_boxes() As SOURCE requires a bounded operation and the GL compositor only implements a simple operation (i.e. it just blits from source to destination instead of applying a linear interpolation as required), we need to reject the operation and fallback. In the future, we should make the linear interpolation available through a GL shader or as a dual-source blend (better). Spotted-by: Chuanbo Weng Signed-off-by: Chris Wilson --- src/cairo-gl-spans-compositor.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/cairo-gl-spans-compositor.c b/src/cairo-gl-spans-compositor.c index 023cfd9f3..4c5cef65b 100644 --- a/src/cairo-gl-spans-compositor.c +++ b/src/cairo-gl-spans-compositor.c @@ -365,10 +365,16 @@ composite_boxes (void *_dst, TRACE ((stderr, "%s mask=(%d,%d), dst=(%d, %d)\n", __FUNCTION__, mask_x, mask_y, dst_x, dst_y)); - if (abstract_mask && op == CAIRO_OPERATOR_CLEAR) { - _cairo_gl_solid_operand_init (&tmp_operand, CAIRO_COLOR_WHITE); - src_operand = &tmp_operand; - op = CAIRO_OPERATOR_DEST_OUT; + if (abstract_mask) { + if (op == CAIRO_OPERATOR_CLEAR) { + _cairo_gl_solid_operand_init (&tmp_operand, CAIRO_COLOR_WHITE); + src_operand = &tmp_operand; + op = CAIRO_OPERATOR_DEST_OUT; + } else if (op == CAIRO_OPERATOR_SOURCE) { + /* requires a LERP in the shader between dest and source */ + return CAIRO_INT_STATUS_UNSUPPORTED; + } else + src_operand = source_to_operand (abstract_src); } else src_operand = source_to_operand (abstract_src);