1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #include "pixman.h" 5 #include "gtk-utils.h" 6 7 /* This test demonstrates that clipping is done totally different depending 8 * on whether the source is transformed or not. 9 */ 10 int 11 main (int argc, char **argv) 12 { 13 #define WIDTH 200 14 #define HEIGHT 200 15 16 #define SMALL 25 17 18 uint32_t *sbits = malloc (SMALL * SMALL * 4); 19 uint32_t *bits = malloc (WIDTH * HEIGHT * 4); 20 pixman_transform_t trans = { 21 { 22 { pixman_double_to_fixed (1.0), pixman_double_to_fixed (0), pixman_double_to_fixed (-0.1), }, 23 { pixman_double_to_fixed (0), pixman_double_to_fixed (1), pixman_double_to_fixed (-0.1), }, 24 { pixman_double_to_fixed (0), pixman_double_to_fixed (0), pixman_double_to_fixed (1.0) } 25 } }; 26 27 pixman_image_t *src_img = pixman_image_create_bits (PIXMAN_a8r8g8b8, SMALL, SMALL, sbits, 4 * SMALL); 28 pixman_image_t *dest_img = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, bits, 4 * WIDTH); 29 30 memset (bits, 0xff, WIDTH * HEIGHT * 4); 31 memset (sbits, 0x00, SMALL * SMALL * 4); 32 33 pixman_image_composite (PIXMAN_OP_IN, 34 src_img, NULL, dest_img, 35 0, 0, 0, 0, SMALL, SMALL, 200, 200); 36 37 pixman_image_set_transform (src_img, &trans); 38 39 pixman_image_composite (PIXMAN_OP_IN, 40 src_img, NULL, dest_img, 41 0, 0, 0, 0, SMALL * 2, SMALL * 2, 200, 200); 42 43 show_image (dest_img); 44 45 pixman_image_unref (src_img); 46 pixman_image_unref (dest_img); 47 free (bits); 48 49 return 0; 50 } 51