diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2011-02-04 02:49:04 -0500 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2011-03-16 10:31:51 -0400 |
commit | 67ae142a33a8ce29ced22bedcece489899eb9e19 (patch) | |
tree | e1eb3e9ffeb8b2ddc68a9ea6ae4d0f9256fc174d | |
parent | 70a923882ca24664344ba91a649e7aa12c3063f7 (diff) |
tiledtiled
Conflicts:
pixman/pixman-fast-path.c
-rw-r--r-- | pixman/pixman-fast-path.c | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c index 92f03087..bb9b9161 100644 --- a/pixman/pixman-fast-path.c +++ b/pixman/pixman-fast-path.c @@ -1408,6 +1408,73 @@ FAST_NEAREST (8888_565_none, 8888, 0565, uint32_t, uint16_t, OVER, NONE) FAST_NEAREST (8888_565_pad, 8888, 0565, uint32_t, uint16_t, OVER, PAD) FAST_NEAREST (8888_565_normal, 8888, 0565, uint32_t, uint16_t, OVER, NORMAL) +static void +fast_composite_src_tiled (pixman_implementation_t *imp, + pixman_op_t op, + pixman_image_t * src_image, + pixman_image_t * mask_image, + pixman_image_t * dst_image, + int32_t src_x, + int32_t src_y, + int32_t mask_x, + int32_t mask_y, + int32_t dest_x, + int32_t dest_y, + int32_t width, + int32_t height) +{ + int bpp = PIXMAN_FORMAT_BPP (dst_image->bits.format) / 8; + int dst_stride, src_stride; + uint8_t *dst; + uint8_t *src; + int src_width, src_height; + + src_stride = src_image->bits.rowstride * 4; + dst_stride = dst_image->bits.rowstride * 4; + + src_width = src_image->bits.width; + src_height = src_image->bits.height; + + dst = (uint8_t *)dst_image->bits.bits + dest_y * dst_stride + dest_x * bpp; + while (height--) + { + int w = width; + uint8_t *d = dst; + int sx = src_x; + int sy = src_y; + + src_y++; + dst += dst_stride; + + while (sy < 0) + sy += src_height; + while (sy >= src_height) + sy -= src_height; + + src = (uint8_t *)src_image->bits.bits + sy * src_stride; + + while (w) + { + uint8_t *s; + int n; + + while (sx < 0) + sx += src_width; + while (sx >= src_width) + sx -= src_width; + + s = src + sx * bpp; + n = MIN (w, src_width - sx); + + memcpy (d, s, n * bpp); + + w -= n; + d += n * bpp; + sx += n; + } + } +} + /* Use more unrolling for src_0565_0565 because it is typically CPU bound */ static force_inline void scaled_nearest_scanline_565_565_SRC (uint16_t * dst, @@ -1953,6 +2020,34 @@ static const pixman_fast_path_t c_fast_paths[] = PIXMAN_STD_FAST_PATH (IN, a8, null, a8, fast_composite_in_8_8), PIXMAN_STD_FAST_PATH (IN, solid, a8, a8, fast_composite_in_n_8_8), +#define TILED_SRC(s,d) \ + { PIXMAN_OP_SRC, \ + PIXMAN_ ## s, \ + FAST_PATH_STANDARD_FLAGS | \ + FAST_PATH_NORMAL_REPEAT | \ + FAST_PATH_ID_TRANSFORM, \ + PIXMAN_null, 0, \ + PIXMAN_ ## d, FAST_PATH_STD_DEST_FLAGS, \ + fast_composite_src_tiled \ + } + + TILED_SRC (a8r8g8b8, x8r8g8b8), + TILED_SRC (a8r8g8b8, a8r8g8b8), + TILED_SRC (x8r8g8b8, x8r8g8b8), + TILED_SRC (a8b8g8r8, x8b8g8r8), + TILED_SRC (a8b8g8r8, a8b8g8r8), + TILED_SRC (x8b8g8r8, x8b8g8r8), + TILED_SRC (b8g8r8a8, b8g8r8x8), + TILED_SRC (b8g8r8a8, b8g8r8a8), + TILED_SRC (b8g8r8x8, b8g8r8x8), + TILED_SRC (r5g6b5, r5g6b5), + TILED_SRC (b5g6r5, b5g6r5), + TILED_SRC (r8g8b8, r8g8b8), + TILED_SRC (b8g8r8, b8g8r8), + TILED_SRC (x1r5g5b5, x1r5g5b5), + TILED_SRC (a1r5g5b5, x1r5g5b5), + TILED_SRC (a8, a8), + SIMPLE_NEAREST_FAST_PATH (SRC, x8r8g8b8, x8r8g8b8, 8888_8888), SIMPLE_NEAREST_FAST_PATH (SRC, a8r8g8b8, x8r8g8b8, 8888_8888), SIMPLE_NEAREST_FAST_PATH (SRC, x8b8g8r8, x8b8g8r8, 8888_8888), |