[Pixman] [PATCH] Move fetching for solid bits images to pixman-noop.c

Søren Sandmann sandmann at cs.au.dk
Sun Feb 26 15:36:16 PST 2012


From: Søren Sandmann Pedersen <ssp at redhat.com>

This should be a bit faster because it can reuse the scanline on each iteration.
---
 pixman/pixman-bits-image.c |   28 ----------------------------
 pixman/pixman-noop.c       |   27 +++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index 2f56de3..d105d2f 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -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			|
diff --git a/pixman/pixman-noop.c b/pixman/pixman-noop.c
index f4012d8..d835de6 100644
--- a/pixman/pixman-noop.c
+++ b/pixman/pixman-noop.c
@@ -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			&&
-- 
1.6.0.6



More information about the Pixman mailing list