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 1e0719ad81.

See #17557.
This commit is contained in:
Vadim Zeitlin
2016-11-20 22:09:32 +01:00
parent cb19499c90
commit 0bfc8c4d63

View File

@@ -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;