diff options
Diffstat (limited to 'pixman/test/scaling-test.c')
-rw-r--r-- | pixman/test/scaling-test.c | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/pixman/test/scaling-test.c b/pixman/test/scaling-test.c index 44c4f3de4..273612395 100644 --- a/pixman/test/scaling-test.c +++ b/pixman/test/scaling-test.c @@ -20,6 +20,31 @@ /* * Composite operation with pseudorandom images */ + +static pixman_format_code_t +get_format (int bpp) +{ + if (bpp == 4) + { + switch (lcg_rand_n (4)) + { + default: + case 0: + return PIXMAN_a8r8g8b8; + case 1: + return PIXMAN_x8r8g8b8; + case 2: + return PIXMAN_a8b8g8r8; + case 3: + return PIXMAN_x8b8g8r8; + } + } + else + { + return PIXMAN_r5g6b5; + } +} + uint32_t test_composite (int testnum, int verbose) @@ -124,11 +149,8 @@ test_composite (int testnum, for (i = 0; i < dst_stride * dst_height; i++) *((uint8_t *)dstbuf + i) = lcg_rand_n (256); - src_fmt = src_bpp == 4 ? (lcg_rand_n (2) == 0 ? - PIXMAN_a8r8g8b8 : PIXMAN_x8r8g8b8) : PIXMAN_r5g6b5; - - dst_fmt = dst_bpp == 4 ? (lcg_rand_n (2) == 0 ? - PIXMAN_a8r8g8b8 : PIXMAN_x8r8g8b8) : PIXMAN_r5g6b5; + src_fmt = get_format (src_bpp); + dst_fmt = get_format (dst_bpp); src_img = pixman_image_create_bits ( src_fmt, src_width, src_height, srcbuf, src_stride); @@ -322,7 +344,7 @@ test_composite (int testnum, pixman_image_composite (op, src_img, mask_img, dst_img, src_x, src_y, mask_x, mask_y, dst_x, dst_y, w, h); - if (dst_fmt == PIXMAN_x8r8g8b8) + if (dst_fmt == PIXMAN_x8r8g8b8 || dst_fmt == PIXMAN_x8b8g8r8) { /* ignore unused part */ for (i = 0; i < dst_stride * dst_height / 4; i++) @@ -358,11 +380,11 @@ test_composite (int testnum, } #if BILINEAR_INTERPOLATION_BITS == 8 -#define CHECKSUM 0x80DF1CB2 +#define CHECKSUM 0x8D3A7539 #elif BILINEAR_INTERPOLATION_BITS == 7 -#define CHECKSUM 0x2818D5FB +#define CHECKSUM 0x03A23E0C #elif BILINEAR_INTERPOLATION_BITS == 4 -#define CHECKSUM 0x387540A5 +#define CHECKSUM 0xE96D1A5E #else #define CHECKSUM 0x00000000 #endif |