diff options
Diffstat (limited to 'thirdparty/thorvg/src/renderer/sw_engine/tvgSwMath.cpp')
-rw-r--r-- | thirdparty/thorvg/src/renderer/sw_engine/tvgSwMath.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMath.cpp b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMath.cpp index 60dbbc4fbc..fb809c4f7e 100644 --- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMath.cpp +++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMath.cpp @@ -44,17 +44,7 @@ SwFixed mathMean(SwFixed angle1, SwFixed angle2) } -bool mathSmallCubic(const SwPoint* base) -{ - auto d1 = base[2] - base[3]; - auto d2 = base[1] - base[2]; - auto d3 = base[0] - base[1]; - - return d1.small() && d2.small() && d3.small(); -} - - -bool mathFlatCubic(const SwPoint* base, SwFixed& angleIn, SwFixed& angleMid, SwFixed& angleOut) +bool mathSmallCubic(const SwPoint* base, SwFixed& angleIn, SwFixed& angleMid, SwFixed& angleOut) { auto d1 = base[2] - base[3]; auto d2 = base[1] - base[2]; @@ -62,7 +52,12 @@ bool mathFlatCubic(const SwPoint* base, SwFixed& angleIn, SwFixed& angleMid, SwF if (d1.small()) { if (d2.small()) { - angleIn = angleMid = angleOut = mathAtan(d3); + if (d3.small()) { + angleIn = angleMid = angleOut = 0; + return true; + } else { + angleIn = angleMid = angleOut = mathAtan(d3); + } } else { if (d3.small()) { angleIn = angleMid = angleOut = mathAtan(d2); |