diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2013-05-22 09:01:36 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2013-05-22 09:43:21 -0400 |
commit | 2acfac5f8e097ee2ae225d986f981b55d65dd152 (patch) | |
tree | 7f7bb14d59fe68cc0ef8b3c1d5465eb850fd660c | |
parent | 533f54430a73199020ce49208d50f448c871a481 (diff) |
Consolidate all the iter_init_bits_stride functionsiter-initializers
The SSE2, MMX, and fast implementations all have a copy of the
function iter_init_bits_stride that computes an image buffer and
stride.
Move that function to pixman-utils.c and share it among all the
implementations.
-rw-r--r-- | pixman/pixman-fast-path.c | 19 | ||||
-rw-r--r-- | pixman/pixman-mmx.c | 17 | ||||
-rw-r--r-- | pixman/pixman-private.h | 3 | ||||
-rw-r--r-- | pixman/pixman-sse2.c | 17 | ||||
-rw-r--r-- | pixman/pixman-utils.c | 11 |
5 files changed, 25 insertions, 42 deletions
diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c index 9af26af6..3982dce8 100644 --- a/pixman/pixman-fast-path.c +++ b/pixman/pixman-fast-path.c @@ -2261,17 +2261,6 @@ fast_write_back_r5g6b5 (pixman_iter_t *iter) } } -static void -iter_init_bits_stride (pixman_iter_t *iter, const pixman_iter_info_t *info) -{ - pixman_image_t *image = iter->image; - uint8_t *b = (uint8_t *)image->bits.bits; - int s = image->bits.rowstride * 4; - - iter->bits = b + s * iter->y + iter->x * PIXMAN_FORMAT_BPP (info->format) / 8; - iter->stride = s; -} - #define IMAGE_FLAGS \ (FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM | \ FAST_PATH_BITS_IMAGE | FAST_PATH_SAMPLES_COVER_CLIP_NEAREST) @@ -2279,15 +2268,17 @@ iter_init_bits_stride (pixman_iter_t *iter, const pixman_iter_info_t *info) static const pixman_iter_info_t fast_iters[] = { { PIXMAN_r5g6b5, IMAGE_FLAGS, ITER_NARROW | ITER_SRC, - iter_init_bits_stride, fast_fetch_r5g6b5, NULL }, + _pixman_iter_init_bits_stride, fast_fetch_r5g6b5, NULL }, { PIXMAN_r5g6b5, FAST_PATH_STD_DEST_FLAGS, ITER_NARROW | ITER_DEST, - iter_init_bits_stride, fast_fetch_r5g6b5, fast_write_back_r5g6b5 }, + _pixman_iter_init_bits_stride, + fast_fetch_r5g6b5, fast_write_back_r5g6b5 }, { PIXMAN_r5g6b5, FAST_PATH_STD_DEST_FLAGS, ITER_NARROW | ITER_DEST | ITER_IGNORE_RGB | ITER_IGNORE_ALPHA, - iter_init_bits_stride, fast_dest_fetch_noop, fast_write_back_r5g6b5 }, + _pixman_iter_init_bits_stride, + fast_dest_fetch_noop, fast_write_back_r5g6b5 }, { PIXMAN_null }, }; diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c index 861b856b..c94d282a 100644 --- a/pixman/pixman-mmx.c +++ b/pixman/pixman-mmx.c @@ -3922,17 +3922,6 @@ mmx_fetch_a8 (pixman_iter_t *iter, const uint32_t *mask) return iter->buffer; } -static void -iter_init_bits_stride (pixman_iter_t *iter, const pixman_iter_info_t *info) -{ - pixman_image_t *image = iter->image; - uint8_t *b = (uint8_t *)image->bits.bits; - int s = image->bits.rowstride * 4; - - iter->bits = b + s * iter->y + iter->x * PIXMAN_FORMAT_BPP (info->format) / 8; - iter->stride = s; -} - #define IMAGE_FLAGS \ (FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM | \ FAST_PATH_BITS_IMAGE | FAST_PATH_SAMPLES_COVER_CLIP_NEAREST) @@ -3940,13 +3929,13 @@ iter_init_bits_stride (pixman_iter_t *iter, const pixman_iter_info_t *info) static const pixman_iter_info_t mmx_iters[] = { { PIXMAN_x8r8g8b8, IMAGE_FLAGS, ITER_NARROW, - iter_init_bits_stride, mmx_fetch_x8r8g8b8, NULL + _pixman_iter_init_bits_stride, mmx_fetch_x8r8g8b8, NULL }, { PIXMAN_r5g6b5, IMAGE_FLAGS, ITER_NARROW, - iter_init_bits_stride, mmx_fetch_r5g6b5, NULL + _pixman_iter_init_bits_stride, mmx_fetch_r5g6b5, NULL }, { PIXMAN_a8, IMAGE_FLAGS, ITER_NARROW, - iter_init_bits_stride, mmx_fetch_a8, NULL + _pixman_iter_init_bits_stride, mmx_fetch_a8, NULL }, { PIXMAN_null }, }; diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index aa0a8420..af4a0b6e 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -652,6 +652,9 @@ _pixman_compute_composite_region32 (pixman_region32_t * region, uint32_t * _pixman_iter_get_scanline_noop (pixman_iter_t *iter, const uint32_t *mask); +void +_pixman_iter_init_bits_stride (pixman_iter_t *iter, const pixman_iter_info_t *info); + /* These "formats" all have depth 0, so they * will never clash with any real ones */ diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c index bc834b5b..dde92352 100644 --- a/pixman/pixman-sse2.c +++ b/pixman/pixman-sse2.c @@ -6340,17 +6340,6 @@ sse2_fetch_a8 (pixman_iter_t *iter, const uint32_t *mask) return iter->buffer; } -static void -iter_init_bits_stride (pixman_iter_t *iter, const pixman_iter_info_t *info) -{ - pixman_image_t *image = iter->image; - uint8_t *b = (uint8_t *)image->bits.bits; - int s = image->bits.rowstride * 4; - - iter->bits = b + s * iter->y + iter->x * PIXMAN_FORMAT_BPP (info->format) / 8; - iter->stride = s; -} - #define IMAGE_FLAGS \ (FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM | \ FAST_PATH_BITS_IMAGE | FAST_PATH_SAMPLES_COVER_CLIP_NEAREST) @@ -6358,13 +6347,13 @@ iter_init_bits_stride (pixman_iter_t *iter, const pixman_iter_info_t *info) static const pixman_iter_info_t sse2_iters[] = { { PIXMAN_x8r8g8b8, IMAGE_FLAGS, ITER_NARROW, - iter_init_bits_stride, sse2_fetch_x8r8g8b8, NULL + _pixman_iter_init_bits_stride, sse2_fetch_x8r8g8b8, NULL }, { PIXMAN_r5g6b5, IMAGE_FLAGS, ITER_NARROW, - iter_init_bits_stride, sse2_fetch_r5g6b5, NULL + _pixman_iter_init_bits_stride, sse2_fetch_r5g6b5, NULL }, { PIXMAN_a8, IMAGE_FLAGS, ITER_NARROW, - iter_init_bits_stride, sse2_fetch_a8, NULL + _pixman_iter_init_bits_stride, sse2_fetch_a8, NULL }, { PIXMAN_null }, }; diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c index f31171f6..98723a80 100644 --- a/pixman/pixman-utils.c +++ b/pixman/pixman-utils.c @@ -214,6 +214,17 @@ _pixman_iter_get_scanline_noop (pixman_iter_t *iter, const uint32_t *mask) return iter->buffer; } +void +_pixman_iter_init_bits_stride (pixman_iter_t *iter, const pixman_iter_info_t *info) +{ + pixman_image_t *image = iter->image; + uint8_t *b = (uint8_t *)image->bits.bits; + int s = image->bits.rowstride * 4; + + iter->bits = b + s * iter->y + iter->x * PIXMAN_FORMAT_BPP (info->format) / 8; + iter->stride = s; +} + #define N_TMP_BOXES (16) pixman_bool_t |