[Pixman] [PATCH 5/6] Move NULL iterator into pixman-noop.c

Søren Sandmann Pedersen sandmann at cs.au.dk
Tue May 3 04:42:46 PDT 2011


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

Iterating a NULL image returns NULL for all scanlines. This may as
well be done in the noop iterator.
---
 pixman/pixman-implementation.c |   12 +-----------
 pixman/pixman-noop.c           |   24 ++++++++++++++++--------
 2 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/pixman/pixman-implementation.c b/pixman/pixman-implementation.c
index f1d3f99..2706ceb 100644
--- a/pixman/pixman-implementation.c
+++ b/pixman/pixman-implementation.c
@@ -241,12 +241,6 @@ _pixman_implementation_fill (pixman_implementation_t *imp,
     return (*imp->fill) (imp, bits, stride, bpp, x, y, width, height, xor);
 }
 
-static uint32_t *
-get_scanline_null (pixman_iter_t *iter, const uint32_t *mask)
-{
-    return NULL;
-}
-
 void
 _pixman_implementation_src_iter_init (pixman_implementation_t	*imp,
 				      pixman_iter_t             *iter,
@@ -266,11 +260,7 @@ _pixman_implementation_src_iter_init (pixman_implementation_t	*imp,
     iter->height = height;
     iter->flags = flags;
 
-    if (!image)
-    {
-	iter->get_scanline = get_scanline_null;
-    }
-    else if ((flags & (ITER_IGNORE_ALPHA | ITER_IGNORE_RGB)) ==
+    if ((flags & (ITER_IGNORE_ALPHA | ITER_IGNORE_RGB)) ==
 	     (ITER_IGNORE_ALPHA | ITER_IGNORE_RGB))
     {
 	iter->get_scanline = _pixman_iter_get_scanline_noop;
diff --git a/pixman/pixman-noop.c b/pixman/pixman-noop.c
index 5dc528d..75ecf0b 100644
--- a/pixman/pixman-noop.c
+++ b/pixman/pixman-noop.c
@@ -64,22 +64,30 @@ noop_get_scanline (pixman_iter_t *iter, const uint32_t *mask)
     return result;
 }
 
+static uint32_t *
+get_scanline_null (pixman_iter_t *iter, const uint32_t *mask)
+{
+    return NULL;
+}
+
 static void
 noop_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
 {
     pixman_image_t *image = iter->image;
-    uint32_t iter_flags = iter->flags;
-    uint32_t image_flags = image->common.flags;
 
 #define FLAGS						\
     (FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM)
 
-    if ((iter_flags & ITER_NARROW)					&&
-	(image_flags & FLAGS) == FLAGS					&&
-	iter->x >= 0 && iter->y >= 0					&&
-	iter->x + iter->width <= image->bits.width			&&
-	iter->y + iter->height <= image->bits.height			&&
-	image->common.extended_format_code == PIXMAN_a8r8g8b8)
+    if (!image)
+    {
+	iter->get_scanline = get_scanline_null;
+    }
+    else if ((iter->flags & ITER_NARROW)				&&
+	     (image->common.flags & FLAGS) == FLAGS			&&
+	     iter->x >= 0 && iter->y >= 0				&&
+	     iter->x + iter->width <= image->bits.width			&&
+	     iter->y + iter->height <= image->bits.height		&&
+	     image->common.extended_format_code == PIXMAN_a8r8g8b8)
     {
 	iter->buffer =
 	    image->bits.bits + iter->y * image->bits.rowstride + iter->x;
-- 
1.7.4



More information about the Pixman mailing list