Make the untransformed path handle REPEAT_NONE and REPEAT_NORMAL
authorSøren Sandmann Pedersen <sandmann@redhat.com>
Wed, 3 Jun 2009 01:20:42 +0000 (21:20 -0400)
committerSøren Sandmann Pedersen <sandmann@redhat.com>
Sat, 13 Jun 2009 14:18:17 +0000 (10:18 -0400)
pixman/pixman-bits-image.c

index e9f12d0..bbdfa89 100644 (file)
@@ -662,7 +662,65 @@ bits_image_fetch_untransformed_32 (bits_image_t * image,
                                   int x, int y, int width,
                                   uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
 {
-    image->fetch_scanline_raw_32 (image, x, y, width, buffer);
+    if (image->common.repeat == PIXMAN_REPEAT_NONE)
+    {
+       if (y < 0 || y >= image->height)
+       {
+           memset (buffer, 0, width * sizeof (uint32_t));
+       }
+       else
+       {
+           uint32_t w;
+
+           if (x < 0)
+           {
+               w = MIN (width, -x);
+               
+               memset (buffer, 0, w * sizeof (uint32_t));
+               
+               width -= w;
+               buffer += w;
+               x += w;
+           }
+
+           if (x < image->width)
+           {
+               w = MIN (width, image->width - x);
+               image->fetch_scanline_raw_32 (image, x, y, w, buffer);
+
+               buffer += w;
+               x += w;
+               width -= w;
+           }
+           
+           memset (buffer, 0, width * sizeof (uint32_t));
+       }
+    }
+    else if (image->common.repeat == PIXMAN_REPEAT_NORMAL)
+    {
+       uint32_t w;
+       
+       while (y < 0)
+           y += image->height;
+       while (y >= image->height)
+           y -= image->height;
+
+       while (width)
+       {
+           while (x < 0)
+               x += image->width;
+           while (x >= image->width)
+               x -= image->width;
+
+           w = MIN (width, image->width - x);
+           
+           image->fetch_scanline_raw_32 (image, x, y, w, buffer);
+
+           buffer += w;
+           x += w;
+           width -= w;
+       }
+    }
 }
 
 static void
@@ -694,8 +752,8 @@ bits_image_property_changed (pixman_image_t *image)
     }
     else if (!bits->common.transform &&
             bits->common.filter != PIXMAN_FILTER_CONVOLUTION &&
-            bits->common.repeat != PIXMAN_REPEAT_PAD &&
-            bits->common.repeat != PIXMAN_REPEAT_REFLECT)
+            (bits->common.repeat == PIXMAN_REPEAT_NONE ||
+             bits->common.repeat == PIXMAN_REPEAT_NORMAL))
     {
        image->common.get_scanline_64 = (scanFetchProc)bits_image_fetch_untransformed_64;
        image->common.get_scanline_32 = (scanFetchProc)bits_image_fetch_untransformed_32;