Source scanlines are extended to reduce too frequent scanline
function calls.
---
 pixman/pixman-arm-common.h |  122 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 116 insertions(+), 6 deletions(-)

diff --git a/pixman/pixman-arm-common.h b/pixman/pixman-arm-common.h
index 9e971d0..ff6cdb8 100644
--- a/pixman/pixman-arm-common.h
+++ b/pixman/pixman-arm-common.h
@@ -59,6 +59,8 @@
             (c) += (size);      \
     } while(0)
 
+#define ARM_REPEAT_NORMAL_MIN_WIDTH	    32
+
 #define PIXMAN_ARM_BIND_FAST_PATH_SRC_DST(cputype, name,                \
                                           src_type, src_cnt,            \
                                           dst_type, dst_cnt)            \
@@ -99,10 +101,33 @@ cputype##_composite_##name (pixman_implementation_t *imp,               \
         int32_t     num_pixels;                                         \
         int32_t     x;                                                  \
         dst_type *  dst_start_line;                                     \
+        int32_t     src_width;                                          \
+        int32_t     i, j;                                               \
+        src_type    extended_src[ARM_REPEAT_NORMAL_MIN_WIDTH*2];        \
+        pixman_bool_t need_src_extension;                               \
                                                                         \
         PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type,    \
                                dst_stride, dst_start_line, dst_cnt);    \
                                                                         \
+        if (src_image->bits.width < ARM_REPEAT_NORMAL_MIN_WIDTH)        \
+        {                                                               \
+            x = src_x;                                                  \
+            REPEAT_NORMAL (x, src_image->bits.width);                   \
+            x += width;                                                 \
+            src_width = 0;                                              \
+                                                                        \
+            while (src_width < ARM_REPEAT_NORMAL_MIN_WIDTH &&           \
+                   src_width <= x)                                      \
+                src_width += src_image->bits.width;                     \
+                                                                        \
+            need_src_extension = TRUE;                                  \
+        }                                                               \
+        else                                                            \
+        {                                                               \
+            src_width = src_image->bits.width;                          \
+            need_src_extension = FALSE;                                 \
+        }                                                               \
+                                                                        \
         while (--height >= 0)                                           \
         {                                                               \
             REPEAT_NORMAL (y, src_image->bits.height);                  \
@@ -111,11 +136,24 @@ cputype##_composite_##name (pixman_implementation_t *imp,               \
             PIXMAN_IMAGE_GET_LINE (src_image, 0, y, src_type,           \
                                    src_stride, src_line, src_cnt);      \
             x = src_x;                                                  \
-            REPEAT_NORMAL (x, src_image->bits.width);                   \
+            REPEAT_NORMAL (x, src_width);                               \
+                                                                        \
+            if (need_src_extension)                                     \
+            {                                                           \
+                for (i=0; i<src_width; )                                \
+                {                                                       \
+                    for (j=0; j<src_image->bits.width; j++, i++)        \
+                    {                                                   \
+                        extended_src[i] = src_line[j];                  \
+                    }                                                   \
+                }                                                       \
+                                                                        \
+                src_line = &extended_src[0];                            \
+            }                                                           \
                                                                         \
             while (width_remain > 0)                                    \
             {                                                           \
-                num_pixels = src_image->bits.width - x;                 \
+                num_pixels = src_width - x;                             \
                                                                         \
                 if (num_pixels > width_remain)                          \
                     num_pixels = width_remain;                          \
@@ -256,10 +294,33 @@ cputype##_composite_##name (pixman_implementation_t *imp,               \
         int32_t     num_pixels;                                         \
         int32_t     x;                                                  \
         dst_type    *dst_start_line;                                    \
+        int32_t     src_width;                                          \
+        int32_t     i, j;                                               \
+        src_type    extended_src[ARM_REPEAT_NORMAL_MIN_WIDTH*2];        \
+        pixman_bool_t need_src_extension;                               \
                                                                         \
         PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type,    \
                                dst_stride, dst_start_line, dst_cnt);    \
                                                                         \
+        if (src_image->bits.width < ARM_REPEAT_NORMAL_MIN_WIDTH)        \
+        {                                                               \
+            x = src_x;                                                  \
+            REPEAT_NORMAL (x, src_image->bits.width);                   \
+            x += width;                                                 \
+            src_width = 0;                                              \
+                                                                        \
+            while (src_width < ARM_REPEAT_NORMAL_MIN_WIDTH &&           \
+                   src_width <= x)                                      \
+                src_width += src_image->bits.width;                     \
+                                                                        \
+            need_src_extension = TRUE;                                  \
+        }                                                               \
+        else                                                            \
+        {                                                               \
+            src_width = src_image->bits.width;                          \
+            need_src_extension = FALSE;                                 \
+        }                                                               \
+                                                                        \
         while (--height >= 0)                                           \
         {                                                               \
             REPEAT_NORMAL (y, src_image->bits.height);                  \
@@ -268,11 +329,24 @@ cputype##_composite_##name (pixman_implementation_t *imp,               \
             PIXMAN_IMAGE_GET_LINE (src_image, 0, y, src_type,           \
                                    src_stride, src_line, src_cnt);      \
             x = src_x;                                                  \
-            REPEAT_NORMAL (x, src_image->bits.width);                   \
+            REPEAT_NORMAL (x, src_width);                               \
+                                                                        \
+            if (need_src_extension)                                     \
+            {                                                           \
+                for (i=0; i<src_width; )                                \
+                {                                                       \
+                    for (j=0; j<src_image->bits.width; j++, i++)        \
+                    {                                                   \
+                        extended_src[i] = src_line[j];                  \
+                    }                                                   \
+                }                                                       \
+                                                                        \
+                src_line = &extended_src[0];                            \
+            }                                                           \
                                                                         \
             while (width_remain > 0)                                    \
             {                                                           \
-                num_pixels = src_image->bits.width - x;                 \
+                num_pixels = src_width - x;                             \
                                                                         \
                 if (num_pixels > width_remain)                          \
                     num_pixels = width_remain;                          \
@@ -340,12 +414,35 @@ cputype##_composite_##name (pixman_implementation_t *imp,               \
         int32_t     x;                                                  \
         dst_type    *dst_start_line;                                    \
         mask_type   *mask_start_line;                                   \
+        int32_t     src_width;                                          \
+        int32_t     i, j;                                               \
+        src_type    extended_src[ARM_REPEAT_NORMAL_MIN_WIDTH*2];        \
+        pixman_bool_t need_src_extension;                               \
                                                                         \
         PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, dst_type,    \
                                dst_stride, dst_start_line, dst_cnt);    \
         PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, mask_type,   \
                                mask_stride, mask_start_line, mask_cnt); \
                                                                         \
+        if (src_image->bits.width < ARM_REPEAT_NORMAL_MIN_WIDTH)        \
+        {                                                               \
+            x = src_x;                                                  \
+            REPEAT_NORMAL (x, src_image->bits.width);                   \
+            x += width;                                                 \
+            src_width = 0;                                              \
+                                                                        \
+            while (src_width < ARM_REPEAT_NORMAL_MIN_WIDTH &&           \
+                   src_width <= x)                                      \
+                src_width += src_image->bits.width;                     \
+                                                                        \
+            need_src_extension = TRUE;                                  \
+        }                                                               \
+        else                                                            \
+        {                                                               \
+            src_width = src_image->bits.width;                          \
+            need_src_extension = FALSE;                                 \
+        }                                                               \
+                                                                        \
         while (--height >= 0)                                           \
         {                                                               \
             REPEAT_NORMAL (y, src_image->bits.height);                  \
@@ -355,11 +452,24 @@ cputype##_composite_##name (pixman_implementation_t *imp,               \
             PIXMAN_IMAGE_GET_LINE (src_image, 0, y, src_type,           \
                                    src_stride, src_line, src_cnt);      \
             x = src_x;                                                  \
-            REPEAT_NORMAL (x, src_image->bits.width);                   \
+            REPEAT_NORMAL (x, src_width);                               \
+                                                                        \
+            if (need_src_extension)                                     \
+            {                                                           \
+                for (i=0; i<src_width; )                                \
+                {                                                       \
+                    for (j=0; j<src_image->bits.width; j++, i++)        \
+                    {                                                   \
+                        extended_src[i] = src_line[j];                  \
+                    }                                                   \
+                }                                                       \
+                                                                        \
+                src_line = &extended_src[0];                            \
+            }                                                           \
                                                                         \
             while (width_remain > 0)                                    \
             {                                                           \
-                num_pixels = src_image->bits.width - x;                 \
+                num_pixels = src_width - x;                             \
                                                                         \
                 if (num_pixels > width_remain)                          \
                     num_pixels = width_remain;                          \
_______________________________________________
Pixman mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pixman

Reply via email to