diff options
author | marha <marha@users.sourceforge.net> | 2012-11-19 10:38:33 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-11-19 10:38:33 +0100 |
commit | 24635abae6008bef13e30d798b3f33abab412770 (patch) | |
tree | e799fbde24e0fd935af76b0bc48d30ef69f75d54 /pixman/test | |
parent | e0844ae8b5ef87049537a7e0ebff81acc2695256 (diff) | |
parent | 6ce1d8f0f8c23e186175a7c84c21d7bfbe168dc5 (diff) | |
download | vcxsrv-24635abae6008bef13e30d798b3f33abab412770.tar.gz vcxsrv-24635abae6008bef13e30d798b3f33abab412770.tar.bz2 vcxsrv-24635abae6008bef13e30d798b3f33abab412770.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
Changed file permissions
dos -> unix
Conflicts:
libX11/include/X11/Xregion.h
libX11/src/ConvSel.c
libX11/src/CrGlCur.c
libX11/src/CrWindow.c
libX11/src/GetDflt.c
libX11/src/StrKeysym.c
libX11/src/Window.c
libX11/src/xkb/XKBBind.c
libX11/src/xkb/XKBGetMap.c
libX11/src/xkb/XKBSetGeom.c
libX11/src/xkb/XKBUse.c
libX11/src/xlibi18n/XimProto.h
libX11/src/xlibi18n/lcDynamic.c
libXdmcp/Key.c
libXdmcp/Write.c
libxcb/src/xcb_windefs.h
xkbcomp/keycodes.c
xkbcomp/xkbpath.c
xorg-server/hw/xwin/glx/winpriv.h
xorg-server/xkeyboard-config/rules/bin/ml1_s.sh
xorg-server/xkeyboard-config/rules/bin/ml1v1_s.sh
xorg-server/xkeyboard-config/rules/bin/ml1v_s.sh
xorg-server/xkeyboard-config/rules/bin/ml_s.sh
xorg-server/xkeyboard-config/rules/bin/mln_s.sh
xorg-server/xkeyboard-config/rules/bin/mlnvn_s.sh
xorg-server/xkeyboard-config/rules/bin/mlv_s.sh
xorg-server/xkeyboard-config/rules/compat/.gitignore
Diffstat (limited to 'pixman/test')
-rw-r--r-- | pixman/test/alpha-loop.c | 58 | ||||
-rw-r--r-- | pixman/test/region-test.c | 246 |
2 files changed, 152 insertions, 152 deletions
diff --git a/pixman/test/alpha-loop.c b/pixman/test/alpha-loop.c index 38fc21f5d..e4d90a988 100644 --- a/pixman/test/alpha-loop.c +++ b/pixman/test/alpha-loop.c @@ -1,29 +1,29 @@ -#include <stdio.h>
-#include <stdlib.h>
-#include "utils.h"
-
-#define WIDTH 400
-#define HEIGHT 200
-
-int
-main (int argc, char **argv)
-{
- uint8_t *alpha = make_random_bytes (WIDTH * HEIGHT);
- uint32_t *src = (uint32_t *)make_random_bytes (WIDTH * HEIGHT * 4);
- uint32_t *dest = (uint32_t *)make_random_bytes (WIDTH * HEIGHT * 4);
-
- pixman_image_t *a = pixman_image_create_bits (PIXMAN_a8, WIDTH, HEIGHT, (uint32_t *)alpha, WIDTH);
- pixman_image_t *d = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, dest, WIDTH * 4);
- pixman_image_t *s = pixman_image_create_bits (PIXMAN_a2r10g10b10, WIDTH, HEIGHT, src, WIDTH * 4);
-
- fail_after (5, "Infinite loop detected: 5 seconds without progress\n");
-
- pixman_image_set_alpha_map (s, a, 0, 0);
- pixman_image_set_alpha_map (a, s, 0, 0);
-
- pixman_image_composite (PIXMAN_OP_SRC, s, NULL, d, 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
-
- pixman_image_unref (s);
-
- return 0;
-}
+#include <stdio.h> +#include <stdlib.h> +#include "utils.h" + +#define WIDTH 400 +#define HEIGHT 200 + +int +main (int argc, char **argv) +{ + uint8_t *alpha = make_random_bytes (WIDTH * HEIGHT); + uint32_t *src = (uint32_t *)make_random_bytes (WIDTH * HEIGHT * 4); + uint32_t *dest = (uint32_t *)make_random_bytes (WIDTH * HEIGHT * 4); + + pixman_image_t *a = pixman_image_create_bits (PIXMAN_a8, WIDTH, HEIGHT, (uint32_t *)alpha, WIDTH); + pixman_image_t *d = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, dest, WIDTH * 4); + pixman_image_t *s = pixman_image_create_bits (PIXMAN_a2r10g10b10, WIDTH, HEIGHT, src, WIDTH * 4); + + fail_after (5, "Infinite loop detected: 5 seconds without progress\n"); + + pixman_image_set_alpha_map (s, a, 0, 0); + pixman_image_set_alpha_map (a, s, 0, 0); + + pixman_image_composite (PIXMAN_OP_SRC, s, NULL, d, 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT); + + pixman_image_unref (s); + + return 0; +} diff --git a/pixman/test/region-test.c b/pixman/test/region-test.c index a1fc4a837..9d5a41eb9 100644 --- a/pixman/test/region-test.c +++ b/pixman/test/region-test.c @@ -1,123 +1,123 @@ -#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include "utils.h"
-
-int
-main ()
-{
- pixman_region32_t r1;
- pixman_region32_t r2;
- pixman_region32_t r3;
- pixman_box32_t boxes[] = {
- { 10, 10, 20, 20 },
- { 30, 30, 30, 40 },
- { 50, 45, 60, 44 },
- };
- pixman_box32_t boxes2[] = {
- { 2, 6, 7, 6 },
- { 4, 1, 6, 7 },
- };
- pixman_box32_t boxes3[] = {
- { 2, 6, 7, 6 },
- { 4, 1, 6, 1 },
- };
- 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
- */
- pixman_region32_init_rect (&r1, 0, 0, 20, 64000);
- pixman_region32_init_rect (&r2, 0, 0, 20, 64000);
- pixman_region32_init_rect (&r3, 0, 0, 20, 64000);
-
- pixman_region32_subtract (&r1, &r2, &r3);
-
-
- /* This would produce a region containing an empty
- * rectangle in it. Such regions are considered malformed,
- * but using an empty rectangle for initialization should
- * work.
- */
- pixman_region32_init_rects (&r1, boxes, 3);
-
- b = pixman_region32_rectangles (&r1, &i);
-
- assert (i == 1);
-
- while (i--)
- {
- assert (b[i].x1 < b[i].x2);
- assert (b[i].y1 < b[i].y2);
- }
-
- /* This would produce a rectangle containing the bounding box
- * of the two rectangles. The correct result is to eliminate
- * the broken rectangle.
- */
- pixman_region32_init_rects (&r1, boxes2, 2);
-
- b = pixman_region32_rectangles (&r1, &i);
-
- assert (i == 1);
-
- assert (b[0].x1 == 4);
- assert (b[0].y1 == 1);
- assert (b[0].x2 == 6);
- assert (b[0].y2 == 7);
-
- /* This should produce an empty region */
- pixman_region32_init_rects (&r1, boxes3, 2);
-
- b = pixman_region32_rectangles (&r1, &i);
-
- 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;
-}
+#include <assert.h> +#include <stdlib.h> +#include <stdio.h> +#include "utils.h" + +int +main () +{ + pixman_region32_t r1; + pixman_region32_t r2; + pixman_region32_t r3; + pixman_box32_t boxes[] = { + { 10, 10, 20, 20 }, + { 30, 30, 30, 40 }, + { 50, 45, 60, 44 }, + }; + pixman_box32_t boxes2[] = { + { 2, 6, 7, 6 }, + { 4, 1, 6, 7 }, + }; + pixman_box32_t boxes3[] = { + { 2, 6, 7, 6 }, + { 4, 1, 6, 1 }, + }; + 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 + */ + pixman_region32_init_rect (&r1, 0, 0, 20, 64000); + pixman_region32_init_rect (&r2, 0, 0, 20, 64000); + pixman_region32_init_rect (&r3, 0, 0, 20, 64000); + + pixman_region32_subtract (&r1, &r2, &r3); + + + /* This would produce a region containing an empty + * rectangle in it. Such regions are considered malformed, + * but using an empty rectangle for initialization should + * work. + */ + pixman_region32_init_rects (&r1, boxes, 3); + + b = pixman_region32_rectangles (&r1, &i); + + assert (i == 1); + + while (i--) + { + assert (b[i].x1 < b[i].x2); + assert (b[i].y1 < b[i].y2); + } + + /* This would produce a rectangle containing the bounding box + * of the two rectangles. The correct result is to eliminate + * the broken rectangle. + */ + pixman_region32_init_rects (&r1, boxes2, 2); + + b = pixman_region32_rectangles (&r1, &i); + + assert (i == 1); + + assert (b[0].x1 == 4); + assert (b[0].y1 == 1); + assert (b[0].x2 == 6); + assert (b[0].y2 == 7); + + /* This should produce an empty region */ + pixman_region32_init_rects (&r1, boxes3, 2); + + b = pixman_region32_rectangles (&r1, &i); + + 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; +} |