8 static pixman_indexed_t mono_palette =
10 0, { 0x00000000, 0x00ffffff },
15 pixman_format_code_t format;
20 pixman_indexed_t *indexed;
23 static testcase_t testcases[] =
29 { 0x00112233, 0x44556677,
30 0x8899aabb, 0xccddeeff },
31 { 0x00112233, 0x44556677,
32 0x8899aabb, 0xccddeeff },
39 { 0x11223300, 0x55667744,
40 0x99aabb88, 0xddeeffcc },
41 { 0x00112233, 0x44556677,
42 0x8899aabb, 0xccddeeff },
49 #ifdef WORDS_BIGENDIAN
61 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000,
62 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff
73 { 0x00010101, 0x00232323, 0x00454545, 0x00676767,
74 0x00898989, 0x00ababab, 0x00cdcdcd, 0x00efefef, },
77 /* FIXME: make this work on big endian */
82 #ifdef WORDS_BIGENDIAN
84 0x00ff00ff, 0x00ff00ff,
85 0xff00ff00, 0xff00ff00,
91 0xff00ff00, 0xff00ff00,
92 0x00ff00ff, 0x00ff00ff,
98 0xff000000, 0xffffffff, 0xffb80000, 0xffffe113,
99 0xff000000, 0xffffffff, 0xff0023ee, 0xff4affff,
100 0xffffffff, 0xff000000, 0xffffe113, 0xffb80000,
101 0xffffffff, 0xff000000, 0xff4affff, 0xff0023ee,
106 int n_test_cases = ARRAY_LENGTH (testcases);
110 reader (const void *src, int size)
115 return *(uint8_t *)src;
117 return *(uint16_t *)src;
119 return *(uint32_t *)src;
122 return 0; /* silence MSVC */
128 writer (void *src, uint32_t value, int size)
133 *(uint8_t *)src = value;
136 *(uint16_t *)src = value;
139 *(uint32_t *)src = value;
148 main (int argc, char **argv)
151 pixman_image_t *src_img;
152 pixman_image_t *dst_img;
156 for (i = 0; i < n_test_cases; ++i)
158 for (j = 0; j < 2; ++j)
160 src_img = pixman_image_create_bits (testcases[i].format,
164 testcases[i].stride);
165 pixman_image_set_indexed(src_img, testcases[i].indexed);
167 dst_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
171 testcases[i].width*4);
175 pixman_image_set_accessors (src_img, reader, writer);
176 pixman_image_set_accessors (dst_img, reader, writer);
179 pixman_image_composite (PIXMAN_OP_SRC, src_img, NULL, dst_img,
180 0, 0, 0, 0, 0, 0, testcases[i].width, testcases[i].height);
182 pixman_image_unref (src_img);
183 pixman_image_unref (dst_img);
185 for (y = 0; y < testcases[i].height; ++y)
187 for (x = 0; x < testcases[i].width; ++x)
189 int offset = y * testcases[i].width + x;
191 if (dst[offset] != testcases[i].dst[offset])
193 printf ("test %i%c: pixel mismatch at (x=%d,y=%d): %08x expected, %08x obtained\n",
196 testcases[i].dst[offset], dst[offset]);