diff options
author | marha <marha@users.sourceforge.net> | 2013-01-07 11:56:06 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-01-07 11:56:06 +0100 |
commit | 3f553aaceddc9b09363c73d9bea40eaea8164fc4 (patch) | |
tree | b112d1ad761f8621106f8930daaf97fafed339fb /pixman/test | |
parent | 293fd0043af7e861c9c540bebc44630d0da0bf9b (diff) | |
download | vcxsrv-3f553aaceddc9b09363c73d9bea40eaea8164fc4.tar.gz vcxsrv-3f553aaceddc9b09363c73d9bea40eaea8164fc4.tar.bz2 vcxsrv-3f553aaceddc9b09363c73d9bea40eaea8164fc4.zip |
pixman xkbcomp libX11 libXau mesa fontconfig xserver xkeyboard-config git update 7 jan 2013
fontconfig: 17eda89ed2e24a3fc5f68538dd7fd9ada8efb087
xserver: bd91b05b631f13afd1f7a9d6cbc4f0c5408b523a
xkeyboard-config: 4779e2745094ebe0c06364b4099d7067ae750d07
libX11: cd25cab4b5b957641183ce72dd1ae0424aff1663
libXau: e04364efccbb3bb4cfc5f4cb491ffa1faaaacbdb
mesa: afec10df373f342f058aab66c622237964a4a147
pixman: 35cc965514ca6e665c18411fcf66db826d559c2a
xkbcomp: e4f767913338052527538d429931e8abd8c3fb88
Diffstat (limited to 'pixman/test')
-rw-r--r-- | pixman/test/lowlevel-blt-bench.c | 1 | ||||
-rw-r--r-- | pixman/test/stress-test.c | 160 |
2 files changed, 136 insertions, 25 deletions
diff --git a/pixman/test/lowlevel-blt-bench.c b/pixman/test/lowlevel-blt-bench.c index 3afa926b0..2f97b7b24 100644 --- a/pixman/test/lowlevel-blt-bench.c +++ b/pixman/test/lowlevel-blt-bench.c @@ -616,6 +616,7 @@ tests_tbl[] = { "src_n_2x10", PIXMAN_a2r10g10b10, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_x2r10g10b10 }, { "src_n_2a10", PIXMAN_a2r10g10b10, 1, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a2r10g10b10 }, { "src_8888_0565", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_r5g6b5 }, + { "src_0565_8888", PIXMAN_r5g6b5, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a8r8g8b8 }, { "src_8888_4444", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a4r4g4b4 }, { "src_8888_2222", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_a2r2g2b2 }, { "src_8888_2x10", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_SRC, PIXMAN_null, 0, PIXMAN_x2r10g10b10 }, diff --git a/pixman/test/stress-test.c b/pixman/test/stress-test.c index ee55c21ea..9d949afad 100644 --- a/pixman/test/stress-test.c +++ b/pixman/test/stress-test.c @@ -205,8 +205,29 @@ rand_y (pixman_image_t *image) return log_rand (); } +static pixman_format_code_t +random_format (pixman_bool_t prefer_alpha) +{ + pixman_format_code_t format; + int n = prng_rand_n (ARRAY_LENGTH (image_formats)); + + if (prefer_alpha && prng_rand_n (4) != 0) + { + do + { + format = image_formats[n++ % ARRAY_LENGTH (image_formats)]; + } while (PIXMAN_FORMAT_TYPE (format) != PIXMAN_TYPE_A); + } + else + { + format = image_formats[n]; + } + + return format; +} + static pixman_image_t * -create_random_bits_image (void) +create_random_bits_image (pixman_bool_t prefer_alpha) { pixman_format_code_t format; pixman_indexed_t *indexed; @@ -220,7 +241,7 @@ create_random_bits_image (void) int n_coefficients = 0; /* format */ - format = image_formats[prng_rand_n (ARRAY_LENGTH (image_formats))]; + format = random_format (prefer_alpha); indexed = NULL; if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_COLOR) @@ -389,7 +410,7 @@ set_general_properties (pixman_image_t *image, pixman_bool_t allow_alpha_map) pixman_image_t *alpha_map; int16_t x, y; - alpha_map = create_random_bits_image (); + alpha_map = create_random_bits_image (FALSE); if (alpha_map) { @@ -695,7 +716,7 @@ create_random_image (void) { default: case 0: - result = create_random_bits_image (); + result = create_random_bits_image (FALSE); break; case 1: @@ -721,6 +742,39 @@ create_random_image (void) return result; } +static void +random_line (pixman_line_fixed_t *line, int width, int height) +{ + line->p1.x = prng_rand_n (width) << 16; + line->p1.y = prng_rand_n (height) << 16; + line->p2.x = prng_rand_n (width) << 16; + line->p2.y = prng_rand_n (height) << 16; +} + +static pixman_trapezoid_t * +create_random_trapezoids (int *n_traps, int height, int width) +{ + pixman_trapezoid_t *trapezoids; + int i; + + *n_traps = prng_rand_n (16) + 1; + + trapezoids = malloc (sizeof (pixman_trapezoid_t) * *n_traps); + + for (i = 0; i < *n_traps; ++i) + { + pixman_trapezoid_t *t = &(trapezoids[i]); + + t->top = prng_rand_n (height) << 16; + t->bottom = prng_rand_n (height) << 16; + + random_line (&t->left, height, width); + random_line (&t->right, height, width); + } + + return trapezoids; +} + static const pixman_op_t op_list[] = { PIXMAN_OP_SRC, @@ -792,31 +846,87 @@ run_test (uint32_t seed, pixman_bool_t verbose, uint32_t mod) if (mod == 0 || (seed % mod) == 0) printf ("Seed 0x%08x\n", seed); } - - prng_srand (seed); - source = create_random_image (); - mask = create_random_image (); - dest = create_random_bits_image (); + source = mask = dest = NULL; + + prng_srand (seed); - if (source && mask && dest) + if (prng_rand_n (8) == 0) { - set_general_properties (dest, TRUE); - - op = op_list [prng_rand_n (ARRAY_LENGTH (op_list))]; - - pixman_image_composite32 (op, - source, mask, dest, - rand_x (source), rand_y (source), - rand_x (mask), rand_y (mask), - 0, 0, - dest->bits.width, - dest->bits.height); + int n_traps; + pixman_trapezoid_t *trapezoids; + + dest = create_random_bits_image (TRUE); + + if (dest) + { + set_general_properties (dest, TRUE); + + trapezoids = create_random_trapezoids ( + &n_traps, dest->bits.width, dest->bits.height); + + if (trapezoids) + { + switch (prng_rand_n (3)) + { + case 0: + pixman_rasterize_trapezoid ( + dest, &trapezoids[prng_rand_n (n_traps)], + rand_x (dest), rand_y (dest)); + break; + + case 1: + source = create_random_image (); + + if (source) + { + op = op_list [prng_rand_n (ARRAY_LENGTH (op_list))]; + + pixman_composite_trapezoids ( + op, source, dest, + random_format (TRUE), + rand_x (source), rand_y (source), + rand_x (dest), rand_y (dest), + n_traps, trapezoids); + } + break; + + case 2: + pixman_add_trapezoids ( + dest, rand_x (dest), rand_y (dest), n_traps, trapezoids); + break; + } + + free (trapezoids); + } + } } - if (source) - pixman_image_unref (source); - if (mask) - pixman_image_unref (mask); + else + { + dest = create_random_bits_image (FALSE); + source = create_random_image (); + mask = create_random_image (); + + if (source && mask && dest) + { + set_general_properties (dest, TRUE); + + op = op_list [prng_rand_n (ARRAY_LENGTH (op_list))]; + + pixman_image_composite32 (op, + source, mask, dest, + rand_x (source), rand_y (source), + rand_x (mask), rand_y (mask), + 0, 0, + dest->bits.width, + dest->bits.height); + } + } + + if (source) + pixman_image_unref (source); + if (mask) + pixman_image_unref (mask); if (dest) pixman_image_unref (dest); } |