Index: gfx/cairo/libpixman/src/pixman-compose.c
===================================================================
RCS file: /cvsroot/mozilla/gfx/cairo/libpixman/src/pixman-compose.c,v
retrieving revision 1.5
diff -p -u -1 -2 -r1.5 pixman-compose.c
--- gfx/cairo/libpixman/src/pixman-compose.c	2 Aug 2007 06:57:51 -0000	1.5
+++ gfx/cairo/libpixman/src/pixman-compose.c	9 Aug 2007 01:14:46 -0000
@@ -3878,24 +3878,29 @@ static void fbFetchTransformed(bits_imag
 			    } else {
 				x1 = v.vector[0] >> 16;
 				distx = (v.vector[0] >> 8) & 0xff;
 				y1 = v.vector[1] >> 16;
 				disty = (v.vector[1] >> 8) & 0xff;
 			    }
 			    x2 = x1 + 1;
 			    y2 = y1 + 1;
 			    
 			    idistx = 256 - distx;
 			    idisty = 256 - disty;
 			    
+			    x1 = MOD (x1, pict->width);
+			    x2 = MOD (x2, pict->width);
+			    y1 = MOD (y1, pict->height);
+			    y2 = MOD (y2, pict->height);
+
 			    b = bits + (y1)*stride;
 			    x_off = x1;
 			    
 			    x1_out = (x1 < box.x1) | (x1 >= box.x2);
 			    x2_out = (x2 < box.x1) | (x2 >= box.x2);
 			    y1_out = (y1 < box.y1) | (y1 >= box.y2);
 			    y2_out = (y2 < box.y1) | (y2 >= box.y2);
 			    
 			    tl = x1_out|y1_out ? 0 : fetch((pixman_image_t *)pict, b, x_off, indexed);
 			    tr = x2_out|y1_out ? 0 : fetch((pixman_image_t *)pict, b, x_off + 1, indexed);
 			    b += stride;
 			    bl = x1_out|y2_out ? 0 : fetch((pixman_image_t *)pict, b, x_off, indexed);
@@ -3944,24 +3949,29 @@ static void fbFetchTransformed(bits_imag
 			    } else {
 				x1 = v.vector[0] >> 16;
 				distx = (v.vector[0] >> 8) & 0xff;
 				y1 = v.vector[1] >> 16;
 				disty = (v.vector[1] >> 8) & 0xff;
 			    }
 			    x2 = x1 + 1;
 			    y2 = y1 + 1;
 			    
 			    idistx = 256 - distx;
 			    idisty = 256 - disty;
 			    
+			    x1 = MOD (x1, pict->width);
+			    x2 = MOD (x2, pict->width);
+			    y1 = MOD (y1, pict->height);
+			    y2 = MOD (y2, pict->height);
+
 			    b = bits + (y1)*stride;
 			    x_off = x1;
 			    
 			    tl = pixman_region_contains_point(pict->common.src_clip, x1, y1, &box)
 				? fetch((pixman_image_t *)pict, b, x_off, indexed) : 0;
 			    tr = pixman_region_contains_point(pict->common.src_clip, x2, y1, &box)
 				? fetch((pixman_image_t *)pict, b, x_off + 1, indexed) : 0;
 			    b += stride;
 			    bl = pixman_region_contains_point(pict->common.src_clip, x1, y2, &box)
 				? fetch((pixman_image_t *)pict, b, x_off, indexed) : 0;
 			    br = pixman_region_contains_point(pict->common.src_clip, x2, y2, &box)
 				? fetch((pixman_image_t *)pict, b, x_off + 1, indexed) : 0;
