summaryrefslogtreecommitdiff
path: root/lib/pixman/test/blitters-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pixman/test/blitters-test.c')
-rw-r--r--lib/pixman/test/blitters-test.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/lib/pixman/test/blitters-test.c b/lib/pixman/test/blitters-test.c
index a2c6ff4d8..ea03f475d 100644
--- a/lib/pixman/test/blitters-test.c
+++ b/lib/pixman/test/blitters-test.c
@@ -57,6 +57,13 @@ create_random_image (pixman_format_code_t *allowed_formats,
prng_randmemset (buf, stride * height, RANDMEMSET_MORE_00_AND_FF);
}
+ /* test negative stride */
+ if (prng_rand_n (4) == 0)
+ {
+ buf += (stride / 4) * (height - 1);
+ stride = - stride;
+ }
+
img = pixman_image_create_bits (fmt, width, height, buf, stride);
if (PIXMAN_FORMAT_TYPE (fmt) == PIXMAN_TYPE_COLOR)
@@ -89,6 +96,9 @@ free_random_image (uint32_t initcrc,
if (fmt != PIXMAN_null)
crc32 = compute_crc32_for_image (initcrc, img);
+ if (img->bits.rowstride < 0)
+ data += img->bits.rowstride * (img->bits.height - 1);
+
pixman_image_unref (img);
free (data);
@@ -222,7 +232,6 @@ static pixman_format_code_t mask_fmt_list[] = {
uint32_t
test_composite (int testnum, int verbose)
{
- int i;
pixman_image_t *src_img = NULL;
pixman_image_t *dst_img = NULL;
pixman_image_t *mask_img = NULL;
@@ -235,7 +244,7 @@ test_composite (int testnum, int verbose)
int w, h;
pixman_op_t op;
pixman_format_code_t src_fmt, dst_fmt, mask_fmt;
- uint32_t *dstbuf, *srcbuf, *maskbuf;
+ uint32_t *srcbuf, *maskbuf;
uint32_t crc32;
int max_width, max_height, max_extra_stride;
FLOAT_REGS_CORRUPTION_DETECTOR_START ();
@@ -282,7 +291,6 @@ test_composite (int testnum, int verbose)
dst_height = pixman_image_get_height (dst_img);
dst_stride = pixman_image_get_stride (dst_img);
- dstbuf = pixman_image_get_data (dst_img);
srcbuf = pixman_image_get_data (src_img);
src_x = prng_rand_n (src_width);
@@ -355,23 +363,7 @@ test_composite (int testnum, int verbose)
src_x, src_y, mask_x, mask_y, dst_x, dst_y, w, h);
if (verbose)
- {
- int j;
-
- printf ("---\n");
- for (i = 0; i < dst_height; i++)
- {
- for (j = 0; j < dst_stride; j++)
- {
- if (j == (dst_width * PIXMAN_FORMAT_BPP (dst_fmt) + 7) / 8)
- printf ("| ");
-
- printf ("%02X ", *((uint8_t *)dstbuf + i * dst_stride + j));
- }
- printf ("\n");
- }
- printf ("---\n");
- }
+ print_image (dst_img);
free_random_image (0, src_img, PIXMAN_null);
crc32 = free_random_image (0, dst_img, dst_fmt);
@@ -402,6 +394,6 @@ main (int argc, const char *argv[])
}
return fuzzer_test_main("blitters", 2000000,
- 0x0CF3283B,
+ 0xE0A07495,
test_composite, argc, argv);
}