From 0bfc8c4d634da43535321ed8c765f4c5766fd588 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 20 Nov 2016 22:09:32 +0100 Subject: [PATCH] Use fabs() instead of abs() for non-integer variables in SVG DC ::abs() truncates floating point values to ints, so use fabs() instead. This could have been also corrected by using std::abs(), which is overloaded for multiple types, but use fabs() for consistency with the existing code. This fixes a problem introduced in 1e0719ad81b76ededd69f44ff734249ceb2df665. See #17557. --- src/common/dcsvg.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/dcsvg.cpp b/src/common/dcsvg.cpp index 86e0b1bacf..5157f043eb 100644 --- a/src/common/dcsvg.cpp +++ b/src/common/dcsvg.cpp @@ -845,14 +845,14 @@ void wxSVGFileDCImpl::DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord double start = (sa - 90); if (start < 0) start += 360; - while (abs(start) > 360) - start -= (start / abs(start)) * 360; + while (fabs(start) > 360) + start -= (start / fabs(start)) * 360; double end = (ea - 90); if (end < 0) end += 360; - while (abs(end) > 360) - end -= (end / abs(end)) * 360; + while (fabs(end) > 360) + end -= (end / fabs(end)) * 360; // svg arcs are in clockwise direction, reverse angle double angle = end - start;