mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-09 15:51:05 +00:00
rlottie: Fix a issue when shape animation data are not same size
This commit is contained in:
parent
482ac8738e
commit
7dbb3845d9
@ -138,12 +138,12 @@ inline T lerp(const T& start, const T& end, float t)
|
||||
|
||||
inline LottieShapeData lerp(const LottieShapeData& start, const LottieShapeData& end, float t)
|
||||
{
|
||||
if (start.mPoints.size() != end.mPoints.size())
|
||||
return LottieShapeData();
|
||||
|
||||
// Usal case both start and end path has same size
|
||||
// In case its different then truncate the larger path and do the interpolation.
|
||||
LottieShapeData result;
|
||||
result.reserve(start.mPoints.size());
|
||||
for (unsigned int i = 0 ; i < start.mPoints.size(); i++) {
|
||||
auto size = std::min(start.mPoints.size(), end.mPoints.size());
|
||||
result.reserve(size);
|
||||
for (unsigned int i = 0 ; i < size; i++) {
|
||||
result.mPoints.push_back(start.mPoints[i] + t * (end.mPoints[i] - start.mPoints[i]));
|
||||
}
|
||||
return result;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user