python-dataproperty: bump version to 0.17.0
[buildroot-gz.git] / package / libsvgtiny / 0001-disable-debug-printfs.patch
blob72ed21ccfaaa6a78fed116d4ca8185862f4ab7c7
1 svntiny: svntiny_gradient.c: only print debugging if GRADIENT_DEBUG is enabled
3 Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
4 ---
5 src/svgtiny_gradient.c | 23 ++++++++++++++++++++++-
6 1 file changed, 22 insertions(+), 1 deletion(-)
8 Index: libsvgtiny/src/svgtiny_gradient.c
9 ===================================================================
10 --- libsvgtiny.orig/src/svgtiny_gradient.c
11 +++ libsvgtiny/src/svgtiny_gradient.c
12 @@ -30,8 +30,9 @@ void svgtiny_find_gradient(const char *i
14 xmlNode *gradient;
16 +#ifdef GRADIENT_DEBUG
17 fprintf(stderr, "svgtiny_find_gradient: id \"%s\"\n", id);
19 +#endif
20 state->linear_gradient_stop_count = 0;
21 state->gradient_x1 = "0%";
22 state->gradient_y1 = "0%";
23 @@ -47,13 +48,17 @@ void svgtiny_find_gradient(const char *i
25 gradient = svgtiny_find_element_by_id(
26 (xmlNode *) state->document, id);
27 +#ifdef GRADIENT_DEBUG
28 fprintf(stderr, "gradient %p\n", (void *) gradient);
29 +#endif
30 if (!gradient) {
31 fprintf(stderr, "gradient \"%s\" not found\n", id);
32 return;
35 +#ifdef GRADIENT_DEBUG
36 fprintf(stderr, "gradient name \"%s\"\n", gradient->name);
37 +#endif
38 if (strcmp((const char *) gradient->name, "linearGradient") == 0) {
39 svgtiny_parse_linear_gradient(gradient, state);
41 @@ -98,8 +103,10 @@ svgtiny_code svgtiny_parse_linear_gradie
42 return svgtiny_OUT_OF_MEMORY;
43 svgtiny_parse_transform(s, &a, &b, &c, &d, &e, &f);
44 free(s);
45 +#ifdef GRADIENT_DEBUG
46 fprintf(stderr, "transform %g %g %g %g %g %g\n",
47 a, b, c, d, e, f);
48 +#endif
49 state->gradient_transform.a = a;
50 state->gradient_transform.b = b;
51 state->gradient_transform.c = c;
52 @@ -143,7 +150,9 @@ svgtiny_code svgtiny_parse_linear_gradie
55 if (offset != -1 && color != svgtiny_TRANSPARENT) {
56 +#ifdef GRADIENT_DEBUG
57 fprintf(stderr, "stop %g %x\n", offset, color);
58 +#endif
59 state->gradient_stop[i].offset = offset;
60 state->gradient_stop[i].color = color;
61 i++;
62 @@ -220,9 +229,11 @@ svgtiny_code svgtiny_add_path_linear_gra
63 #endif
65 /* compute gradient vector */
66 +#ifdef GRADIENT_DEBUG
67 fprintf(stderr, "x1 %s, y1 %s, x2 %s, y2 %s\n",
68 state->gradient_x1, state->gradient_y1,
69 state->gradient_x2, state->gradient_y2);
70 +#endif
71 if (!state->gradient_user_space_on_use) {
72 gradient_x0 = object_x0 +
73 svgtiny_parse_length(state->gradient_x1,
74 @@ -297,9 +308,11 @@ svgtiny_code svgtiny_add_path_linear_gra
76 /* invert gradient transform for applying to vertices */
77 svgtiny_invert_matrix(&state->gradient_transform.a, trans);
78 +#ifdef GRADIENT_DEBUG
79 fprintf(stderr, "inverse transform %g %g %g %g %g %g\n",
80 trans[0], trans[1], trans[2], trans[3],
81 trans[4], trans[5]);
82 +#endif
84 /* compute points on the path for triangle vertices */
85 /* r, r0, r1 are distance along gradient vector */
86 @@ -372,8 +385,10 @@ svgtiny_code svgtiny_add_path_linear_gra
87 steps = ceilf(fabsf(r1 - r0) / 0.05);
88 if (steps == 0)
89 steps = 1;
90 +#ifdef GRADIENT_DEBUG
91 fprintf(stderr, "r0 %g, r1 %g, steps %i\n",
92 r0, r1, steps);
93 +#endif
95 /* loop through intermediate points */
96 for (z = 1; z != steps; z++) {
97 @@ -398,7 +413,9 @@ svgtiny_code svgtiny_add_path_linear_gra
98 r = ((x_trans - gradient_x0) * gradient_dx +
99 (y_trans - gradient_y0) * gradient_dy) /
100 gradient_norm_squared;
101 +#ifdef GRADIENT_DEBUG
102 fprintf(stderr, "(%g %g [%g]) ", x, y, r);
103 +#endif
104 point = svgtiny_list_push(pts);
105 if (!point) {
106 svgtiny_list_free(pts);
107 @@ -412,14 +429,18 @@ svgtiny_code svgtiny_add_path_linear_gra
108 min_pt = svgtiny_list_size(pts) - 1;
111 +#ifdef GRADIENT_DEBUG
112 fprintf(stderr, "\n");
113 +#endif
115 /* next segment start point is this segment end point */
116 x0 = x1;
117 y0 = y1;
119 +#ifdef GRADIENT_DEBUG
120 fprintf(stderr, "pts size %i, min_pt %i, min_r %.3f\n",
121 svgtiny_list_size(pts), min_pt, min_r);
122 +#endif
124 /* render triangles */
125 stop_count = state->linear_gradient_stop_count;