aboutsummaryrefslogtreecommitdiff
path: root/pixman/test/fetch-test.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-01-20 11:12:52 +0000
committermarha <marha@users.sourceforge.net>2010-01-20 11:12:52 +0000
commit439cac06f0d4f641e9c7c0dd6ae62c98ebfd8fa9 (patch)
tree793fbb8e2a3630ba56a145f784cbe134800316e7 /pixman/test/fetch-test.c
parent8bbcd844049eb1296ccd25aca75bf3b08f28facb (diff)
parenta9768b035f2c47be0908520474073cc68d225d8a (diff)
downloadvcxsrv-439cac06f0d4f641e9c7c0dd6ae62c98ebfd8fa9.tar.gz
vcxsrv-439cac06f0d4f641e9c7c0dd6ae62c98ebfd8fa9.tar.bz2
vcxsrv-439cac06f0d4f641e9c7c0dd6ae62c98ebfd8fa9.zip
svn merge ^/branches/released .
Diffstat (limited to 'pixman/test/fetch-test.c')
-rw-r--r--pixman/test/fetch-test.c102
1 files changed, 63 insertions, 39 deletions
diff --git a/pixman/test/fetch-test.c b/pixman/test/fetch-test.c
index 6306a4c42..c7b32ff3b 100644
--- a/pixman/test/fetch-test.c
+++ b/pixman/test/fetch-test.c
@@ -6,7 +6,8 @@
#define SIZE 1024
-pixman_indexed_t mono_pallete = {
+static const pixman_indexed_t mono_palette =
+{
.rgba = { 0x00000000, 0x00ffffff },
};
@@ -20,14 +21,15 @@ typedef struct {
pixman_indexed_t *indexed;
} testcase_t;
-testcase_t testcases[] = {
+static const testcase_t testcases[] =
+{
{
.format = PIXMAN_a8r8g8b8,
.width = 2, .height = 2,
.stride = 8,
- .src = { 0x00112233, 0x44556677,
+ .src = { 0x00112233, 0x44556677,
0x8899aabb, 0xccddeeff },
- .dst = { 0x00112233, 0x44556677,
+ .dst = { 0x00112233, 0x44556677,
0x8899aabb, 0xccddeeff },
.indexed = NULL,
},
@@ -36,24 +38,33 @@ testcase_t testcases[] = {
.width = 8, .height = 2,
.stride = 4,
#ifdef WORDS_BIGENDIAN
- .src = { 0xaa000000,
- 0x55000000 },
+ .src =
+ {
+ 0xaa000000,
+ 0x55000000
+ },
#else
- .src = { 0x00000055,
- 0x000000aa },
+ .src =
+ {
+ 0x00000055,
+ 0x000000aa
+ },
#endif
- .dst = { 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000,
- 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff },
- .indexed = &mono_pallete,
+ .dst =
+ {
+ 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000,
+ 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff
+ },
+ .indexed = &mono_palette,
},
#if 0
{
.format = PIXMAN_g8,
.width = 4, .height = 2,
.stride = 4,
- .src = { 0x01234567,
+ .src = { 0x01234567,
0x89abcdef },
- .dst = { 0x00010101, 0x00232323, 0x00454545, 0x00676767,
+ .dst = { 0x00010101, 0x00232323, 0x00454545, 0x00676767,
0x00898989, 0x00ababab, 0x00cdcdcd, 0x00efefef, },
},
#endif
@@ -63,28 +74,33 @@ testcase_t testcases[] = {
.width = 8, .height = 2,
.stride = 8,
#ifdef WORDS_BIGENDIAN
- .src = { 0x00ff00ff, 0x00ff00ff,
- 0xff00ff00, 0xff00ff00,
- 0x80ff8000,
- 0x800080ff
+ .src =
+ {
+ 0x00ff00ff, 0x00ff00ff,
+ 0xff00ff00, 0xff00ff00,
+ 0x80ff8000,
+ 0x800080ff
},
#else
- .src = { 0xff00ff00, 0xff00ff00,
- 0x00ff00ff, 0x00ff00ff,
- 0x0080ff80,
- 0xff800080
- },
+ .src =
+ {
+ 0xff00ff00, 0xff00ff00,
+ 0x00ff00ff, 0x00ff00ff,
+ 0x0080ff80,
+ 0xff800080
+ },
#endif
- .dst = {
- 0xff000000, 0xffffffff, 0xffb80000, 0xffffe113,
- 0xff000000, 0xffffffff, 0xff0023ee, 0xff4affff,
- 0xffffffff, 0xff000000, 0xffffe113, 0xffb80000,
- 0xffffffff, 0xff000000, 0xff4affff, 0xff0023ee,
+ .dst =
+ {
+ 0xff000000, 0xffffffff, 0xffb80000, 0xffffe113,
+ 0xff000000, 0xffffffff, 0xff0023ee, 0xff4affff,
+ 0xffffffff, 0xff000000, 0xffffe113, 0xffb80000,
+ 0xffffffff, 0xff000000, 0xff4affff, 0xff0023ee,
},
},
};
-const int ntestcases = sizeof(testcases)/sizeof(testcases[0]);
+const int n_test_cases = sizeof(testcases)/sizeof(testcases[0]);
static uint32_t
@@ -133,26 +149,29 @@ main (int argc, char **argv)
int i, j, x, y;
int ret = 0;
- for (i = 0; i < ntestcases; ++i) {
- for (j = 0; j < 2; ++j) {
+ for (i = 0; i < n_test_cases; ++i)
+ {
+ for (j = 0; j < 2; ++j)
+ {
src_img = pixman_image_create_bits (testcases[i].format,
- testcases[i].width,
+ testcases[i].width,
testcases[i].height,
testcases[i].src,
testcases[i].stride);
pixman_image_set_indexed(src_img, testcases[i].indexed);
dst_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
- testcases[i].width,
+ testcases[i].width,
testcases[i].height,
dst,
testcases[i].width*4);
- if (j) {
+ if (j)
+ {
pixman_image_set_accessors (src_img, reader, writer);
pixman_image_set_accessors (dst_img, reader, writer);
}
-
+
pixman_image_composite (PIXMAN_OP_SRC, src_img, NULL, dst_img,
0, 0, 0, 0, 0, 0, testcases[i].width, testcases[i].height);
@@ -160,18 +179,23 @@ main (int argc, char **argv)
pixman_image_unref (dst_img);
for (y = 0; y < testcases[i].height; ++y)
- for (x = 0; x < testcases[i].width; ++x) {
- int offset = y*testcases[i].width + x;
- if (dst[offset] != testcases[i].dst[offset]) {
+ {
+ for (x = 0; x < testcases[i].width; ++x)
+ {
+ int offset = y * testcases[i].width + x;
+
+ if (dst[offset] != testcases[i].dst[offset])
+ {
printf ("test %i%c: pixel mismatch at (x=%d,y=%d): %08x expected, %08x obtained\n",
i + 1, 'a' + j,
- x, y,
+ x, y,
testcases[i].dst[offset], dst[offset]);
ret = 1;
}
}
+ }
}
}
-
+
return ret;
}