• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "utils.h"
2 #include <stdio.h>
3 
4 int
main()5 main ()
6 {
7     static const pixman_point_fixed_t inner = { 0x0000, 0x0000 };
8     static const pixman_point_fixed_t outer = { 0x0000, 0x0000 };
9     static const pixman_fixed_t r_inner = 0;
10     static const pixman_fixed_t r_outer = 64 << 16;
11     static const pixman_gradient_stop_t stops[] = {
12 	{ 0x00000, { 0x6666, 0x6666, 0x6666, 0xffff } },
13 	{ 0x10000, { 0x0000, 0x0000, 0x0000, 0xffff } }
14     };
15     static const pixman_transform_t transform = {
16 	{ { 0x0,        0x26ee, 0x0},
17 	  { 0xffffeeef, 0x0,    0x0},
18 	  { 0x0,        0x0,    0x10000}
19 	}
20     };
21     static const pixman_color_t z = { 0x0000, 0x0000, 0x0000, 0x0000 };
22     pixman_image_t *dest, *radial, *zero;
23     int i;
24     double before, after;
25 
26     dest = pixman_image_create_bits (
27 	PIXMAN_x8r8g8b8, 640, 429, NULL, -1);
28     zero = pixman_image_create_solid_fill (&z);
29     radial = pixman_image_create_radial_gradient (
30 	&inner, &outer, r_inner, r_outer, stops, ARRAY_LENGTH (stops));
31     pixman_image_set_transform (radial, &transform);
32     pixman_image_set_repeat (radial, PIXMAN_REPEAT_PAD);
33 
34 #define N_COMPOSITE	500
35 
36     before = gettime();
37     for (i = 0; i < N_COMPOSITE; ++i)
38     {
39 	before -= gettime();
40 
41 	pixman_image_composite (
42 	    PIXMAN_OP_SRC, zero, NULL, dest,
43 	    0, 0, 0, 0, 0, 0, 640, 429);
44 
45 	before += gettime();
46 
47 	pixman_image_composite32 (
48 	    PIXMAN_OP_OVER, radial, NULL, dest,
49 	    - 150, -158, 0, 0, 0, 0, 640, 361);
50     }
51 
52     after = gettime();
53 
54     write_png (dest, "radial.png");
55 
56     printf ("Average time to composite: %f\n", (after - before) / N_COMPOSITE);
57     return 0;
58 }
59