diff options
author | marha <marha@users.sourceforge.net> | 2010-02-27 16:22:52 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-02-27 16:22:52 +0000 |
commit | 56389060042079a1d526e98c54a7f54b1a4853f7 (patch) | |
tree | 791a212b1eaebe8b028a390444b5a98a88e09868 /pixman/test/region-test.c | |
parent | 0235891665ad311e1f81d1b0f003f433b4af4cbb (diff) | |
parent | 65fbbe1531c1e09cd40014374fdd93cff3a1d33a (diff) | |
download | vcxsrv-56389060042079a1d526e98c54a7f54b1a4853f7.tar.gz vcxsrv-56389060042079a1d526e98c54a7f54b1a4853f7.tar.bz2 vcxsrv-56389060042079a1d526e98c54a7f54b1a4853f7.zip |
svn merge ^/branches/released .
Diffstat (limited to 'pixman/test/region-test.c')
-rw-r--r-- | pixman/test/region-test.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/pixman/test/region-test.c b/pixman/test/region-test.c index 3568969f1..9d5a41eb9 100644 --- a/pixman/test/region-test.c +++ b/pixman/test/region-test.c @@ -1,7 +1,7 @@ #include <assert.h> #include <stdlib.h> #include <stdio.h> -#include "pixman.h" +#include "utils.h" int main () @@ -22,8 +22,15 @@ main () { 2, 6, 7, 6 }, { 4, 1, 6, 1 }, }; - int i; + int i, j; pixman_box32_t *b; + pixman_image_t *image, *fill; + pixman_color_t white = { + 0xffff, + 0xffff, + 0xffff, + 0xffff + }; /* This used to go into an infinite loop before pixman-region.c * was fixed to not use explict "short" variables @@ -74,5 +81,43 @@ main () assert (i == 0); + fill = pixman_image_create_solid_fill (&white); + for (i = 0; i < 100; i++) + { + int image_size = 128; + + pixman_region32_init (&r1); + + /* Add some random rectangles */ + for (j = 0; j < 64; j++) + pixman_region32_union_rect (&r1, &r1, + lcg_rand_n (image_size), + lcg_rand_n (image_size), + lcg_rand_n (25), + lcg_rand_n (25)); + + /* Clip to image size */ + pixman_region32_init_rect (&r2, 0, 0, image_size, image_size); + pixman_region32_intersect (&r1, &r1, &r2); + pixman_region32_fini (&r2); + + /* render region to a1 mask */ + image = pixman_image_create_bits (PIXMAN_a1, image_size, image_size, NULL, 0); + pixman_image_set_clip_region32 (image, &r1); + pixman_image_composite32 (PIXMAN_OP_SRC, + fill, NULL, image, + 0, 0, 0, 0, 0, 0, + image_size, image_size); + pixman_region32_init_from_image (&r2, image); + + pixman_image_unref (image); + + assert (pixman_region32_equal (&r1, &r2)); + pixman_region32_fini (&r1); + pixman_region32_fini (&r2); + + } + pixman_image_unref (fill); + return 0; } |