Consolidate the various get_scanline_32() into get_scanline_narrow()
authorSøren Sandmann Pedersen <ssp@redhat.com>
Fri, 10 Dec 2010 19:59:20 +0000 (14:59 -0500)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Tue, 18 Jan 2011 17:42:26 +0000 (12:42 -0500)
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
pixman/pixman-linear-gradient.c
pixman/pixman-radial-gradient.c
pixman/pixman-solid-fill.c

index d43b454..9d7d2e8 100644 (file)
@@ -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;
index 4c0792c..c657243 100644 (file)
@@ -91,14 +91,16 @@ linear_gradient_classify (pixman_image_t *image,
     return class;
 }
 
-static void
-linear_get_scanline_32 (pixman_image_t *image,
-                       int             x,
-                       int             y,
-                       int             width,
-                       uint32_t *      buffer,
-                       const uint32_t *mask)
+static uint32_t *
+linear_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_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_get_scanline_32 (pixman_image_t *image,
            v.vector[2] += unit.vector[2];
        }
     }
-}
-
-static uint32_t *
-linear_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_get_scanline_32 (image, x, y, width, buffer, mask);
 
     iter->y++;
 
index d1017d2..6523b82 100644 (file)
@@ -144,13 +144,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.
@@ -233,6 +228,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;
@@ -250,7 +250,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];
@@ -384,14 +384,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;
index 2531dbd..a431d74 100644 (file)
 #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;