Inline animation

This commit is contained in:
Ali 2022-05-10 17:51:56 +04:00
parent 72923655e4
commit 9963c7794a
3 changed files with 320 additions and 20 deletions

View file

@ -562,23 +562,23 @@ private final class AnimatedStickerDirectFrameSourceCache {
}
final class AnimatedStickerDirectFrameSource: AnimatedStickerFrameSource {
public final class AnimatedStickerDirectFrameSource: AnimatedStickerFrameSource {
private let queue: Queue
private let data: Data
private let width: Int
private let height: Int
private let cache: AnimatedStickerDirectFrameSourceCache?
private let bytesPerRow: Int
let frameCount: Int
let frameRate: Int
public let frameCount: Int
public let frameRate: Int
fileprivate var currentFrame: Int
private let animation: LottieInstance
var frameIndex: Int {
public var frameIndex: Int {
return self.currentFrame % self.frameCount
}
init?(queue: Queue, data: Data, width: Int, height: Int, cachePathPrefix: String?, useMetalCache: Bool = false, fitzModifier: EmojiFitzModifier?) {
public init?(queue: Queue, data: Data, width: Int, height: Int, cachePathPrefix: String?, useMetalCache: Bool = false, fitzModifier: EmojiFitzModifier?) {
self.queue = queue
self.data = data
self.width = width
@ -604,7 +604,7 @@ final class AnimatedStickerDirectFrameSource: AnimatedStickerFrameSource {
assert(self.queue.isCurrent())
}
func takeFrame(draw: Bool) -> AnimatedStickerFrame? {
public func takeFrame(draw: Bool) -> AnimatedStickerFrame? {
let frameIndex = self.currentFrame % self.frameCount
self.currentFrame += 1
if draw {
@ -630,11 +630,11 @@ final class AnimatedStickerDirectFrameSource: AnimatedStickerFrameSource {
}
}
func skipToEnd() {
public func skipToEnd() {
self.currentFrame = self.frameCount - 1
}
func skipToFrameIndex(_ index: Int) {
public func skipToFrameIndex(_ index: Int) {
self.currentFrame = index
}
}