Bug Summary

File:test/alpha-test.c
Location:line 76, column 5
Description:Value stored to 'r_inner' is never read

Annotated Source Code

1#include <stdio.h>
2#include <stdlib.h>
3#include "pixman.h"
4#include "gtk-utils.h"
5
6int
7main (int argc, char **argv)
8{
9#define WIDTH400 400
10#define HEIGHT200 200
11
12 uint32_t *alpha = malloc (WIDTH400 * HEIGHT200 * 4);
13 uint32_t *dest = malloc (WIDTH400 * HEIGHT200 * 4);
14 uint32_t *src = malloc (WIDTH400 * HEIGHT200 * 4);
15 pixman_image_t *grad_img;
16 pixman_image_t *alpha_img;
17 pixman_image_t *dest_img;
18 pixman_image_t *src_img;
19 int i;
20 pixman_gradient_stop_t stops[2] =
21 {
22 { pixman_int_to_fixed (0)((pixman_fixed_t) ((0) << 16)), { 0x0000, 0x0000, 0x0000, 0x0000 } },
23 { pixman_int_to_fixed (1)((pixman_fixed_t) ((1) << 16)), { 0xffff, 0x0000, 0x1111, 0xffff } }
24 };
25 pixman_point_fixed_t p1 = { pixman_double_to_fixed (0)((pixman_fixed_t) ((0) * 65536.0)), 0 };
26 pixman_point_fixed_t p2 = { pixman_double_to_fixed (WIDTH)((pixman_fixed_t) ((400) * 65536.0)),
27 pixman_int_to_fixed (0)((pixman_fixed_t) ((0) << 16)) };
28#if 0
29 pixman_transform_t trans = {
30 { { pixman_double_to_fixed (2)((pixman_fixed_t) ((2) * 65536.0)), pixman_double_to_fixed (0.5)((pixman_fixed_t) ((0.5) * 65536.0)), pixman_double_to_fixed (-100)((pixman_fixed_t) ((-100) * 65536.0)), },
31 { pixman_double_to_fixed (0)((pixman_fixed_t) ((0) * 65536.0)), pixman_double_to_fixed (3)((pixman_fixed_t) ((3) * 65536.0)), pixman_double_to_fixed (0)((pixman_fixed_t) ((0) * 65536.0)), },
32 { pixman_double_to_fixed (0)((pixman_fixed_t) ((0) * 65536.0)), pixman_double_to_fixed (0.000)((pixman_fixed_t) ((0.000) * 65536.0)), pixman_double_to_fixed (1.0)((pixman_fixed_t) ((1.0) * 65536.0)) }
33 }
34 };
35#else
36 pixman_transform_t trans = {
37 { { pixman_fixed_1(((pixman_fixed_t) ((1) << 16))), 0, 0 },
38 { 0, pixman_fixed_1(((pixman_fixed_t) ((1) << 16))), 0 },
39 { 0, 0, pixman_fixed_1(((pixman_fixed_t) ((1) << 16))) } }
40 };
41#endif
42
43 pixman_point_fixed_t c_inner;
44 pixman_point_fixed_t c_outer;
45 pixman_fixed_t r_inner;
46 pixman_fixed_t r_outer;
47
48 for (i = 0; i < WIDTH400 * HEIGHT200; ++i)
49 alpha[i] = 0x4f00004f; /* pale blue */
50
51 alpha_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
52 WIDTH400, HEIGHT200,
53 alpha,
54 WIDTH400 * 4);
55
56 for (i = 0; i < WIDTH400 * HEIGHT200; ++i)
57 dest[i] = 0xffffff00; /* yellow */
58
59 dest_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
60 WIDTH400, HEIGHT200,
61 dest,
62 WIDTH400 * 4);
63
64 for (i = 0; i < WIDTH400 * HEIGHT200; ++i)
65 src[i] = 0xffff0000;
66
67 src_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
68 WIDTH400, HEIGHT200,
69 src,
70 WIDTH400 * 4);
71
72 c_inner.x = pixman_double_to_fixed (50.0)((pixman_fixed_t) ((50.0) * 65536.0));
73 c_inner.y = pixman_double_to_fixed (50.0)((pixman_fixed_t) ((50.0) * 65536.0));
74 c_outer.x = pixman_double_to_fixed (50.0)((pixman_fixed_t) ((50.0) * 65536.0));
75 c_outer.y = pixman_double_to_fixed (50.0)((pixman_fixed_t) ((50.0) * 65536.0));
76 r_inner = 0;
Value stored to 'r_inner' is never read
77 r_outer = pixman_double_to_fixed (50.0)((pixman_fixed_t) ((50.0) * 65536.0));
78
79#if 0
80 grad_img = pixman_image_create_conical_gradient (&c_inner, r_inner,
81 stops, 2);
82#endif
83#if 0
84 grad_img = pixman_image_create_conical_gradient (&c_inner, r_inner,
85 stops, 2);
86 grad_img = pixman_image_create_linear_gradient (&c_inner, &c_outer,
87 r_inner, r_outer,
88 stops, 2);
89#endif
90
91 grad_img = pixman_image_create_linear_gradient (&p1, &p2,
92 stops, 2);
93
94 pixman_image_set_transform (grad_img, &trans);
95 pixman_image_set_repeat (grad_img, PIXMAN_REPEAT_PAD);
96
97 pixman_image_composite (PIXMAN_OP_OVER, grad_img, NULL((void*)0), alpha_img,
98 0, 0, 0, 0, 0, 0, 10 * WIDTH400, HEIGHT200);
99
100 pixman_image_set_alpha_map (src_img, alpha_img, 10, 10);
101
102 pixman_image_composite (PIXMAN_OP_OVER, src_img, NULL((void*)0), dest_img,
103 0, 0, 0, 0, 0, 0, 10 * WIDTH400, HEIGHT200);
104
105 printf ("0, 0: %x\n", dest[0]);
106 printf ("10, 10: %x\n", dest[10 * 10 + 10]);
107 printf ("w, h: %x\n", dest[(HEIGHT200 - 1) * 100 + (WIDTH400 - 1)]);
108
109 show_image (dest_img);
110
111 pixman_image_unref (src_img);
112 pixman_image_unref (grad_img);
113 pixman_image_unref (alpha_img);
114 free (dest);
115
116 return 0;
117}