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

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


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

---
 pixman/pixman-general.c         |    5 +++++
 pixman/pixman-private.h         |   11 +++++++++++
 pixman/pixman-radial-gradient.c |   34 ++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index a2697ef..5865143 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -91,6 +91,11 @@ iter_init (pixman_implementation_t *imp,
 	_pixman_linear_gradient_iter_init (
 	    image, iter, x, y, width, height, buffer, flags);
     }
+    else if (image->type == RADIAL)
+    {
+	_pixman_radial_gradient_iter_init (
+	    image, iter, x, y, width, height, buffer, flags);
+    }
     else if (image->type == BITS)
     {
 	_pixman_bits_image_iter_init (
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index d22f242..1c6f041 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -232,6 +232,17 @@ _pixman_linear_gradient_iter_init (pixman_image_t *image,
 				   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_radial_gradient_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_image_get_scanline_generic_64  (pixman_image_t *image,
                                         int             x,
                                         int             y,
diff --git a/pixman/pixman-radial-gradient.c b/pixman/pixman-radial-gradient.c
index b595ba7..9b8c49b 100644
--- a/pixman/pixman-radial-gradient.c
+++ b/pixman/pixman-radial-gradient.c
@@ -377,6 +377,40 @@ radial_gradient_property_changed (pixman_image_t *image)
     image->common.get_scanline_64 = _pixman_image_get_scanline_generic_64;
 }
 
+static uint32_t *
+radial_get_scanline_narrow (pixman_iter_t *iter, const uint32_t *mask)
+{
+    radial_gradient_get_scanline_32 (
+	iter->image, iter->x, iter->y, iter->width,
+	iter->buffer, mask);
+
+    return iter->buffer;
+}
+
+static uint32_t *
+radial_get_scanline_wide (pixman_iter_t *iter, const uint32_t *mask)
+{
+    uint32_t *buffer = radial_get_scanline_narrow (iter, NULL);
+
+    pixman_expand ((uint64_t *)buffer, buffer, PIXMAN_a8r8g8b8, iter->width);
+
+    return buffer;
+}
+
+void
+_pixman_radial_gradient_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)
+	iter->get_scanline = radial_get_scanline_narrow;
+    else
+	iter->get_scanline = radial_get_scanline_wide;
+
+    iter->next_line = _pixman_iter_next_line_regular;
+}
+
 PIXMAN_EXPORT pixman_image_t *
 pixman_image_create_radial_gradient (pixman_point_fixed_t *        inner,
                                      pixman_point_fixed_t *        outer,
-- 
1.6.0.6



More information about the Pixman mailing list