summaryrefslogtreecommitdiffstats
path: root/thirdparty/thorvg/src/common/tvgMath.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-09-06 18:07:30 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-09-06 22:08:02 +0200
commita6ab039f2b9e2d524b45186586cc880134fbee98 (patch)
tree9cd88fdfa8ca80f878f73e86865259ea9f4f4212 /thirdparty/thorvg/src/common/tvgMath.cpp
parent05d985496c73577fb0b44291345da5f2dbe09844 (diff)
downloadredot-engine-a6ab039f2b9e2d524b45186586cc880134fbee98.tar.gz
thorvg: Update to 0.14.9
Fixes #96491. Update fix for #96262 to a simple revert of the problematic commit, as the upstream fix is still being debated and caused other issues. Also include fix for upstream regression 2715 added in 0.14.9.
Diffstat (limited to 'thirdparty/thorvg/src/common/tvgMath.cpp')
-rw-r--r--thirdparty/thorvg/src/common/tvgMath.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/thirdparty/thorvg/src/common/tvgMath.cpp b/thirdparty/thorvg/src/common/tvgMath.cpp
index 0254cce9b8..c03b54e5f8 100644
--- a/thirdparty/thorvg/src/common/tvgMath.cpp
+++ b/thirdparty/thorvg/src/common/tvgMath.cpp
@@ -43,9 +43,8 @@ bool mathInverse(const Matrix* m, Matrix* out)
m->e12 * (m->e21 * m->e33 - m->e23 * m->e31) +
m->e13 * (m->e21 * m->e32 - m->e22 * m->e31);
- if (mathZero(det)) return false;
-
- auto invDet = 1 / det;
+ auto invDet = 1.0f / det;
+ if (std::isinf(invDet)) return false;
out->e11 = (m->e22 * m->e33 - m->e32 * m->e23) * invDet;
out->e12 = (m->e13 * m->e32 - m->e12 * m->e33) * invDet;
@@ -137,7 +136,6 @@ Point operator*(const Point& pt, const Matrix& m)
uint8_t mathLerp(const uint8_t &start, const uint8_t &end, float t)
{
auto result = static_cast<int>(start + (end - start) * t);
- if (result > 255) result = 255;
- else if (result < 0) result = 0;
+ mathClamp(result, 0, 255);
return static_cast<uint8_t>(result);
}