aboutsummaryrefslogtreecommitdiff
path: root/pixman/test/blitters-test.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-03-20 10:18:44 +0000
committermarha <marha@users.sourceforge.net>2010-03-20 10:18:44 +0000
commit501c558c841fc5bc1a67e6dc8d33c8605276f504 (patch)
treed5236b63a9d3dd1df355e5374366f88b8f7e5452 /pixman/test/blitters-test.c
parent1bee0ef6e6bd055ba9083c1b3863549b8a9093cc (diff)
downloadvcxsrv-501c558c841fc5bc1a67e6dc8d33c8605276f504.tar.gz
vcxsrv-501c558c841fc5bc1a67e6dc8d33c8605276f504.tar.bz2
vcxsrv-501c558c841fc5bc1a67e6dc8d33c8605276f504.zip
Updated to pixman-0.17.12
Diffstat (limited to 'pixman/test/blitters-test.c')
-rw-r--r--pixman/test/blitters-test.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/pixman/test/blitters-test.c b/pixman/test/blitters-test.c
index 0b4b6c98c..5e33031e4 100644
--- a/pixman/test/blitters-test.c
+++ b/pixman/test/blitters-test.c
@@ -27,6 +27,8 @@
#include <config.h>
#include "utils.h"
+static pixman_indexed_t palette;
+
static void *
aligned_malloc (size_t align, size_t size)
{
@@ -58,6 +60,7 @@ create_random_image (pixman_format_code_t *allowed_formats,
while (allowed_formats[n] != -1)
n++;
fmt = allowed_formats[lcg_rand_n (n)];
+
width = lcg_rand_n (max_width) + 1;
height = lcg_rand_n (max_height) + 1;
stride = (width * PIXMAN_FORMAT_BPP (fmt) + 7) / 8 +
@@ -79,6 +82,12 @@ create_random_image (pixman_format_code_t *allowed_formats,
img = pixman_image_create_bits (fmt, width, height, buf, stride);
+ if (PIXMAN_FORMAT_TYPE (fmt) == PIXMAN_TYPE_COLOR ||
+ PIXMAN_FORMAT_TYPE (fmt) == PIXMAN_TYPE_GRAY)
+ {
+ pixman_image_set_indexed (img, &palette);
+ }
+
image_endian_swap (img, PIXMAN_FORMAT_BPP (fmt));
if (used_fmt) *used_fmt = fmt;
@@ -221,7 +230,6 @@ static pixman_format_code_t img_fmt_list[] = {
PIXMAN_b2g3r3,
PIXMAN_a2r2g2b2,
PIXMAN_a2b2g2r2,
-#if 0 /* using these crashes the test */
PIXMAN_c8,
PIXMAN_g8,
PIXMAN_x4c4,
@@ -229,7 +237,6 @@ static pixman_format_code_t img_fmt_list[] = {
PIXMAN_c4,
PIXMAN_g4,
PIXMAN_g1,
-#endif
PIXMAN_x4a4,
PIXMAN_a4,
PIXMAN_r1g2b1,
@@ -418,6 +425,18 @@ test_composite (uint32_t initcrc, int testnum, int verbose)
return crc32;
}
+static void
+initialize_palette (void)
+{
+ int i;
+
+ for (i = 0; i < PIXMAN_MAX_INDEXED; ++i)
+ palette.rgba[i] = lcg_rand ();
+
+ for (i = 0; i < 32768; ++i)
+ palette.ent[i] = lcg_rand() & 0xff;
+}
+
int
main (int argc, char *argv[])
{
@@ -425,6 +444,8 @@ main (int argc, char *argv[])
uint32_t crc = 0;
int verbose = getenv ("VERBOSE") != NULL;
+ initialize_palette();
+
if (argc >= 3)
{
n1 = atoi (argv[1]);
@@ -461,7 +482,7 @@ main (int argc, char *argv[])
/* Predefined value for running with all the fastpath functions
disabled. It needs to be updated every time when changes are
introduced to this program or behavior of pixman changes! */
- if (crc == 0x20CBE02C)
+ if (crc == 0xA058F792)
{
printf ("blitters test passed\n");
}