mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-11 17:00:02 +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)
|
inline LottieShapeData lerp(const LottieShapeData& start, const LottieShapeData& end, float t)
|
||||||
{
|
{
|
||||||
if (start.mPoints.size() != end.mPoints.size())
|
// Usal case both start and end path has same size
|
||||||
return LottieShapeData();
|
// In case its different then truncate the larger path and do the interpolation.
|
||||||
|
|
||||||
LottieShapeData result;
|
LottieShapeData result;
|
||||||
result.reserve(start.mPoints.size());
|
auto size = std::min(start.mPoints.size(), end.mPoints.size());
|
||||||
for (unsigned int i = 0 ; i < start.mPoints.size(); i++) {
|
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]));
|
result.mPoints.push_back(start.mPoints[i] + t * (end.mPoints[i] - start.mPoints[i]));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user