Add qemu 2.4.0
[kvmfornfv.git] / qemu / pixman / test / alpha-loop.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "utils.h"
4
5 #define WIDTH 400
6 #define HEIGHT 200
7
8 int
9 main (int argc, char **argv)
10 {
11     pixman_image_t *a, *d, *s;
12     uint8_t *alpha;
13     uint32_t *src, *dest;
14
15     prng_srand (0);
16
17     alpha = make_random_bytes (WIDTH * HEIGHT);
18     src = (uint32_t *)make_random_bytes (WIDTH * HEIGHT * 4);
19     dest = (uint32_t *)make_random_bytes (WIDTH * HEIGHT * 4);
20
21     a = pixman_image_create_bits (PIXMAN_a8, WIDTH, HEIGHT, (uint32_t *)alpha, WIDTH);
22     d = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, dest, WIDTH * 4);
23     s = pixman_image_create_bits (PIXMAN_a2r10g10b10, WIDTH, HEIGHT, src, WIDTH * 4);
24
25     fail_after (5, "Infinite loop detected: 5 seconds without progress\n");
26
27     pixman_image_set_alpha_map (s, a, 0, 0);
28     pixman_image_set_alpha_map (a, s, 0, 0);
29
30     pixman_image_composite (PIXMAN_OP_SRC, s, NULL, d, 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
31
32     pixman_image_unref (s);
33
34     return 0;
35 }