From 5fb39ab0bc5fb021f29ea6f3a21d0a6f3647e539 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 6 Mar 2022 20:50:30 -0800 Subject: [PATCH] core plugin svg_gradstyle: treat angle-based quantities as a double This removes an assumption that these calculated values fit in an int. Squashes two -Wfloat-conversion warnings. --- plugin/core/gvrender_core_svg.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugin/core/gvrender_core_svg.c b/plugin/core/gvrender_core_svg.c index 5ffed5ad8..85e748b7e 100644 --- a/plugin/core/gvrender_core_svg.c +++ b/plugin/core/gvrender_core_svg.c @@ -20,6 +20,7 @@ #include "config.h" +#include #include #include #include @@ -543,7 +544,7 @@ static int svg_gradstyle(GVJ_t * job, pointf * A, int n) */ static int svg_rgradstyle(GVJ_t * job) { - int ifx, ify; + double ifx, ify; static int rgradId; int id = rgradId++; @@ -552,11 +553,12 @@ static int svg_rgradstyle(GVJ_t * job) if (angle == 0.) { ifx = ify = 50; } else { - ifx = 50 * (1 + cos(angle)); - ify = 50 * (1 - sin(angle)); + ifx = round(50 * (1 + cos(angle))); + ify = round(50 * (1 - sin(angle))); } gvprintf(job, - "\n\n", + "\n\n", id, ifx, ify); GVPUTS(job, "fillcolor); -- 2.40.0