aboutsummaryrefslogtreecommitdiff
path: root/pixman/test
diff options
context:
space:
mode:
Diffstat (limited to 'pixman/test')
-rw-r--r--pixman/test/affine-test.c6
-rw-r--r--pixman/test/blitters-test.c4
-rw-r--r--pixman/test/composite-traps-test.c6
-rw-r--r--pixman/test/scaling-test.c6
-rw-r--r--pixman/test/utils.c9
-rw-r--r--pixman/test/utils.h2
6 files changed, 21 insertions, 12 deletions
diff --git a/pixman/test/affine-test.c b/pixman/test/affine-test.c
index 3c224d220..529ea8f63 100644
--- a/pixman/test/affine-test.c
+++ b/pixman/test/affine-test.c
@@ -95,8 +95,8 @@ test_composite (int testnum,
dst_img = pixman_image_create_bits (
dst_fmt, dst_width, dst_height, dstbuf, dst_stride);
- image_endian_swap (src_img, src_bpp * 8);
- image_endian_swap (dst_img, dst_bpp * 8);
+ image_endian_swap (src_img);
+ image_endian_swap (dst_img);
pixman_transform_init_identity (&transform);
@@ -251,7 +251,7 @@ test_composite (int testnum,
dstbuf[i] &= 0xFFFFFF;
}
- image_endian_swap (dst_img, dst_bpp * 8);
+ image_endian_swap (dst_img);
if (verbose)
{
diff --git a/pixman/test/blitters-test.c b/pixman/test/blitters-test.c
index 3b27cd8c1..5a867f23a 100644
--- a/pixman/test/blitters-test.c
+++ b/pixman/test/blitters-test.c
@@ -61,7 +61,7 @@ create_random_image (pixman_format_code_t *allowed_formats,
pixman_image_set_indexed (img, &(y_palette[PIXMAN_FORMAT_BPP (fmt)]));
}
- image_endian_swap (img, PIXMAN_FORMAT_BPP (fmt));
+ image_endian_swap (img);
if (used_fmt) *used_fmt = fmt;
return img;
@@ -101,7 +101,7 @@ free_random_image (uint32_t initcrc,
/* swap endiannes in order to provide identical results on both big
* and litte endian systems
*/
- image_endian_swap (img, PIXMAN_FORMAT_BPP (fmt));
+ image_endian_swap (img);
crc32 = compute_crc32 (initcrc, data, stride * height);
}
diff --git a/pixman/test/composite-traps-test.c b/pixman/test/composite-traps-test.c
index c601d8135..9ea7293ce 100644
--- a/pixman/test/composite-traps-test.c
+++ b/pixman/test/composite-traps-test.c
@@ -139,6 +139,8 @@ test_composite (int testnum,
pixman_image_set_source_clipping (src_img, 1);
pixman_region_fini (&clip);
}
+
+ image_endian_swap (src_img);
}
/* Create destination image */
@@ -157,6 +159,8 @@ test_composite (int testnum,
dst_img = pixman_image_create_bits (
dst_format, dst_width, dst_height, dst_bits, dst_stride);
+
+ image_endian_swap (dst_img);
}
/* Create traps */
@@ -218,7 +222,7 @@ test_composite (int testnum,
dst_bits[i] &= 0xFFFFFF;
}
- image_endian_swap (dst_img, dst_bpp * 8);
+ image_endian_swap (dst_img);
if (verbose)
{
diff --git a/pixman/test/scaling-test.c b/pixman/test/scaling-test.c
index 2a0826a46..f247e1e9a 100644
--- a/pixman/test/scaling-test.c
+++ b/pixman/test/scaling-test.c
@@ -140,8 +140,8 @@ test_composite (int testnum,
dst_img = pixman_image_create_bits (
dst_fmt, dst_width, dst_height, dstbuf, dst_stride);
- image_endian_swap (src_img, src_bpp * 8);
- image_endian_swap (dst_img, dst_bpp * 8);
+ image_endian_swap (src_img);
+ image_endian_swap (dst_img);
if (lcg_rand_n (4) > 0)
{
@@ -330,7 +330,7 @@ test_composite (int testnum,
dstbuf[i] &= 0xFFFFFF;
}
- image_endian_swap (dst_img, dst_bpp * 8);
+ image_endian_swap (dst_img);
if (verbose)
{
diff --git a/pixman/test/utils.c b/pixman/test/utils.c
index a896e5be1..ee68d272c 100644
--- a/pixman/test/utils.c
+++ b/pixman/test/utils.c
@@ -133,11 +133,12 @@ compute_crc32 (uint32_t in_crc32,
/* perform endian conversion of pixel data
*/
void
-image_endian_swap (pixman_image_t *img, int bpp)
+image_endian_swap (pixman_image_t *img)
{
int stride = pixman_image_get_stride (img);
uint32_t *data = pixman_image_get_data (img);
int height = pixman_image_get_height (img);
+ int bpp = PIXMAN_FORMAT_BPP (pixman_image_get_format (img));
int i, j;
/* swap bytes only on big endian systems */
@@ -145,10 +146,13 @@ image_endian_swap (pixman_image_t *img, int bpp)
if (*(volatile uint8_t *)&endian_check_var != 0x12)
return;
+ if (bpp == 8)
+ return;
+
for (i = 0; i < height; i++)
{
uint8_t *line_data = (uint8_t *)data + stride * i;
- /* swap bytes only for 16, 24 and 32 bpp for now */
+
switch (bpp)
{
case 1:
@@ -208,6 +212,7 @@ image_endian_swap (pixman_image_t *img, int bpp)
}
break;
default:
+ assert (FALSE);
break;
}
}
diff --git a/pixman/test/utils.h b/pixman/test/utils.h
index 90a84cd0e..5643c1228 100644
--- a/pixman/test/utils.h
+++ b/pixman/test/utils.h
@@ -60,7 +60,7 @@ compute_crc32 (uint32_t in_crc32,
/* perform endian conversion of pixel data
*/
void
-image_endian_swap (pixman_image_t *img, int bpp);
+image_endian_swap (pixman_image_t *img);
/* Allocate memory that is bounded by protected pages,
* so that out-of-bounds access will cause segfaults