[Pixman] [PATCH 1/2] sse2: if width == stride, convert to linear image
Chris Wilson
chris at chris-wilson.co.uk
Wed May 4 00:22:02 PDT 2011
---
pixman/pixman-sse2.c | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index 533b858..c39930e 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -3345,7 +3345,6 @@ pixman_fill_sse2 (uint32_t *bits,
int height,
uint32_t data)
{
- uint32_t byte_width;
uint8_t *byte_line;
__m128i xmm_def;
@@ -3357,8 +3356,6 @@ pixman_fill_sse2 (uint32_t *bits,
stride = stride * (int) sizeof (uint32_t) / 1;
byte_line = (uint8_t *)(((uint8_t *)bits) + stride * y + x);
- byte_width = width;
- stride *= 1;
b = data & 0xff;
w = (b << 8) | b;
@@ -3368,7 +3365,7 @@ pixman_fill_sse2 (uint32_t *bits,
{
stride = stride * (int) sizeof (uint32_t) / 2;
byte_line = (uint8_t *)(((uint16_t *)bits) + stride * y + x);
- byte_width = 2 * width;
+ width *= 2;
stride *= 2;
data = (data & 0xffff) * 0x00010001;
@@ -3377,7 +3374,7 @@ pixman_fill_sse2 (uint32_t *bits,
{
stride = stride * (int) sizeof (uint32_t) / 4;
byte_line = (uint8_t *)(((uint32_t *)bits) + stride * y + x);
- byte_width = 4 * width;
+ width *= 4;
stride *= 4;
}
else
@@ -3385,14 +3382,18 @@ pixman_fill_sse2 (uint32_t *bits,
return FALSE;
}
+ if (width == stride) {
+ width *= height;
+ height = 1;
+ }
+
xmm_def = create_mask_2x32_128 (data, data);
while (height--)
{
- int w;
+ int w = width;
uint8_t *d = byte_line;
byte_line += stride;
- w = byte_width;
while (w >= 1 && ((unsigned long)d & 1))
{
@@ -4691,7 +4692,6 @@ pixman_blt_sse2 (uint32_t *src_bits,
{
uint8_t * src_bytes;
uint8_t * dst_bytes;
- int byte_width;
if (src_bpp != dst_bpp)
return FALSE;
@@ -4702,7 +4702,7 @@ pixman_blt_sse2 (uint32_t *src_bits,
dst_stride = dst_stride * (int) sizeof (uint32_t) / 2;
src_bytes =(uint8_t *)(((uint16_t *)src_bits) + src_stride * (src_y) + (src_x));
dst_bytes = (uint8_t *)(((uint16_t *)dst_bits) + dst_stride * (dst_y) + (dst_x));
- byte_width = 2 * width;
+ width *= 2;
src_stride *= 2;
dst_stride *= 2;
}
@@ -4712,7 +4712,7 @@ pixman_blt_sse2 (uint32_t *src_bits,
dst_stride = dst_stride * (int) sizeof (uint32_t) / 4;
src_bytes = (uint8_t *)(((uint32_t *)src_bits) + src_stride * (src_y) + (src_x));
dst_bytes = (uint8_t *)(((uint32_t *)dst_bits) + dst_stride * (dst_y) + (dst_x));
- byte_width = 4 * width;
+ width *= 4;
src_stride *= 4;
dst_stride *= 4;
}
@@ -4721,6 +4721,11 @@ pixman_blt_sse2 (uint32_t *src_bits,
return FALSE;
}
+ if (width == src_stride && width == dst_stride) {
+ width *= height;
+ height = 1;
+ }
+
while (height--)
{
int w;
@@ -4728,7 +4733,7 @@ pixman_blt_sse2 (uint32_t *src_bits,
uint8_t *d = dst_bytes;
src_bytes += src_stride;
dst_bytes += dst_stride;
- w = byte_width;
+ w = width;
while (w >= 2 && ((unsigned long)d & 3))
{
--
1.7.4.4
More information about the Pixman
mailing list