Re: [PATCH] gl: Fix offset for non-texture surface patterns
Martin Robinson <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
On 11/10/2011 01:36 PM, Andrea Canciani wrote: 'm not sure if the infinite loop you are describing is actually > possible (maybe by using a surface as source to draw on that same > surface...). > Anyway if that's an issue with _cairo_surface_paint(), that will also > be a problem with _cairo_surface_offset_paint(). Oh! For some crazy reason I thought you were suggesting replacing the call to _cairo_gl_surface_draw_image. Sorry. Indeed, the call to_cairo_surface_offset_paint can just be _cairo_surface_offset_paint. New patch follows... From 63c5b5c1d250c00f033c99e4a6bb6cd174fac171 Mon Sep 17 00:00:00 2001 From: Martin Robinson <[email protected]> Date: Thu, 13 Oct 2011 15:52:57 -0700 Subject: [PATCH] gl: Fix offset for non-texture surface patterns 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 -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo