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

These are special cased fetchers that belong in pixman-fast-path.c
---
 pixman/pixman-bits-image.c |  185 -----------------------------------------
 pixman/pixman-fast-path.c  |  197 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 197 insertions(+), 185 deletions(-)

diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index f9121a3..f674cc1 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -505,181 +505,6 @@ bits_image_fetch_general (pixman_iter_t  *iter,
     return buffer;
 }
 
-static void
-replicate_pixel_32 (bits_image_t *   bits,
-                   int              x,
-                   int              y,
-                   int              width,
-                   uint32_t *       buffer)
-{
-    uint32_t color;
-    uint32_t *end;
-
-    color = bits->fetch_pixel_32 (bits, x, y);
-
-    end = buffer + width;
-    while (buffer < end)
-       *(buffer++) = color;
-}
-
-static void
-replicate_pixel_float (bits_image_t *   bits,
-                      int              x,
-                      int              y,
-                      int              width,
-                      uint32_t *       b)
-{
-    argb_t color;
-    argb_t *buffer = (argb_t *)b;
-    argb_t *end;
-
-    color = bits->fetch_pixel_float (bits, x, y);
-
-    end = buffer + width;
-    while (buffer < end)
-       *(buffer++) = color;
-}
-
-static void
-bits_image_fetch_untransformed_repeat_none (bits_image_t *image,
-                                            pixman_bool_t wide,
-                                            int           x,
-                                            int           y,
-                                            int           width,
-                                            uint32_t *    buffer)
-{
-    uint32_t w;
-
-    if (y < 0 || y >= image->height)
-    {
-       memset (buffer, 0, width * (wide? sizeof (argb_t) : 4));
-       return;
-    }
-
-    if (x < 0)
-    {
-       w = MIN (width, -x);
-
-       memset (buffer, 0, w * (wide ? sizeof (argb_t) : 4));
-
-       width -= w;
-       buffer += w * (wide? 4 : 1);
-       x += w;
-    }
-
-    if (x < image->width)
-    {
-       w = MIN (width, image->width - x);
-
-       if (wide)
-           image->fetch_scanline_float (image, x, y, w, buffer, NULL);
-       else
-           image->fetch_scanline_32 (image, x, y, w, buffer, NULL);
-
-       width -= w;
-       buffer += w * (wide? 4 : 1);
-       x += w;
-    }
-
-    memset (buffer, 0, width * (wide ? sizeof (argb_t) : 4));
-}
-
-static void
-bits_image_fetch_untransformed_repeat_normal (bits_image_t *image,
-                                              pixman_bool_t wide,
-                                              int           x,
-                                              int           y,
-                                              int           width,
-                                              uint32_t *    buffer)
-{
-    uint32_t w;
-
-    while (y < 0)
-       y += image->height;
-
-    while (y >= image->height)
-       y -= image->height;
-
-    if (image->width == 1)
-    {
-       if (wide)
-           replicate_pixel_float (image, 0, y, width, buffer);
-       else
-           replicate_pixel_32 (image, 0, y, width, buffer);
-
-       return;
-    }
-
-    while (width)
-    {
-       while (x < 0)
-           x += image->width;
-       while (x >= image->width)
-           x -= image->width;
-
-       w = MIN (width, image->width - x);
-
-       if (wide)
-           image->fetch_scanline_float (image, x, y, w, buffer, NULL);
-       else
-           image->fetch_scanline_32 (image, x, y, w, buffer, NULL);
-
-       buffer += w * (wide? 4 : 1);
-       x += w;
-       width -= w;
-    }
-}
-
-static uint32_t *
-bits_image_fetch_untransformed_32 (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;
-
-    if (image->common.repeat == PIXMAN_REPEAT_NONE)
-    {
-       bits_image_fetch_untransformed_repeat_none (
-           &image->bits, FALSE, x, y, width, buffer);
-    }
-    else
-    {
-       bits_image_fetch_untransformed_repeat_normal (
-           &image->bits, FALSE, x, y, width, buffer);
-    }
-
-    iter->y++;
-    return buffer;
-}
-
-static uint32_t *
-bits_image_fetch_untransformed_float (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;
-
-    if (image->common.repeat == PIXMAN_REPEAT_NONE)
-    {
-       bits_image_fetch_untransformed_repeat_none (
-           &image->bits, TRUE, x, y, width, buffer);
-    }
-    else
-    {
-       bits_image_fetch_untransformed_repeat_normal (
-           &image->bits, TRUE, x, y, width, buffer);
-    }
-
-    iter->y++;
-    return buffer;
-}
-
 typedef struct
 {
     pixman_format_code_t       format;
@@ -690,16 +515,6 @@ typedef struct
 
 static const fetcher_info_t fetcher_info[] =
 {
-    { PIXMAN_any,
-      (FAST_PATH_NO_ALPHA_MAP                  |
-       FAST_PATH_ID_TRANSFORM                  |
-       FAST_PATH_NO_CONVOLUTION_FILTER         |
-       FAST_PATH_NO_PAD_REPEAT                 |
-       FAST_PATH_NO_REFLECT_REPEAT),
-      bits_image_fetch_untransformed_32,
-      bits_image_fetch_untransformed_float
-    },
-
     /* Affine, no alpha */
     { PIXMAN_any,
       (FAST_PATH_NO_ALPHA_MAP | FAST_PATH_HAS_TRANSFORM | 
FAST_PATH_AFFINE_TRANSFORM),
diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index b06d1b2..309a13e 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -3162,6 +3162,181 @@ MAKE_FETCHERS (none_r5g6b5,      r5g6b5,   
PIXMAN_REPEAT_NONE)
 MAKE_FETCHERS (reflect_r5g6b5,   r5g6b5,   PIXMAN_REPEAT_REFLECT)
 MAKE_FETCHERS (normal_r5g6b5,    r5g6b5,   PIXMAN_REPEAT_NORMAL)
 
+static void
+replicate_pixel_32 (bits_image_t *   bits,
+                   int              x,
+                   int              y,
+                   int              width,
+                   uint32_t *       buffer)
+{
+    uint32_t color;
+    uint32_t *end;
+
+    color = bits->fetch_pixel_32 (bits, x, y);
+
+    end = buffer + width;
+    while (buffer < end)
+       *(buffer++) = color;
+}
+
+static void
+replicate_pixel_float (bits_image_t *   bits,
+                      int              x,
+                      int              y,
+                      int              width,
+                      uint32_t *       b)
+{
+    argb_t color;
+    argb_t *buffer = (argb_t *)b;
+    argb_t *end;
+
+    color = bits->fetch_pixel_float (bits, x, y);
+
+    end = buffer + width;
+    while (buffer < end)
+       *(buffer++) = color;
+}
+
+static void
+bits_image_fetch_untransformed_repeat_none (bits_image_t *image,
+                                            pixman_bool_t wide,
+                                            int           x,
+                                            int           y,
+                                            int           width,
+                                            uint32_t *    buffer)
+{
+    uint32_t w;
+
+    if (y < 0 || y >= image->height)
+    {
+       memset (buffer, 0, width * (wide? sizeof (argb_t) : 4));
+       return;
+    }
+
+    if (x < 0)
+    {
+       w = MIN (width, -x);
+
+       memset (buffer, 0, w * (wide ? sizeof (argb_t) : 4));
+
+       width -= w;
+       buffer += w * (wide? 4 : 1);
+       x += w;
+    }
+
+    if (x < image->width)
+    {
+       w = MIN (width, image->width - x);
+
+       if (wide)
+           image->fetch_scanline_float (image, x, y, w, buffer, NULL);
+       else
+           image->fetch_scanline_32 (image, x, y, w, buffer, NULL);
+
+       width -= w;
+       buffer += w * (wide? 4 : 1);
+       x += w;
+    }
+
+    memset (buffer, 0, width * (wide ? sizeof (argb_t) : 4));
+}
+
+static void
+bits_image_fetch_untransformed_repeat_normal (bits_image_t *image,
+                                              pixman_bool_t wide,
+                                              int           x,
+                                              int           y,
+                                              int           width,
+                                              uint32_t *    buffer)
+{
+    uint32_t w;
+
+    while (y < 0)
+       y += image->height;
+
+    while (y >= image->height)
+       y -= image->height;
+
+    if (image->width == 1)
+    {
+       if (wide)
+           replicate_pixel_float (image, 0, y, width, buffer);
+       else
+           replicate_pixel_32 (image, 0, y, width, buffer);
+
+       return;
+    }
+
+    while (width)
+    {
+       while (x < 0)
+           x += image->width;
+       while (x >= image->width)
+           x -= image->width;
+
+       w = MIN (width, image->width - x);
+
+       if (wide)
+           image->fetch_scanline_float (image, x, y, w, buffer, NULL);
+       else
+           image->fetch_scanline_32 (image, x, y, w, buffer, NULL);
+
+       buffer += w * (wide? 4 : 1);
+       x += w;
+       width -= w;
+    }
+}
+
+static uint32_t *
+bits_image_fetch_untransformed_32 (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;
+
+    if (image->common.repeat == PIXMAN_REPEAT_NONE)
+    {
+       bits_image_fetch_untransformed_repeat_none (
+           &image->bits, FALSE, x, y, width, buffer);
+    }
+    else
+    {
+       bits_image_fetch_untransformed_repeat_normal (
+           &image->bits, FALSE, x, y, width, buffer);
+    }
+
+    iter->y++;
+    return buffer;
+}
+
+static uint32_t *
+bits_image_fetch_untransformed_float (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;
+
+    if (image->common.repeat == PIXMAN_REPEAT_NONE)
+    {
+       bits_image_fetch_untransformed_repeat_none (
+           &image->bits, TRUE, x, y, width, buffer);
+    }
+    else
+    {
+       bits_image_fetch_untransformed_repeat_normal (
+           &image->bits, TRUE, x, y, width, buffer);
+    }
+
+    iter->y++;
+    return buffer;
+}
+
 #define IMAGE_FLAGS                                                    \
     (FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM |               \
      FAST_PATH_BITS_IMAGE | FAST_PATH_SAMPLES_COVER_CLIP_NEAREST)
@@ -3181,6 +3356,28 @@ static const pixman_iter_info_t fast_iters[] =
       _pixman_iter_init_bits_stride,
       fast_dest_fetch_noop, fast_write_back_r5g6b5 },
 
+    { PIXMAN_any,
+      (FAST_PATH_NO_ALPHA_MAP                  |
+       FAST_PATH_ID_TRANSFORM                  |
+       FAST_PATH_NO_CONVOLUTION_FILTER         |
+       FAST_PATH_NO_PAD_REPEAT                 |
+       FAST_PATH_NO_REFLECT_REPEAT             |
+       FAST_PATH_BITS_IMAGE),
+      ITER_NARROW | ITER_SRC,
+      NULL, bits_image_fetch_untransformed_32, NULL,
+    },
+
+    { PIXMAN_any,
+      (FAST_PATH_NO_ALPHA_MAP                  |
+       FAST_PATH_ID_TRANSFORM                  |
+       FAST_PATH_NO_CONVOLUTION_FILTER         |
+       FAST_PATH_NO_PAD_REPEAT                 |
+       FAST_PATH_NO_REFLECT_REPEAT             |
+       FAST_PATH_BITS_IMAGE),
+      ITER_WIDE | ITER_SRC,
+      NULL, bits_image_fetch_untransformed_float, NULL,
+    },
+
     { PIXMAN_a8r8g8b8,
       (FAST_PATH_STANDARD_FLAGS                        |
        FAST_PATH_SCALE_TRANSFORM               |
-- 
1.7.1

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

Reply via email to