[Pixman] [PATCH 1/4] bits: Implement PAD support in the simple fetcher
Chris Wilson
chris at chris-wilson.co.uk
Sun Jan 27 06:10:25 PST 2013
SNB i5-2500s: firefox-chalkboard 25.9s -> 19.6s: 1.32x speedup
---
pixman/pixman-bits-image.c | 66 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 65 insertions(+), 1 deletion(-)
diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index 75a39a1..f25d576 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -1266,6 +1266,61 @@ bits_image_fetch_untransformed_repeat_none (bits_image_t *image,
}
static void
+bits_image_fetch_untransformed_repeat_pad (bits_image_t *image,
+ pixman_bool_t wide,
+ int x,
+ int y,
+ int width,
+ uint32_t * buffer)
+{
+ uint32_t w;
+
+ if (y < 0)
+ {
+ y = 0;
+ }
+ else if (y >= image->height)
+ {
+ y = image->height - 1;
+ }
+
+ if (x < 0)
+ {
+ w = MIN (width, -x);
+ if (wide)
+ replicate_pixel_float (image, 0, y, w, buffer);
+ else
+ replicate_pixel_32 (image, 0, y, w, buffer);
+
+ 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 ((pixman_image_t *)image, x, y, w, buffer, NULL);
+ else
+ image->fetch_scanline_32 ((pixman_image_t *)image, x, y, w, buffer, NULL);
+
+ width -= w;
+ buffer += w * (wide? 4 : 1);
+ x += w;
+ }
+
+ if (width)
+ {
+ if (wide)
+ replicate_pixel_float (image, image->width-1, y, width, buffer);
+ else
+ replicate_pixel_32 (image, image->width-1, y, width, buffer);
+ }
+}
+
+static void
bits_image_fetch_untransformed_repeat_normal (bits_image_t *image,
pixman_bool_t wide,
int x,
@@ -1326,6 +1381,11 @@ bits_image_fetch_untransformed_32 (pixman_iter_t * iter,
bits_image_fetch_untransformed_repeat_none (
&image->bits, FALSE, x, y, width, buffer);
}
+ else if (image->common.repeat == PIXMAN_REPEAT_PAD)
+ {
+ bits_image_fetch_untransformed_repeat_pad (
+ &image->bits, FALSE, x, y, width, buffer);
+ }
else
{
bits_image_fetch_untransformed_repeat_normal (
@@ -1351,6 +1411,11 @@ bits_image_fetch_untransformed_float (pixman_iter_t * iter,
bits_image_fetch_untransformed_repeat_none (
&image->bits, TRUE, x, y, width, buffer);
}
+ else if (image->common.repeat == PIXMAN_REPEAT_PAD)
+ {
+ bits_image_fetch_untransformed_repeat_pad (
+ &image->bits, TRUE, x, y, width, buffer);
+ }
else
{
bits_image_fetch_untransformed_repeat_normal (
@@ -1375,7 +1440,6 @@ static const fetcher_info_t fetcher_info[] =
(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
--
1.7.10.4
More information about the Pixman
mailing list