[cairo-commit] cairo/src cairo-glitz-surface.c, 1.30, 1.31 cairo-gstate.c, 1.108, 1.109

Carl Worth commit at pdx.freedesktop.org
Tue Apr 12 07:12:10 PDT 2005


Committed by: cworth

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv16341/src

Modified Files:
	cairo-glitz-surface.c cairo-gstate.c 
Log Message:

        * src/cairo-gstate.c (_cairo_gstate_show_surface): Offset the src
        pattern by (0,0)->CTM. This fixes test/translate-show-surface.

        * src/cairo-glitz-surface.c
        (_cairo_glitz_surface_composite_trapezoids): Use unsigned cahr* to
        match new prototype for cairo_image_surface_create_for_data.


Index: cairo-glitz-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-glitz-surface.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- cairo-glitz-surface.c	8 Apr 2005 19:42:36 -0000	1.30
+++ cairo-glitz-surface.c	12 Apr 2005 14:12:08 -0000	1.31
@@ -1111,7 +1111,7 @@
     else
     {
 	cairo_image_surface_t *image;
-	char		      *ptr;
+	unsigned char	      *ptr;
 	int		      stride;
 
 	stride = (width + 3) & -4;
@@ -1125,7 +1125,7 @@
 	memset (data, 0, stride * height);
 
 	/* using negative stride */
-	ptr = (char *) data + stride * (height - 1);
+	ptr = (unsigned char *) data + stride * (height - 1);
 	
 	image = (cairo_image_surface_t *)
 	    cairo_image_surface_create_for_data (ptr,

Index: cairo-gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- cairo-gstate.c	8 Apr 2005 20:14:17 -0000	1.108
+++ cairo-gstate.c	12 Apr 2005 14:12:08 -0000	1.109
@@ -2016,6 +2016,8 @@
     cairo_surface_pattern_t pattern;
     cairo_box_t pattern_extents;
     cairo_rectangle_t extents;
+    double origin_x, origin_y;
+    int src_x, src_y;
         
     cairo_surface_get_matrix (surface, &image_to_user);
     cairo_matrix_invert (&image_to_user);
@@ -2058,6 +2060,17 @@
     pattern_extents.p2.y = _cairo_fixed_from_double (backend_y + backend_height);
     _cairo_box_round_to_rectangle (&pattern_extents, &extents);
 
+    /* XXX: This offset here isn't very clean, and it isn't even doing
+     * a perfect job, (there are some rounding issues with
+     * cairo_show_surface under the influence of cairo_scale). But it
+     * does address the bug demonstrated in test/translate-show-surface.
+     * And, this whole cairo_show_surface thing is going to be
+     * disappearing soon anyway. */
+    origin_x = origin_y = 0.0;
+    _cairo_gstate_user_to_device (gstate, &origin_x, &origin_y);
+    src_x = (int) (origin_x + 0.5);
+    src_y = (int) (origin_y + 0.5);
+
     if (gstate->clip.surface)
     {
 	_cairo_rectangle_intersect (&extents, &gstate->clip.rect);
@@ -2073,7 +2086,7 @@
 					       &pattern.base, 
 					       &clip_pattern.base,
 					       gstate->surface,
-					       0, 0,
+					       src_x, src_y,
 					       0, 0,
 					       extents.x, extents.y,
 					       extents.width, extents.height);
@@ -2094,7 +2107,7 @@
 					   &pattern.base, 
 					   NULL,
 					   gstate->surface,
-					   0, 0,
+					   src_x, src_y,
 					   0, 0,
 					   extents.x, extents.y,
 					   extents.width, extents.height);




More information about the cairo-commit mailing list