0001-disable-debug-printfs.patch 3.8 KB

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