mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
48 lines
1.1 KiB
Swift
48 lines
1.1 KiB
Swift
//
|
|
// PassThroughOutputNode.swift
|
|
// lottie-swift
|
|
//
|
|
// Created by Brandon Withrow on 1/30/19.
|
|
//
|
|
|
|
import CoreGraphics
|
|
import Foundation
|
|
|
|
class PassThroughOutputNode: NodeOutput {
|
|
|
|
// MARK: Lifecycle
|
|
|
|
init(parent: NodeOutput?) {
|
|
self.parent = parent
|
|
}
|
|
|
|
// MARK: Internal
|
|
|
|
let parent: NodeOutput?
|
|
|
|
var hasUpdate = false
|
|
var isEnabled = true
|
|
|
|
var outputPath: CGPath? {
|
|
if let parent = parent {
|
|
return parent.outputPath
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func hasOutputUpdates(_ forFrame: CGFloat) -> Bool {
|
|
/// Changes to this node do not affect downstream nodes.
|
|
let parentUpdate = parent?.hasOutputUpdates(forFrame) ?? false
|
|
/// Changes to upstream nodes do, however, affect this nodes state.
|
|
hasUpdate = hasUpdate || parentUpdate
|
|
return parentUpdate
|
|
}
|
|
|
|
func hasRenderUpdates(_ forFrame: CGFloat) -> Bool {
|
|
/// Return true if there are upstream updates or if this node has updates
|
|
let upstreamUpdates = parent?.hasOutputUpdates(forFrame) ?? false
|
|
hasUpdate = hasUpdate || upstreamUpdates
|
|
return hasUpdate
|
|
}
|
|
}
|