[Pixman] [PATCH 09/18] Use iterators in pixman_image_get_solid().
Søren Sandmann
sandmann at cs.au.dk
Wed Jan 5 18:09:47 PST 2011
From: Søren Sandmann Pedersen <ssp at redhat.com>
This is a step towards getting rid of the
_pixman_image_get_scanline_32/64() functions.
---
pixman/pixman-arm-common.h | 9 ++++++---
pixman/pixman-fast-path.c | 22 +++++++++++-----------
pixman/pixman-image.c | 12 +++++++++---
pixman/pixman-mmx.c | 22 +++++++++++-----------
pixman/pixman-private.h | 9 +++++----
pixman/pixman-sse2.c | 30 +++++++++++++++---------------
6 files changed, 57 insertions(+), 47 deletions(-)
diff --git a/pixman/pixman-arm-common.h b/pixman/pixman-arm-common.h
index 66f448d..372e9f9 100644
--- a/pixman/pixman-arm-common.h
+++ b/pixman/pixman-arm-common.h
@@ -118,7 +118,8 @@ cputype##_composite_##name (pixman_implementation_t *imp, \
int32_t dst_stride; \
uint32_t src; \
\
- src = _pixman_image_get_solid (src_image, dst_image->bits.format); \
+ src = _pixman_image_get_solid ( \
+ imp, src_image, dst_image->bits.format); \
\
if ((flags & SKIP_ZERO_SRC) && src == 0) \
return; \
@@ -164,7 +165,8 @@ cputype##_composite_##name (pixman_implementation_t *imp, \
int32_t dst_stride, mask_stride; \
uint32_t src; \
\
- src = _pixman_image_get_solid (src_image, dst_image->bits.format); \
+ src = _pixman_image_get_solid ( \
+ imp, src_image, dst_image->bits.format); \
\
if ((flags & SKIP_ZERO_SRC) && src == 0) \
return; \
@@ -212,7 +214,8 @@ cputype##_composite_##name (pixman_implementation_t *imp, \
int32_t dst_stride, src_stride; \
uint32_t mask; \
\
- mask = _pixman_image_get_solid (mask_image, dst_image->bits.format);\
+ mask = _pixman_image_get_solid ( \
+ imp, mask_image, dst_image->bits.format); \
\
if ((flags & SKIP_ZERO_MASK) && mask == 0) \
return; \
diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index 37dfbae..1d12330 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -188,7 +188,7 @@ fast_composite_in_n_8_8 (pixman_implementation_t *imp,
int32_t w;
uint16_t t;
- src = _pixman_image_get_solid (src_image, dest_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format);
srca = src >> 24;
@@ -312,7 +312,7 @@ fast_composite_over_n_8_8888 (pixman_implementation_t *imp,
int dst_stride, mask_stride;
int32_t w;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
srca = src >> 24;
if (src == 0)
@@ -370,7 +370,7 @@ fast_composite_add_n_8888_8888_ca (pixman_implementation_t *imp,
int dst_stride, mask_stride;
int32_t w;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
srca = src >> 24;
if (src == 0)
@@ -427,7 +427,7 @@ fast_composite_over_n_8888_8888_ca (pixman_implementation_t *imp,
int dst_stride, mask_stride;
int32_t w;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
srca = src >> 24;
if (src == 0)
@@ -494,7 +494,7 @@ fast_composite_over_n_8_0888 (pixman_implementation_t *imp,
int dst_stride, mask_stride;
int32_t w;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
srca = src >> 24;
if (src == 0)
@@ -559,7 +559,7 @@ fast_composite_over_n_8_0565 (pixman_implementation_t *imp,
int dst_stride, mask_stride;
int32_t w;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
srca = src >> 24;
if (src == 0)
@@ -626,7 +626,7 @@ fast_composite_over_n_8888_0565_ca (pixman_implementation_t *imp,
int dst_stride, mask_stride;
int32_t w;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
srca = src >> 24;
if (src == 0)
@@ -1034,7 +1034,7 @@ fast_composite_add_n_8_8 (pixman_implementation_t *imp,
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1);
PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1);
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
sa = (src >> 24);
while (height--)
@@ -1146,7 +1146,7 @@ fast_composite_over_n_1_8888 (pixman_implementation_t *imp,
if (width <= 0)
return;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
srca = src >> 24;
if (src == 0)
return;
@@ -1240,7 +1240,7 @@ fast_composite_over_n_1_0565 (pixman_implementation_t *imp,
if (width <= 0)
return;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
srca = src >> 24;
if (src == 0)
return;
@@ -1332,7 +1332,7 @@ fast_composite_solid_fill (pixman_implementation_t *imp,
{
uint32_t src;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
if (dst_image->bits.format == PIXMAN_a1)
{
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 28dc066..3e17000 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -795,12 +795,18 @@ pixman_image_get_format (pixman_image_t *image)
}
uint32_t
-_pixman_image_get_solid (pixman_image_t * image,
- pixman_format_code_t format)
+_pixman_image_get_solid (pixman_implementation_t *imp,
+ pixman_image_t * image,
+ pixman_format_code_t format)
{
uint32_t result;
+ pixman_iter_t iter;
- _pixman_image_get_scanline_32 (image, 0, 0, 1, &result, NULL);
+ _pixman_implementation_iter_init (
+ imp, &iter, image, 0, 0, 1, 1,
+ (uint8_t *)&result, ITER_NARROW);
+
+ result = *iter.get_scanline (&iter, NULL);
/* If necessary, convert RGB <--> BGR. */
if (PIXMAN_FORMAT_TYPE (format) != PIXMAN_TYPE_ARGB)
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 34637a4..6daa364 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -1108,7 +1108,7 @@ mmx_composite_over_n_8888 (pixman_implementation_t *imp,
CHECKPOINT ();
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
if (src == 0)
return;
@@ -1187,7 +1187,7 @@ mmx_composite_over_n_0565 (pixman_implementation_t *imp,
CHECKPOINT ();
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
if (src == 0)
return;
@@ -1275,7 +1275,7 @@ mmx_composite_over_n_8888_8888_ca (pixman_implementation_t *imp,
CHECKPOINT ();
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
srca = src >> 24;
if (src == 0)
@@ -1384,7 +1384,7 @@ mmx_composite_over_8888_n_8888 (pixman_implementation_t *imp,
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
- mask = _pixman_image_get_solid (mask_image, dst_image->bits.format);
+ mask = _pixman_image_get_solid (imp, mask_image, dst_image->bits.format);
mask &= 0xff000000;
mask = mask | mask >> 8 | mask >> 16 | mask >> 24;
vmask = load8888 (mask);
@@ -1469,7 +1469,7 @@ mmx_composite_over_x888_n_8888 (pixman_implementation_t *imp,
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1);
PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
- mask = _pixman_image_get_solid (mask_image, dst_image->bits.format);
+ mask = _pixman_image_get_solid (imp, mask_image, dst_image->bits.format);
mask &= 0xff000000;
mask = mask | mask >> 8 | mask >> 16 | mask >> 24;
@@ -1764,7 +1764,7 @@ mmx_composite_over_n_8_8888 (pixman_implementation_t *imp,
CHECKPOINT ();
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
srca = src >> 24;
if (src == 0)
@@ -2038,7 +2038,7 @@ mmx_composite_src_n_8_8888 (pixman_implementation_t *imp,
CHECKPOINT ();
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
srca = src >> 24;
if (src == 0)
@@ -2173,7 +2173,7 @@ mmx_composite_over_n_8_0565 (pixman_implementation_t *imp,
CHECKPOINT ();
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
srca = src >> 24;
if (src == 0)
@@ -2532,7 +2532,7 @@ mmx_composite_over_n_8888_0565_ca (pixman_implementation_t *imp,
CHECKPOINT ();
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
srca = src >> 24;
if (src == 0)
@@ -2643,7 +2643,7 @@ mmx_composite_in_n_8_8 (pixman_implementation_t *imp,
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1);
PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1);
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
sa = src >> 24;
@@ -2790,7 +2790,7 @@ mmx_composite_add_n_8_8 (pixman_implementation_t *imp,
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1);
PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1);
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
sa = src >> 24;
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index c4194fe..0ec57e6 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -295,10 +295,6 @@ _pixman_image_reset_clip_region (pixman_image_t *image);
void
_pixman_image_validate (pixman_image_t *image);
-uint32_t
-_pixman_image_get_solid (pixman_image_t * image,
- pixman_format_code_t format);
-
#define PIXMAN_IMAGE_GET_LINE(image, x, y, type, out_stride, line, mul) \
do \
{ \
@@ -472,6 +468,11 @@ struct pixman_implementation_t
pixman_combine_64_func_t combine_64_ca[PIXMAN_N_OPERATORS];
};
+uint32_t
+_pixman_image_get_solid (pixman_implementation_t *imp,
+ pixman_image_t * image,
+ pixman_format_code_t format);
+
pixman_implementation_t *
_pixman_implementation_create (pixman_implementation_t *delegate,
const pixman_fast_path_t *fast_paths);
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index 032f13b..7582fff 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -2598,7 +2598,7 @@ sse2_composite_over_n_8888 (pixman_implementation_t *imp,
__m128i xmm_src, xmm_alpha;
__m128i xmm_dst, xmm_dst_lo, xmm_dst_hi;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
if (src == 0)
return;
@@ -2681,7 +2681,7 @@ sse2_composite_over_n_0565 (pixman_implementation_t *imp,
__m128i xmm_src, xmm_alpha;
__m128i xmm_dst, xmm_dst0, xmm_dst1, xmm_dst2, xmm_dst3;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
if (src == 0)
return;
@@ -2776,7 +2776,7 @@ sse2_composite_add_n_8888_8888_ca (pixman_implementation_t *imp,
__m64 mmx_src, mmx_alpha, mmx_mask, mmx_dest;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
srca = src >> 24;
if (src == 0)
@@ -2904,7 +2904,7 @@ sse2_composite_over_n_8888_8888_ca (pixman_implementation_t *imp,
__m64 mmx_src, mmx_alpha, mmx_mask, mmx_dest;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
if (src == 0)
return;
@@ -3036,7 +3036,7 @@ sse2_composite_over_8888_n_8888 (pixman_implementation_t *imp,
PIXMAN_IMAGE_GET_LINE (
src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
- mask = _pixman_image_get_solid (mask_image, PIXMAN_a8r8g8b8);
+ mask = _pixman_image_get_solid (imp, mask_image, PIXMAN_a8r8g8b8);
xmm_mask = create_mask_16_128 (mask >> 24);
@@ -3226,7 +3226,7 @@ sse2_composite_over_x888_n_8888 (pixman_implementation_t *imp,
PIXMAN_IMAGE_GET_LINE (
src_image, src_x, src_y, uint32_t, src_stride, src_line, 1);
- mask = _pixman_image_get_solid (mask_image, PIXMAN_a8r8g8b8);
+ mask = _pixman_image_get_solid (imp, mask_image, PIXMAN_a8r8g8b8);
xmm_mask = create_mask_16_128 (mask >> 24);
xmm_alpha = mask_00ff;
@@ -3498,7 +3498,7 @@ sse2_composite_over_n_8_8888 (pixman_implementation_t *imp,
__m64 mmx_src, mmx_alpha, mmx_mask, mmx_dest;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
srca = src >> 24;
if (src == 0)
@@ -3782,7 +3782,7 @@ sse2_composite_src_n_8_8888 (pixman_implementation_t *imp,
__m128i xmm_src, xmm_def;
__m128i xmm_mask, xmm_mask_lo, xmm_mask_hi;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
srca = src >> 24;
if (src == 0)
@@ -3918,7 +3918,7 @@ sse2_composite_over_n_8_0565 (pixman_implementation_t *imp,
__m128i xmm_mask, xmm_mask_lo, xmm_mask_hi;
__m128i xmm_dst, xmm_dst0, xmm_dst1, xmm_dst2, xmm_dst3;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
srca = src >> 24;
if (src == 0)
@@ -4318,7 +4318,7 @@ sse2_composite_over_n_8888_0565_ca (pixman_implementation_t *imp,
__m64 mmx_src, mmx_alpha, mmx_mask, mmx_dest;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
if (src == 0)
return;
@@ -4471,7 +4471,7 @@ sse2_composite_in_n_8_8 (pixman_implementation_t *imp,
PIXMAN_IMAGE_GET_LINE (
mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1);
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
sa = src >> 24;
@@ -4570,7 +4570,7 @@ sse2_composite_in_n_8 (pixman_implementation_t *imp,
PIXMAN_IMAGE_GET_LINE (
dst_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1);
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
xmm_alpha = expand_alpha_1x128 (expand_pixel_32_1x128 (src));
@@ -4758,7 +4758,7 @@ sse2_composite_add_n_8_8 (pixman_implementation_t *imp,
PIXMAN_IMAGE_GET_LINE (
mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1);
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
sa = src >> 24;
@@ -4855,7 +4855,7 @@ sse2_composite_add_n_8 (pixman_implementation_t *imp,
PIXMAN_IMAGE_GET_LINE (
dst_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1);
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
src >>= 24;
@@ -5480,7 +5480,7 @@ sse2_composite_over_reverse_n_8888 (pixman_implementation_t *imp,
int dst_stride;
int32_t w;
- src = _pixman_image_get_solid (src_image, dst_image->bits.format);
+ src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
if (src == 0)
return;
--
1.6.0.6
More information about the Pixman
mailing list