From f60a3a475bee08a4e7e4c5893e7426682ecd379d Mon Sep 17 00:00:00 2001 From: Mira Grudzinska Date: Sun, 10 Oct 2021 16:39:06 +0200 Subject: [PATCH] svg_loader: removed unnecessary casting The used scaling factor should be a float - casting it to an int caused misevaluation of the radial gradient radius --- src/loaders/svg/tvgSvgSceneBuilder.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/loaders/svg/tvgSvgSceneBuilder.cpp b/src/loaders/svg/tvgSvgSceneBuilder.cpp index d3eae09..6d0c0a1 100644 --- a/src/loaders/svg/tvgSvgSceneBuilder.cpp +++ b/src/loaders/svg/tvgSvgSceneBuilder.cpp @@ -98,15 +98,15 @@ static unique_ptr _applyRadialGradientProperty(SvgStyleGradient* { Fill::ColorStop *stops; int stopCount = 0; - int radius; + float radius; auto fillGrad = RadialGradient::gen(); - radius = static_cast(sqrtf(powf(rw, 2.0f) + powf(rh, 2.0f)) / sqrtf(2.0f)); + radius = sqrtf(powf(rw, 2.0f) + powf(rh, 2.0f)) / sqrtf(2.0f); if (!g->userSpace) { //That is according to Units in here //https://www.w3.org/TR/2015/WD-SVG2-20150915/coords.html int min = static_cast((rh > rw) ? rw : rh); - radius = static_cast(sqrt(pow(min, 2) + pow(min, 2)) / sqrtf(2.0f)); + radius = sqrtf(pow(min, 2) + pow(min, 2)) / sqrtf(2.0f); } if (g->usePercentage) { -- 2.7.4