[Pixman] [PATCH 05/18] Add _pixman_solid_fill_iter_init() and call it from pixman-general.c

Søren Sandmann sandmann at cs.au.dk
Wed Jan 5 18:09:43 PST 2011


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

Also move next_line_noop() to pixman-utils.c since it is used in both
pixman-solid-fill.c and pixman-general.c
---
 pixman/pixman-general.c    |   12 ++++++------
 pixman/pixman-private.h    |   12 ++++++++++++
 pixman/pixman-solid-fill.c |   21 +++++++++++++++++++++
 pixman/pixman-utils.c      |   11 +++++++++++
 4 files changed, 50 insertions(+), 6 deletions(-)

diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 7ff2dd2..a2697ef 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -64,11 +64,6 @@ get_scanline_wide (pixman_iter_t *iter, const uint32_t *mask)
 }
 
 static void
-next_line_noop (pixman_iter_t *iter)
-{
-}
-
-static void
 iter_init (pixman_implementation_t *imp,
 	   pixman_iter_t *iter,
 	   pixman_image_t *image,
@@ -84,7 +79,12 @@ iter_init (pixman_implementation_t *imp,
     if (!image)
     {
 	iter->get_scanline = get_scanline_null;
-	iter->next_line = next_line_noop;
+	iter->next_line = _pixman_iter_next_line_noop;
+    }
+    else if (image->type == SOLID)
+    {
+	_pixman_solid_fill_iter_init (
+	    image, iter, x, y, width, height, buffer, flags);
     }
     else if (image->type == LINEAR)
     {
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 0be38ed..d22f242 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -220,6 +220,12 @@ _pixman_bits_image_iter_init (pixman_image_t *image,
 			      int x, int y, int width, int height,
 			      uint8_t *buffer, iter_flags_t flags);
 void
+_pixman_solid_fill_iter_init (pixman_image_t *image,
+			      pixman_iter_t  *iter,
+			      int x, int y, int width, int height,
+			      uint8_t *buffer, iter_flags_t flags);
+
+void
 _pixman_linear_gradient_iter_init (pixman_image_t *image,
 				   pixman_iter_t  *iter,
 				   int x, int y, int width, int height,
@@ -541,6 +547,12 @@ _pixman_choose_implementation (void);
 void
 _pixman_iter_next_line_regular (pixman_iter_t *iter);
 
+void
+_pixman_iter_next_line_noop (pixman_iter_t *iter);
+
+uint32_t *
+_pixman_iter_get_scanline_noop (pixman_iter_t *iter, const uint32_t *mask);
+
 /* These "formats" all have depth 0, so they
  * will never clash with any real ones
  */
diff --git a/pixman/pixman-solid-fill.c b/pixman/pixman-solid-fill.c
index 1d911e9..2f06f58 100644
--- a/pixman/pixman-solid-fill.c
+++ b/pixman/pixman-solid-fill.c
@@ -76,6 +76,27 @@ solid_fill_property_changed (pixman_image_t *image)
     image->common.get_scanline_64 = solid_fill_get_scanline_64;
 }
 
+void
+_pixman_solid_fill_iter_init (pixman_image_t *image,
+			      pixman_iter_t  *iter,
+			      int x, int y, int width, int height,
+			      uint8_t *buffer, iter_flags_t flags)
+{
+    if (flags & ITER_NARROW)
+    {
+	solid_fill_get_scanline_32 (
+	    image, x, y, width, (uint32_t *)buffer, NULL);
+    }
+    else
+    {
+	solid_fill_get_scanline_64 (
+	    image, x, y, width, (uint32_t *)buffer, NULL);
+    }
+
+    iter->get_scanline = _pixman_iter_get_scanline_noop;
+    iter->next_line = _pixman_iter_next_line_noop;
+}
+
 static uint32_t
 color_to_uint32 (const pixman_color_t *color)
 {
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index 630c870..09e4ee0 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -173,6 +173,17 @@ _pixman_iter_next_line_regular (pixman_iter_t *iter)
     iter->y++;
 }
 
+void
+_pixman_iter_next_line_noop (pixman_iter_t *iter)
+{
+}
+
+uint32_t *
+_pixman_iter_get_scanline_noop (pixman_iter_t *iter, const uint32_t *mask)
+{
+    return iter->buffer;
+}
+
 #define N_TMP_BOXES (16)
 
 pixman_bool_t
-- 
1.6.0.6



More information about the Pixman mailing list