From: Søren Sandmann Pedersen <s...@redhat.com>

The separate get_scanline_32() functions in solid, linear, radial and
conical images are no longer necessary because all access to these
images now go through iterators.
---
 pixman/pixman-conical-gradient.c |   25 +++++++------------
 pixman/pixman-linear-gradient.c  |   31 +++++++----------------
 pixman/pixman-radial-gradient.c  |   24 ++++++------------
 pixman/pixman-solid-fill.c       |   49 +++++++++----------------------------
 4 files changed, 39 insertions(+), 90 deletions(-)

diff --git a/pixman/pixman-conical-gradient.c b/pixman/pixman-conical-gradient.c
index d43b454..9d7d2e8 100644
--- a/pixman/pixman-conical-gradient.c
+++ b/pixman/pixman-conical-gradient.c
@@ -50,14 +50,15 @@ coordinates_to_parameter (double x, double y, double angle)
                                      */
 }
 
-static void
-conical_gradient_get_scanline_32 (pixman_image_t *image,
-                                  int             x,
-                                  int             y,
-                                  int             width,
-                                  uint32_t *      buffer,
-                                  const uint32_t *mask)
+static uint32_t *
+conical_get_scanline_narrow (pixman_iter_t *iter, const uint32_t *mask)
 {
+    pixman_image_t *image = iter->image;
+    int x = iter->x;
+    int y = iter->y;
+    int width = iter->width;
+    uint32_t *buffer = iter->buffer;
+
     gradient_t *gradient = (gradient_t *)image;
     conical_gradient_t *conical = (conical_gradient_t *)image;
     uint32_t       *end = buffer + width;
@@ -82,7 +83,7 @@ conical_gradient_get_scanline_32 (pixman_image_t *image,
        v.vector[2] = pixman_fixed_1;
 
        if (!pixman_transform_point_3d (image->common.transform, &v))
-           return;
+           return iter->buffer;
 
        cx = image->common.transform->matrix[0][0] / 65536.;
        cy = image->common.transform->matrix[1][0] / 65536.;
@@ -154,14 +155,6 @@ conical_gradient_get_scanline_32 (pixman_image_t *image,
            rz += cz;
        }
     }
-}
-
-static uint32_t *
-conical_get_scanline_narrow (pixman_iter_t *iter, const uint32_t *mask)
-{
-    conical_gradient_get_scanline_32 (iter->image, iter->x, iter->y,
-                                     iter->width, iter->buffer,
-                                     mask);
 
     iter->y++;
     return iter->buffer;
diff --git a/pixman/pixman-linear-gradient.c b/pixman/pixman-linear-gradient.c
index a4f18fd..3a6e7e0 100644
--- a/pixman/pixman-linear-gradient.c
+++ b/pixman/pixman-linear-gradient.c
@@ -91,14 +91,16 @@ linear_gradient_classify (pixman_image_t *image,
     return class;
 }
 
-static void
-linear_gradient_get_scanline_32 (pixman_image_t *image,
-                                 int             x,
-                                 int             y,
-                                 int             width,
-                                 uint32_t *      buffer,
-                                 const uint32_t *mask)
+static uint32_t *
+linear_gradient_get_scanline_narrow (pixman_iter_t  *iter,
+                                    const uint32_t *mask)
 {
+    pixman_image_t *image  = iter->image;
+    int             x      = iter->x;
+    int             y      = iter->y;
+    int             width  = iter->width;
+    uint32_t *      buffer = iter->buffer;
+
     pixman_vector_t v, unit;
     pixman_fixed_32_32_t l;
     pixman_fixed_48_16_t dx, dy;
@@ -117,7 +119,7 @@ linear_gradient_get_scanline_32 (pixman_image_t *image,
     if (image->common.transform)
     {
        if (!pixman_transform_point_3d (image->common.transform, &v))
-           return;
+           return iter->buffer;
 
        unit.vector[0] = image->common.transform->matrix[0][0];
        unit.vector[1] = image->common.transform->matrix[1][0];
@@ -217,19 +219,6 @@ linear_gradient_get_scanline_32 (pixman_image_t *image,
            v.vector[2] += unit.vector[2];
        }
     }
-}
-
-static uint32_t *
-linear_gradient_get_scanline_narrow (pixman_iter_t  *iter,
-                                    const uint32_t *mask)
-{
-    pixman_image_t *image  = iter->image;
-    int             x      = iter->x;
-    int             y      = iter->y;
-    int             width  = iter->width;
-    uint32_t *      buffer = iter->buffer;
-
-    linear_gradient_get_scanline_32 (image, x, y, width, buffer, mask);
 
     iter->y++;
 
diff --git a/pixman/pixman-radial-gradient.c b/pixman/pixman-radial-gradient.c
index 6e2d016..2f3e2e6 100644
--- a/pixman/pixman-radial-gradient.c
+++ b/pixman/pixman-radial-gradient.c
@@ -128,13 +128,8 @@ radial_compute_color (double                    a,
     return 0;
 }
 
-static void
-radial_gradient_get_scanline_32 (pixman_image_t *image,
-                                 int             x,
-                                 int             y,
-                                 int             width,
-                                 uint32_t *      buffer,
-                                 const uint32_t *mask)
+static uint32_t *
+radial_get_scanline_narrow (pixman_iter_t *iter, const uint32_t *mask)
 {
     /*
      * Implementation of radial gradients following the PDF specification.
@@ -217,6 +212,11 @@ radial_gradient_get_scanline_32 (pixman_image_t *image,
      *   <=> for every p, the radiuses associated with the two t solutions
      *       have opposite sign
      */
+    pixman_image_t *image = iter->image;
+    int x = iter->x;
+    int y = iter->y;
+    int width = iter->width;
+    uint32_t *buffer = iter->buffer;
 
     gradient_t *gradient = (gradient_t *)image;
     radial_gradient_t *radial = (radial_gradient_t *)image;
@@ -234,7 +234,7 @@ radial_gradient_get_scanline_32 (pixman_image_t *image,
     if (image->common.transform)
     {
        if (!pixman_transform_point_3d (image->common.transform, &v))
-           return;
+           return iter->buffer;
        
        unit.vector[0] = image->common.transform->matrix[0][0];
        unit.vector[1] = image->common.transform->matrix[1][0];
@@ -368,14 +368,6 @@ radial_gradient_get_scanline_32 (pixman_image_t *image,
            v.vector[2] += unit.vector[2];
        }
     }
-}
-
-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);
 
     iter->y++;
     return iter->buffer;
diff --git a/pixman/pixman-solid-fill.c b/pixman/pixman-solid-fill.c
index 2531dbd..a431d74 100644
--- a/pixman/pixman-solid-fill.c
+++ b/pixman/pixman-solid-fill.c
@@ -26,39 +26,6 @@
 #endif
 #include "pixman-private.h"
 
-static void
-solid_fill_get_scanline_32 (pixman_image_t *image,
-                            int             x,
-                            int             y,
-                            int             width,
-                            uint32_t *      buffer,
-                            const uint32_t *mask)
-{
-    uint32_t *end = buffer + width;
-    uint32_t color = image->solid.color_32;
-
-    while (buffer < end)
-       *(buffer++) = color;
-
-    return;
-}
-
-static void
-solid_fill_get_scanline_64 (pixman_image_t *image,
-                           int             x,
-                           int             y,
-                           int             width,
-                           uint32_t *      buffer,
-                           const uint32_t *mask)
-{
-    uint64_t *b = (uint64_t *)buffer;
-    uint64_t *e = b + width;
-    uint64_t color = image->solid.color_64;
-
-    while (b < e)
-       *(b++) = color;
-}
-
 static source_image_class_t
 solid_fill_classify (pixman_image_t *image,
                      int             x,
@@ -77,13 +44,21 @@ _pixman_solid_fill_iter_init (pixman_image_t *image,
 {
     if (flags & ITER_NARROW)
     {
-       solid_fill_get_scanline_32 (
-           image, x, y, width, (uint32_t *)buffer, NULL);
+       uint32_t *b = (uint32_t *)buffer;
+       uint32_t *e = b + width;
+       uint32_t color = image->solid.color_32;
+
+       while (b < e)
+           *(b++) = color;
     }
     else
     {
-       solid_fill_get_scanline_64 (
-           image, x, y, width, (uint32_t *)buffer, NULL);
+       uint64_t *b = (uint64_t *)buffer;
+       uint64_t *e = b + width;
+       uint64_t color = image->solid.color_64;
+
+       while (b < e)
+           *(b++) = color;
     }
 
     iter->get_scanline = _pixman_iter_get_scanline_noop;
-- 
1.6.0.6

_______________________________________________
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman

Reply via email to