[Pixman] [PATCH] Make the noop iterator work for solid images

Søren Sandmann sandmann at cs.au.dk
Mon Dec 17 11:13:02 PST 2012


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

The noop iterator is supposedly handling solid images, but currently
it never triggers because a solid image cannot have both an extended
format code of PIXMAN_solid while at the same time having the
FAST_PATH_BITS_IMAGE flag set.

If these two were to be set at the same time, the
fast_composite_tiled_repeat() fast path would trigger for solid images
(because it triggers for PIXMAN_any formats, which includes
PIXMAN_solid), but for solid images we can usually do better than that
fast path.

So this patch changes the noop iterator to no longer require the
FAST_PATH_BITS_IMAGE flag and handle both solid fill images and 1x1
bits images.
---
 pixman/pixman-noop.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/pixman/pixman-noop.c b/pixman/pixman-noop.c
index 850caa1..adaa0c7 100644
--- a/pixman/pixman-noop.c
+++ b/pixman/pixman-noop.c
@@ -77,25 +77,32 @@ 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		&&
-	     ((iter->image_flags & (FAST_PATH_BITS_IMAGE | FAST_PATH_NO_ALPHA_MAP)) ==
-	      (FAST_PATH_BITS_IMAGE | FAST_PATH_NO_ALPHA_MAP)))
+	     (iter->image_flags & FAST_PATH_NO_ALPHA_MAP))
     {
-	bits_image_t *bits = &image->bits;
-
 	if (iter->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;
+	    uint32_t color;
+
+	    if (image->type == SOLID)
+		color = image->solid.color_32;
+	    else
+		color = image->bits.fetch_pixel_32 (&image->bits, 0, 0);
 
 	    while (buffer < end)
 		*(buffer++) = color;
 	}
 	else
 	{
-	    argb_t color = bits->fetch_pixel_float (bits, 0, 0);
 	    argb_t *buffer = (argb_t *)iter->buffer;
 	    argb_t *end = buffer + iter->width;
+	    argb_t color;
+
+	    if (image->type == SOLID)
+		color = image->solid.color_float;
+	    else
+		color = image->bits.fetch_pixel_float (&image->bits, 0, 0);
 
 	    while (buffer < end)
 		*(buffer++) = color;
-- 
1.7.4



More information about the Pixman mailing list