mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 21:45:19 +00:00
Limit possible lottie parameters
This commit is contained in:
parent
b5029991f2
commit
21354c783d
@ -592,9 +592,9 @@ public final class AnimatedStickerDirectFrameSource: AnimatedStickerFrameSource
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
self.animation = animation
|
self.animation = animation
|
||||||
let frameCount = Int(animation.frameCount)
|
let frameCount = max(1, Int(animation.frameCount))
|
||||||
self.frameCount = frameCount
|
self.frameCount = frameCount
|
||||||
self.frameRate = Int(animation.frameRate)
|
self.frameRate = max(1, Int(animation.frameRate))
|
||||||
|
|
||||||
self.cache = cachePathPrefix.flatMap { cachePathPrefix in
|
self.cache = cachePathPrefix.flatMap { cachePathPrefix in
|
||||||
AnimatedStickerDirectFrameSourceCache(queue: queue, pathPrefix: cachePathPrefix, width: width, height: height, frameCount: frameCount, fitzModifier: fitzModifier, useHardware: useMetalCache)
|
AnimatedStickerDirectFrameSourceCache(queue: queue, pathPrefix: cachePathPrefix, width: width, height: height, frameCount: frameCount, fitzModifier: fitzModifier, useHardware: useMetalCache)
|
||||||
|
@ -49,7 +49,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
_frameCount = (int32_t)_animation->totalFrame();
|
_frameCount = (int32_t)_animation->totalFrame();
|
||||||
|
_frameCount = MAX(1, _frameCount);
|
||||||
_frameRate = (int32_t)_animation->frameRate();
|
_frameRate = (int32_t)_animation->frameRate();
|
||||||
|
_frameRate = MAX(1, _frameRate);
|
||||||
|
|
||||||
size_t width = 0;
|
size_t width = 0;
|
||||||
size_t height = 0;
|
size_t height = 0;
|
||||||
@ -59,6 +61,9 @@
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
width = MAX(1, width);
|
||||||
|
height = MAX(1, height);
|
||||||
|
|
||||||
_dimensions = CGSizeMake(width, height);
|
_dimensions = CGSizeMake(width, height);
|
||||||
|
|
||||||
if ((_frameRate > 360) || _animation->duration() > 9.0) {
|
if ((_frameRate > 360) || _animation->duration() > 9.0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user