[cairo-commit] 2 commits - src/cairo-gl-spans-compositor.c
Chris Wilson
ickle at kemper.freedesktop.org
Fri May 11 09:32:25 PDT 2012
src/cairo-gl-spans-compositor.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
New commits:
commit 117a44a33526a7738cac6643ea35fb73dc8a710f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri May 11 17:17:05 2012 +0100
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 <strgnm at gmail.com>
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/cairo-gl-spans-compositor.c b/src/cairo-gl-spans-compositor.c
index 023cfd9..4c5cef6 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);
commit 0196327b30dd01ce0169a7bc67024b932368af4e
Author: Chuanbo Weng <strgnm at gmail.com>
Date: Fri May 11 23:58:05 2012 +0800
gl: Convert CLEAR to DEST_OUT when there's a mask for composite_boxes.
As Cairo's CLEAR sematics are for a bounded operation, and GL's uses the
simple semantics for its CLEAR composite, we need to convert the
operation into an equivalent DEST_OUT when we have a mask.
diff --git a/src/cairo-gl-spans-compositor.c b/src/cairo-gl-spans-compositor.c
index 0c2134f..023cfd9 100644
--- a/src/cairo-gl-spans-compositor.c
+++ b/src/cairo-gl-spans-compositor.c
@@ -359,15 +359,25 @@ composite_boxes (void *_dst,
cairo_gl_composite_t setup;
cairo_gl_context_t *ctx;
cairo_int_status_t status;
+ cairo_gl_operand_t tmp_operand;
+ cairo_gl_operand_t *src_operand;
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;
+ } else
+ src_operand = source_to_operand (abstract_src);
+
status = _cairo_gl_composite_init (&setup, op, _dst, FALSE);
if (unlikely (status))
goto FAIL;
_cairo_gl_composite_set_source_operand (&setup,
- source_to_operand (abstract_src));
+ src_operand);
_cairo_gl_operand_translate (&setup.src, -src_x, -src_y);
_cairo_gl_composite_set_mask_operand (&setup,
@@ -383,6 +393,8 @@ composite_boxes (void *_dst,
FAIL:
_cairo_gl_composite_fini (&setup);
+ if (src_operand == &tmp_operand)
+ _cairo_gl_operand_destroy (&tmp_operand);
return status;
}
More information about the cairo-commit
mailing list