[cairo] [PATCH] gl: Fix offset for non-texture surface patterns
Andrea Canciani
ranma42 at gmail.com
Sat Nov 5 02:12:35 PDT 2011
On Fri, Nov 4, 2011 at 9:31 PM, Martin Robinson <mrobinson at igalia.com> wrote:
> I'm not entirely certain this patch takes the correct approach, but
> it seems to fix problems with the GL and MSAA compositors when
> filling with a surface source.
>
> 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 | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/cairo-gl-operand.c b/src/cairo-gl-operand.c
> index a7e187e..bd59d97 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,7 +166,7 @@ _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,
> + status = _cairo_surface_offset_paint (image, 0, 0,
> CAIRO_OPERATOR_SOURCE, _src,
> NULL);
I'm not sure if the approach is correct, but, assuming it is, how about simply
using _cairo_surface_paint()?
Using a constant (0,0) offset looks weird to me.
Andrea
> cairo_surface_unmap_image (&surface->base, image);
> @@ -185,7 +185,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
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>
More information about the cairo
mailing list