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