[cairo-commit] 2 commits - src/cairo-gl-operand.c src/cairo-gl-spans-compositor.c
Chris Wilson
ickle at kemper.freedesktop.org
Wed Jul 25 09:10:29 PDT 2012
src/cairo-gl-operand.c | 22 ++++++++++++++++++++--
src/cairo-gl-spans-compositor.c | 9 +++++++--
2 files changed, 27 insertions(+), 4 deletions(-)
New commits:
commit 652c632fb211cede74cef3813c7d6e8099d02089
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Jul 25 17:03:54 2012 +0100
gl: Fallback for copy_boxes if src/dst do not belong to the same device
If the source and destination are on difference devices (GL contexts) we
can not simply texture from one to the other, and must either import the
source into the destination context (which has not yet been done) or
fallback through an image copy.
This patch is based on the work by Henry Song, but moving the check from
the common compositor layer down into the GL backend. This should have
the same effect...
Fixes gl-surface-source
Suggested-by: Henry Song <henry.song at samsung.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 171aee4..62da1eb 100644
--- a/src/cairo-gl-spans-compositor.c
+++ b/src/cairo-gl-spans-compositor.c
@@ -313,11 +313,13 @@ draw_image_boxes (void *_dst,
}
static cairo_int_status_t copy_boxes (void *_dst,
- cairo_surface_t *src,
+ cairo_surface_t *_src,
cairo_boxes_t *boxes,
const cairo_rectangle_int_t *extents,
int dx, int dy)
{
+ cairo_gl_surface_t *dst = _dst;
+ cairo_gl_surface_t *src = (cairo_gl_surface_t *)_src;
cairo_gl_composite_t setup;
cairo_gl_context_t *ctx;
cairo_int_status_t status;
@@ -326,11 +328,14 @@ static cairo_int_status_t copy_boxes (void *_dst,
if (! _cairo_gl_surface_is_texture (src))
return CAIRO_INT_STATUS_UNSUPPORTED;
+ if (src->base.device != dst->base.device)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
status = _cairo_gl_composite_init (&setup, CAIRO_OPERATOR_SOURCE, _dst, FALSE);
if (unlikely (status))
goto FAIL;
- _cairo_gl_composite_set_source_operand (&setup, source_to_operand (src));
+ _cairo_gl_composite_set_source_operand (&setup, &src->operand);
_cairo_gl_operand_translate (&setup.src, -dx, -dy);
status = _cairo_gl_composite_begin (&setup, &ctx);
commit f3abb1079a9766646dd0eda2f8a1633f8efff516
Author: Henry Song <henry.song at samsung.com>
Date: Wed Jul 25 16:12:22 2012 +0100
gl: translate proper matrix depending up type of gl_operand
Fixes radial-gradiant-mask-source.
diff --git a/src/cairo-gl-operand.c b/src/cairo-gl-operand.c
index 033d45e..ee6c08e 100644
--- a/src/cairo-gl-operand.c
+++ b/src/cairo-gl-operand.c
@@ -364,8 +364,26 @@ void
_cairo_gl_operand_translate (cairo_gl_operand_t *operand,
double tx, double ty)
{
- operand->texture.attributes.matrix.x0 -= tx * operand->texture.attributes.matrix.xx;
- operand->texture.attributes.matrix.y0 -= ty * operand->texture.attributes.matrix.yy;
+ switch (operand->type) {
+ case CAIRO_GL_OPERAND_TEXTURE:
+ operand->texture.attributes.matrix.x0 -= tx * operand->texture.attributes.matrix.xx;
+ operand->texture.attributes.matrix.y0 -= ty * operand->texture.attributes.matrix.yy;
+ break;
+
+ case CAIRO_GL_OPERAND_LINEAR_GRADIENT:
+ case CAIRO_GL_OPERAND_RADIAL_GRADIENT_A0:
+ case CAIRO_GL_OPERAND_RADIAL_GRADIENT_NONE:
+ case CAIRO_GL_OPERAND_RADIAL_GRADIENT_EXT:
+ operand->gradient.m.x0 -= tx * operand->gradient.m.xx;
+ operand->gradient.m.y0 -= ty * operand->gradient.m.yy;
+ break;
+
+ case CAIRO_GL_OPERAND_NONE:
+ case CAIRO_GL_OPERAND_CONSTANT:
+ case CAIRO_GL_OPERAND_COUNT:
+ default:
+ break;
+ }
}
static cairo_status_t
More information about the cairo-commit
mailing list