summaryrefslogtreecommitdiffstats
path: root/qemu/pixman/test/alpha-loop.c
diff options
context:
space:
mode:
authorYang Zhang <yang.z.zhang@intel.com>2015-08-28 09:58:54 +0800
committerYang Zhang <yang.z.zhang@intel.com>2015-09-01 12:44:00 +0800
commite44e3482bdb4d0ebde2d8b41830ac2cdb07948fb (patch)
tree66b09f592c55df2878107a468a91d21506104d3f /qemu/pixman/test/alpha-loop.c
parent9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (diff)
Add qemu 2.4.0
Change-Id: Ic99cbad4b61f8b127b7dc74d04576c0bcbaaf4f5 Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Diffstat (limited to 'qemu/pixman/test/alpha-loop.c')
-rw-r--r--qemu/pixman/test/alpha-loop.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/qemu/pixman/test/alpha-loop.c b/qemu/pixman/test/alpha-loop.c
new file mode 100644
index 000000000..4d4384d00
--- /dev/null
+++ b/qemu/pixman/test/alpha-loop.c
@@ -0,0 +1,35 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "utils.h"
+
+#define WIDTH 400
+#define HEIGHT 200
+
+int
+main (int argc, char **argv)
+{
+ pixman_image_t *a, *d, *s;
+ uint8_t *alpha;
+ uint32_t *src, *dest;
+
+ prng_srand (0);
+
+ alpha = make_random_bytes (WIDTH * HEIGHT);
+ src = (uint32_t *)make_random_bytes (WIDTH * HEIGHT * 4);
+ dest = (uint32_t *)make_random_bytes (WIDTH * HEIGHT * 4);
+
+ a = pixman_image_create_bits (PIXMAN_a8, WIDTH, HEIGHT, (uint32_t *)alpha, WIDTH);
+ d = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, dest, WIDTH * 4);
+ 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;
+}