diff options
Diffstat (limited to 'thirdparty/thorvg/src/renderer/sw_engine/tvgSwMath.cpp')
-rw-r--r-- | thirdparty/thorvg/src/renderer/sw_engine/tvgSwMath.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMath.cpp b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMath.cpp index ad5a2b7371..ae158c836a 100644 --- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMath.cpp +++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMath.cpp @@ -164,8 +164,8 @@ void mathRotate(SwPoint& pt, SwFixed angle) auto cosv = cosf(radian); auto sinv = sinf(radian); - pt.x = SwCoord(roundf((v.x * cosv - v.y * sinv) * 64.0f)); - pt.y = SwCoord(roundf((v.x * sinv + v.y * cosv) * 64.0f)); + pt.x = SwCoord(nearbyint((v.x * cosv - v.y * sinv) * 64.0f)); + pt.y = SwCoord(nearbyint((v.x * sinv + v.y * cosv) * 64.0f)); } @@ -179,7 +179,7 @@ SwFixed mathTan(SwFixed angle) SwFixed mathAtan(const SwPoint& pt) { if (pt.zero()) return 0; - return SwFixed(atan2f(TO_FLOAT(pt.y), TO_FLOAT(pt.x)) * (180.0f / MATH_PI) * 65536.0f); + return SwFixed(mathAtan2(TO_FLOAT(pt.y), TO_FLOAT(pt.x)) * (180.0f / MATH_PI) * 65536.0f); } @@ -309,10 +309,10 @@ bool mathUpdateOutlineBBox(const SwOutline* outline, const SwBBox& clipRegion, S //the rasterization region has to be rearranged. //https://github.com/Samsung/thorvg/issues/916 if (fastTrack) { - renderRegion.min.x = static_cast<SwCoord>(round(xMin / 64.0f)); - renderRegion.max.x = static_cast<SwCoord>(round(xMax / 64.0f)); - renderRegion.min.y = static_cast<SwCoord>(round(yMin / 64.0f)); - renderRegion.max.y = static_cast<SwCoord>(round(yMax / 64.0f)); + renderRegion.min.x = static_cast<SwCoord>(nearbyint(xMin / 64.0f)); + renderRegion.max.x = static_cast<SwCoord>(nearbyint(xMax / 64.0f)); + renderRegion.min.y = static_cast<SwCoord>(nearbyint(yMin / 64.0f)); + renderRegion.max.y = static_cast<SwCoord>(nearbyint(yMax / 64.0f)); } else { renderRegion.min.x = xMin >> 6; renderRegion.max.x = (xMax + 63) >> 6; |