Move fetching for solid bits images to pixman-noop.c
authorSøren Sandmann Pedersen <ssp@redhat.com>
Sun, 26 Feb 2012 22:35:20 +0000 (17:35 -0500)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Fri, 2 Mar 2012 04:49:50 +0000 (23:49 -0500)
This should be a bit faster because it can reuse the scanline on each iteration.

pixman/pixman-bits-image.c
pixman/pixman-noop.c

index 2f56de3..d105d2f 100644 (file)
@@ -970,28 +970,6 @@ replicate_pixel_64 (bits_image_t *   bits,
 }
 
 static void
-bits_image_fetch_solid_32 (pixman_image_t * image,
-                           int              x,
-                           int              y,
-                           int              width,
-                           uint32_t *       buffer,
-                           const uint32_t * mask)
-{
-    replicate_pixel_32 (&image->bits, 0, 0, width, buffer);
-}
-
-static void
-bits_image_fetch_solid_64 (pixman_image_t * image,
-                           int              x,
-                           int              y,
-                           int              width,
-                           uint32_t *       b,
-                           const uint32_t * unused)
-{
-    replicate_pixel_64 (&image->bits, 0, 0, width, b);
-}
-
-static void
 bits_image_fetch_untransformed_repeat_none (bits_image_t *image,
                                             pixman_bool_t wide,
                                             int           x,
@@ -1131,12 +1109,6 @@ typedef struct
 
 static const fetcher_info_t fetcher_info[] =
 {
-    { PIXMAN_solid,
-      FAST_PATH_NO_ALPHA_MAP,
-      bits_image_fetch_solid_32,
-      bits_image_fetch_solid_64
-    },
-
     { PIXMAN_any,
       (FAST_PATH_NO_ALPHA_MAP                  |
        FAST_PATH_ID_TRANSFORM                  |
index f4012d8..d835de6 100644 (file)
@@ -76,6 +76,33 @@ noop_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
     {
        iter->get_scanline = _pixman_iter_get_scanline_noop;
     }
+    else if (image->common.extended_format_code == PIXMAN_solid                &&
+            ((image->common.flags & (FAST_PATH_BITS_IMAGE | FAST_PATH_NO_ALPHA_MAP)) ==
+             (FAST_PATH_BITS_IMAGE | FAST_PATH_NO_ALPHA_MAP)))
+    {
+       bits_image_t *bits = &image->bits;
+
+       if (iter->flags & ITER_NARROW)
+       {
+           uint32_t color = bits->fetch_pixel_32 (bits, 0, 0);
+           uint32_t *buffer = iter->buffer;
+           uint32_t *end = buffer + iter->width;
+
+           while (buffer < end)
+               *(buffer++) = color;
+       }
+       else
+       {
+           uint64_t color = bits->fetch_pixel_64 (bits, 0, 0);
+           uint64_t *buffer = (uint64_t *)iter->buffer;
+           uint64_t *end = buffer + iter->width;
+
+           while (buffer < end)
+               *(buffer++) = color;
+       }
+
+       iter->get_scanline = _pixman_iter_get_scanline_noop;
+    }
     else if (image->common.extended_format_code == PIXMAN_a8r8g8b8     &&
             (iter->flags & ITER_NARROW)                                &&
             (image->common.flags & FLAGS) == FLAGS                     &&