Handle repeat_none/normal for 64 bit fetchers
authorSøren Sandmann Pedersen <sandmann@redhat.com>
Wed, 3 Jun 2009 01:31:58 +0000 (21:31 -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 bbdfa89..a654b46 100644 (file)
@@ -658,77 +658,98 @@ bits_image_fetch_solid_64 (bits_image_t * image,
 }
 
 static void
-bits_image_fetch_untransformed_32 (bits_image_t * image,
-                                  int x, int y, int width,
-                                  uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
+bits_image_fetch_untransformed_repeat_none (bits_image_t *image, pixman_bool_t wide,
+                                           int x, int y, int width,
+                                           uint32_t *buffer)
 {
-    if (image->common.repeat == PIXMAN_REPEAT_NONE)
+    uint32_t w;
+    
+    if (y < 0 || y >= image->height)
     {
-       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);
+       memset (buffer, 0, width * sizeof (uint32_t));
+       return;
+    }
 
-               buffer += w;
-               x += w;
-               width -= w;
-           }
-           
-           memset (buffer, 0, width * sizeof (uint32_t));
-       }
+    if (x < 0)
+    {
+       w = MIN (width, -x);
+       
+       memset (buffer, 0, w * (wide? 8 : 4));
+       
+       width -= w;
+       buffer += w;
+       x += w;
     }
-    else if (image->common.repeat == PIXMAN_REPEAT_NORMAL)
+    
+    if (x < image->width)
     {
-       uint32_t w;
+       w = MIN (width, image->width - x);
        
-       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);
-           
+       if (wide)
+           image->fetch_scanline_raw_64 (image, x, y, w, (uint64_t *)buffer);
+       else
            image->fetch_scanline_raw_32 (image, x, y, w, buffer);
+       
+       buffer += w;
+       x += w;
+       width -= w;
+    }
+    
+    memset (buffer, 0, width * (wide? 8 : 4));
+}
 
-           buffer += w;
-           x += w;
-           width -= w;
-       }
+static void
+bits_image_fetch_untransformed_repeat_normal (bits_image_t *image, pixman_bool_t wide,
+                                             int x, int y, int width,
+                                             uint32_t *buffer)
+{
+    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);
+       
+       if (wide)
+           image->fetch_scanline_raw_64 (image, x, y, w, (uint64_t *)buffer);
+       else
+           image->fetch_scanline_raw_32 (image, x, y, w, buffer);
+       
+       buffer += w;
+       x += w;
+       width -= w;
     }
 }
 
 static void
+bits_image_fetch_untransformed_32 (bits_image_t * image,
+                                  int x, int y, int width,
+                                  uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
+{
+    if (image->common.repeat == PIXMAN_REPEAT_NONE)
+       bits_image_fetch_untransformed_repeat_none (image, FALSE, x, y, width, buffer);
+    else
+       bits_image_fetch_untransformed_repeat_normal (image, FALSE, x, y, width, buffer);
+}
+
+static void
 bits_image_fetch_untransformed_64 (bits_image_t * image,
                                   int x, int y, int width,
                                   uint64_t *buffer, void *unused, uint32_t unused2)
 {
-    image->fetch_scanline_raw_64 (image, x, y, width, buffer);
+    if (image->common.repeat == PIXMAN_REPEAT_NONE)
+       bits_image_fetch_untransformed_repeat_none (image, FALSE, x, y, width, (uint32_t *)buffer);
+    else
+       bits_image_fetch_untransformed_repeat_normal (image, FALSE, x, y, width, (uint32_t *)buffer);
 }
 
 static void