[cairo-commit] src/cairo-gl-traps-compositor.c

Chris Wilson ickle at kemper.freedesktop.org
Thu May 31 04:00:53 PDT 2012


 src/cairo-gl-traps-compositor.c |   22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

New commits:
commit 98c3ed1dbd9036cb8d6f64d170d213a865e2094a
Author: Chuanbo Weng <strgnm at gmail.com>
Date:   Wed May 30 22:51:03 2012 +0800

    gl: Do correct translation and lerp in gl-traps-compositor.
    
    Coordinate translation is necessary in composite_boxes(), composite()
    and composite_traps(). The translation value should set to correct
    value in traps_to_operand(). Also fix the bug in lerp().

diff --git a/src/cairo-gl-traps-compositor.c b/src/cairo-gl-traps-compositor.c
index 776b74c..a87fd16 100644
--- a/src/cairo-gl-traps-compositor.c
+++ b/src/cairo-gl-traps-compositor.c
@@ -174,9 +174,11 @@ composite_boxes (void			*_dst,
 
     _cairo_gl_composite_set_source_operand (&setup,
 					    source_to_operand (abstract_src));
+    _cairo_gl_operand_translate (&setup.src, dst_x-src_x, dst_y-src_y);
 
     _cairo_gl_composite_set_mask_operand (&setup,
 					  source_to_operand (abstract_mask));
+    _cairo_gl_operand_translate (&setup.mask, dst_x-mask_x, dst_y-mask_y);
 
     status = _cairo_gl_composite_begin (&setup, &ctx);
     if (unlikely (status))
@@ -214,9 +216,11 @@ composite (void			*_dst,
 
     _cairo_gl_composite_set_source_operand (&setup,
 					    source_to_operand (abstract_src));
+    _cairo_gl_operand_translate (&setup.src, dst_x-src_x, dst_y-src_y);
 
     _cairo_gl_composite_set_mask_operand (&setup,
 					  source_to_operand (abstract_mask));
+    _cairo_gl_operand_translate (&setup.mask, dst_x-mask_x, dst_y-mask_y);
 
     status = _cairo_gl_composite_begin (&setup, &ctx);
     if (unlikely (status))
@@ -247,9 +251,9 @@ lerp (void			*dst,
     cairo_int_status_t status;
 
     /* we could avoid some repetition... */
-    status = composite (dst, CAIRO_OPERATOR_DEST_OUT, src, mask,
-			src_x, src_y,
+    status = composite (dst, CAIRO_OPERATOR_DEST_OUT, mask, NULL,
 			mask_x, mask_y,
+			0, 0,
 			dst_x, dst_y,
 			width, height);
     if (unlikely (status))
@@ -271,7 +275,8 @@ traps_to_operand (void *_dst,
 		  const cairo_rectangle_int_t *extents,
 		  cairo_antialias_t	antialias,
 		  cairo_traps_t		*traps,
-		  cairo_gl_operand_t	*operand)
+		  cairo_gl_operand_t	*operand,
+		  int dst_x, int dst_y)
 {
     pixman_format_code_t pixman_format;
     pixman_image_t *pixman_image;
@@ -315,7 +320,7 @@ traps_to_operand (void *_dst,
 
     _cairo_pattern_init_for_surface (&pattern, mask);
     cairo_matrix_init_translate (&pattern.base.matrix,
-				 -extents->x, -extents->y);
+				 -extents->x+dst_x, -extents->y+dst_y);
     pattern.base.filter = CAIRO_FILTER_NEAREST;
     pattern.base.extend = CAIRO_EXTEND_NONE;
     status = _cairo_gl_operand_init (operand, &pattern.base, _dst,
@@ -356,7 +361,8 @@ composite_traps (void			*_dst,
 
     _cairo_gl_composite_set_source_operand (&setup,
 					    source_to_operand (abstract_src));
-    status = traps_to_operand (_dst, extents, antialias, traps, &setup.mask);
+    _cairo_gl_operand_translate (&setup.src, -src_x-dst_x, -src_y-dst_y);
+    status = traps_to_operand (_dst, extents, antialias, traps, &setup.mask, dst_x, dst_y);
     if (unlikely (status))
 	goto FAIL;
 
@@ -366,9 +372,9 @@ composite_traps (void			*_dst,
 
     /* XXX clip */
     _cairo_gl_composite_emit_rect (ctx,
-				   dst_x, dst_y,
-				   dst_x+extents->width,
-				   dst_y+extents->height, 0);
+				   extents->x-dst_x, extents->y-dst_y,
+				   extents->x-dst_x+extents->width,
+				   extents->y-dst_y+extents->height, 0);
     status = _cairo_gl_context_release (ctx, CAIRO_STATUS_SUCCESS);
 
 FAIL:


More information about the cairo-commit mailing list