aboutsummaryrefslogtreecommitdiff
path: root/pixman/test/region-test.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-02-27 16:02:46 +0000
committermarha <marha@users.sourceforge.net>2010-02-27 16:02:46 +0000
commit65fbbe1531c1e09cd40014374fdd93cff3a1d33a (patch)
tree98646568c7171fb4d51b0043b29d52f57c358ea4 /pixman/test/region-test.c
parent1ab2f9be54d01fc145e8f25d2e35a59636a2c0bf (diff)
downloadvcxsrv-65fbbe1531c1e09cd40014374fdd93cff3a1d33a.tar.gz
vcxsrv-65fbbe1531c1e09cd40014374fdd93cff3a1d33a.tar.bz2
vcxsrv-65fbbe1531c1e09cd40014374fdd93cff3a1d33a.zip
Updated to pixman-0.17.8
Diffstat (limited to 'pixman/test/region-test.c')
-rw-r--r--pixman/test/region-test.c49
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;
}