[cairo] [PATCH 2/2] gl: Don't ignore offset for gradient sources

Andrea Canciani ranma42 at gmail.com
Wed Jan 12 16:21:20 PST 2011


_cairo_gl_operand_init() has parameters to specify an offset for the
source and another for the destination.

_cairo_gl_gradient_operand_init() incorrectly assumed that the two
offsets were identical.

Fixes mask, radial-gradient-mask-source.
---
 src/cairo-gl-composite.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c
index afd1edb..5017f55 100644
--- a/src/cairo-gl-composite.c
+++ b/src/cairo-gl-composite.c
@@ -150,8 +150,10 @@ _cairo_gl_solid_operand_init (cairo_gl_operand_t *operand,
 
 static cairo_status_t
 _cairo_gl_gradient_operand_init (cairo_gl_operand_t *operand,
+                                 const cairo_pattern_t *pattern,
 				 cairo_gl_surface_t *dst,
-                                 const cairo_pattern_t *pattern)
+				 int src_x, int src_y,
+				 int dst_x, int dst_y)
 {
     const cairo_gradient_pattern_t *gradient = (const cairo_gradient_pattern_t *)pattern;
     cairo_status_t status;
@@ -233,6 +235,7 @@ _cairo_gl_gradient_operand_init (cairo_gl_operand_t *operand,
 			       &m);
     }
 
+    cairo_matrix_translate (&operand->gradient.m, src_x - dst_x, src_y - dst_y);
 
     operand->gradient.extend = pattern->extend;
 
@@ -283,7 +286,10 @@ _cairo_gl_operand_init (cairo_gl_operand_t *operand,
 		                             &((cairo_solid_pattern_t *) pattern)->color);
     case CAIRO_PATTERN_TYPE_LINEAR:
     case CAIRO_PATTERN_TYPE_RADIAL:
-	status = _cairo_gl_gradient_operand_init (operand, dst, pattern);
+	status = _cairo_gl_gradient_operand_init (operand,
+						  pattern, dst,
+						  src_x, src_y,
+						  dst_x, dst_y);
 	if (status != CAIRO_INT_STATUS_UNSUPPORTED)
 	    return status;
 
-- 
1.7.1



More information about the cairo mailing list