12 static pixman_indexed_t mono_palette =
14 0, { 0x00000000, 0x00ffffff },
19 pixman_format_code_t format;
24 pixman_indexed_t *indexed;
27 static testcase_t testcases[] =
33 { 0x00112233, 0x44556677,
34 0x8899aabb, 0xccddeeff },
35 { 0x00112233, 0x44556677,
36 0x8899aabb, 0xccddeeff },
43 { 0x11223300, 0x55667744,
44 0x99aabb88, 0xddeeffcc },
45 { 0x00112233, 0x44556677,
46 0x8899aabb, 0xccddeeff },
53 #ifdef WORDS_BIGENDIAN
65 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000,
66 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff
77 { 0x00010101, 0x00232323, 0x00454545, 0x00676767,
78 0x00898989, 0x00ababab, 0x00cdcdcd, 0x00efefef, },
81 /* FIXME: make this work on big endian */
86 #ifdef WORDS_BIGENDIAN
88 0x00ff00ff, 0x00ff00ff,
89 0xff00ff00, 0xff00ff00,
95 0xff00ff00, 0xff00ff00,
96 0x00ff00ff, 0x00ff00ff,
102 0xff000000, 0xffffffff, 0xffb80000, 0xffffe113,
103 0xff000000, 0xffffffff, 0xff0023ee, 0xff4affff,
104 0xffffffff, 0xff000000, 0xffffe113, 0xffb80000,
105 0xffffffff, 0xff000000, 0xff4affff, 0xff0023ee,
110 int n_test_cases = sizeof(testcases)/sizeof(testcases[0]);
114 reader (const void *src, int size)
119 return *(uint8_t *)src;
121 return *(uint16_t *)src;
123 return *(uint32_t *)src;
126 return 0; /* silence MSVC */
132 writer (void *src, uint32_t value, int size)
137 *(uint8_t *)src = value;
140 *(uint16_t *)src = value;
143 *(uint32_t *)src = value;
152 main (int argc, char **argv)
155 pixman_image_t *src_img;
156 pixman_image_t *dst_img;
160 for (i = 0; i < n_test_cases; ++i)
162 for (j = 0; j < 2; ++j)
164 src_img = pixman_image_create_bits (testcases[i].format,
168 testcases[i].stride);
169 pixman_image_set_indexed(src_img, testcases[i].indexed);
171 dst_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
175 testcases[i].width*4);
179 pixman_image_set_accessors (src_img, reader, writer);
180 pixman_image_set_accessors (dst_img, reader, writer);
183 pixman_image_composite (PIXMAN_OP_SRC, src_img, NULL, dst_img,
184 0, 0, 0, 0, 0, 0, testcases[i].width, testcases[i].height);
186 pixman_image_unref (src_img);
187 pixman_image_unref (dst_img);
189 for (y = 0; y < testcases[i].height; ++y)
191 for (x = 0; x < testcases[i].width; ++x)
193 int offset = y * testcases[i].width + x;
195 if (dst[offset] != testcases[i].dst[offset])
197 printf ("test %i%c: pixel mismatch at (x=%d,y=%d): %08x expected, %08x obtained\n",
200 testcases[i].dst[offset], dst[offset]);