9 static pixman_indexed_t mono_palette =
11 0, { 0x00000000, 0x00ffffff },
16 pixman_format_code_t format;
21 pixman_indexed_t *indexed;
24 static testcase_t testcases[] =
30 { 0x00112233, 0x44556677,
31 0x8899aabb, 0xccddeeff },
32 { 0x00112233, 0x44556677,
33 0x8899aabb, 0xccddeeff },
40 { 0x11223300, 0x55667744,
41 0x99aabb88, 0xddeeffcc },
42 { 0x00112233, 0x44556677,
43 0x8899aabb, 0xccddeeff },
50 #ifdef WORDS_BIGENDIAN
62 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000,
63 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff
74 { 0x00010101, 0x00232323, 0x00454545, 0x00676767,
75 0x00898989, 0x00ababab, 0x00cdcdcd, 0x00efefef, },
78 /* FIXME: make this work on big endian */
83 #ifdef WORDS_BIGENDIAN
85 0x00ff00ff, 0x00ff00ff,
86 0xff00ff00, 0xff00ff00,
92 0xff00ff00, 0xff00ff00,
93 0x00ff00ff, 0x00ff00ff,
99 0xff000000, 0xffffffff, 0xffb80000, 0xffffe113,
100 0xff000000, 0xffffffff, 0xff0023ee, 0xff4affff,
101 0xffffffff, 0xff000000, 0xffffe113, 0xffb80000,
102 0xffffffff, 0xff000000, 0xff4affff, 0xff0023ee,
107 int n_test_cases = sizeof(testcases)/sizeof(testcases[0]);
111 reader (const void *src, int size)
116 return *(uint8_t *)src;
118 return *(uint16_t *)src;
120 return *(uint32_t *)src;
123 return 0; /* silence MSVC */
129 writer (void *src, uint32_t value, int size)
134 *(uint8_t *)src = value;
137 *(uint16_t *)src = value;
140 *(uint32_t *)src = value;
149 main (int argc, char **argv)
152 pixman_image_t *src_img;
153 pixman_image_t *dst_img;
157 for (i = 0; i < n_test_cases; ++i)
159 for (j = 0; j < 2; ++j)
161 src_img = pixman_image_create_bits (testcases[i].format,
165 testcases[i].stride);
166 pixman_image_set_indexed(src_img, testcases[i].indexed);
168 dst_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
172 testcases[i].width*4);
176 pixman_image_set_accessors (src_img, reader, writer);
177 pixman_image_set_accessors (dst_img, reader, writer);
180 pixman_image_composite (PIXMAN_OP_SRC, src_img, NULL, dst_img,
181 0, 0, 0, 0, 0, 0, testcases[i].width, testcases[i].height);
183 pixman_image_unref (src_img);
184 pixman_image_unref (dst_img);
186 for (y = 0; y < testcases[i].height; ++y)
188 for (x = 0; x < testcases[i].width; ++x)
190 int offset = y * testcases[i].width + x;
192 if (dst[offset] != testcases[i].dst[offset])
194 printf ("test %i%c: pixel mismatch at (x=%d,y=%d): %08x expected, %08x obtained\n",
197 testcases[i].dst[offset], dst[offset]);