diff options
Diffstat (limited to 'thirdparty/thorvg/src/common/tvgMath.cpp')
-rw-r--r-- | thirdparty/thorvg/src/common/tvgMath.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/thirdparty/thorvg/src/common/tvgMath.cpp b/thirdparty/thorvg/src/common/tvgMath.cpp index c56b32249f..0254cce9b8 100644 --- a/thirdparty/thorvg/src/common/tvgMath.cpp +++ b/thirdparty/thorvg/src/common/tvgMath.cpp @@ -133,3 +133,11 @@ Point operator*(const Point& pt, const Matrix& m) auto ty = pt.x * m.e21 + pt.y * m.e22 + m.e23; return {tx, ty}; } + +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; + return static_cast<uint8_t>(result); +} |