[PATCH] gl: Fix offset for non-texture surface patterns

Martin Robinson mrobinson at webkit.org
Thu Oct 13 15:52:57 PDT 2011


Instead of drawing only a portion of the image into the intermediate
texture, draw the entire image and adjust the translation matrix to
compensate.
---
 src/cairo-gl-operand.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/cairo-gl-operand.c b/src/cairo-gl-operand.c
index a7e187e..c544532 100644
--- a/src/cairo-gl-operand.c
+++ b/src/cairo-gl-operand.c
@@ -156,7 +156,7 @@ _cairo_gl_pattern_texture_setup (cairo_gl_operand_t *operand,
     if (src->surface->backend->type == CAIRO_SURFACE_TYPE_IMAGE) {
 	status = _cairo_gl_surface_draw_image (surface,
 				      (cairo_image_surface_t *)src->surface,
-				      src_x, src_y,
+				      0, 0,
 				      width, height,
 				      0, 0);
 
@@ -166,9 +166,8 @@ _cairo_gl_pattern_texture_setup (cairo_gl_operand_t *operand,
 	cairo_surface_t *image;
 
 	image = cairo_surface_map_to_image (&surface->base, NULL);
-	status = _cairo_surface_offset_paint (image, src_x, src_y,
-					      CAIRO_OPERATOR_SOURCE, _src,
-					      NULL);
+	status = _cairo_surface_paint (image, CAIRO_OPERATOR_SOURCE,
+				       _src, NULL);
 	cairo_surface_unmap_image (&surface->base, image);
 
 	attributes->extend = CAIRO_EXTEND_NONE;
@@ -185,7 +184,7 @@ _cairo_gl_pattern_texture_setup (cairo_gl_operand_t *operand,
      * (unnormalized src -> unnormalized src) to
      * (unnormalized dst -> unnormalized src)
      */
-    cairo_matrix_init_translate (&m, -dst_x, -dst_y);
+    cairo_matrix_init_translate (&m, src_x - dst_x, src_y - dst_y);
     cairo_matrix_multiply (&attributes->matrix, &m, &src->base.matrix);
 
     /* Translate the matrix from
-- 
1.7.5.4



More information about the cairo mailing list