From bbb74b6bdf49db2fd7d51d66f2273f30af5bd3ce Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Fri, 17 May 2024 11:16:24 +0400 Subject: [PATCH] Lottie --- .../Sources/SoftwareLottieRenderer.mm | 4 ++++ Tests/LottieMetalTest/Sources/ViewController.swift | 4 ++-- .../LayerContainers/CompLayers/ShapeCompositionLayer.cpp | 9 --------- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/SoftwareLottieRenderer.mm b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/SoftwareLottieRenderer.mm index 5e5320cf47..90dd8f4c1e 100644 --- a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/SoftwareLottieRenderer.mm +++ b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/SoftwareLottieRenderer.mm @@ -657,6 +657,10 @@ CGRect getPathNativeBoundingBox(CGPathRef _Nonnull path) { return nil; } + if (!useReferenceRendering) { + return nil; + } + processRenderTree(renderNode, lottie::Vector2D((int)size.width, (int)size.height), lottie::CATransform3D::identity().scaled(lottie::Vector2D(size.width / (double)animation.size.width, size.height / (double)animation.size.height)), false, *_bezierPathsBoundingBoxContext.get()); if (useReferenceRendering) { diff --git a/Tests/LottieMetalTest/Sources/ViewController.swift b/Tests/LottieMetalTest/Sources/ViewController.swift index 599c888d16..ff9c7fe159 100644 --- a/Tests/LottieMetalTest/Sources/ViewController.swift +++ b/Tests/LottieMetalTest/Sources/ViewController.swift @@ -119,7 +119,7 @@ public final class ViewController: UIViewController { self.view.layer.addSublayer(MetalEngine.shared.rootLayer) - if "".isEmpty { + if !"".isEmpty { if #available(iOS 13.0, *) { self.test = ReferenceCompareTest(view: self.view) } @@ -167,7 +167,7 @@ public final class ViewController: UIViewController { var frameIndex = 0 while true { animationContainer.update(frameIndex) - //let _ = animationRenderer.render(for: CGSize(width: CGFloat(performanceFrameSize), height: CGFloat(performanceFrameSize)), useReferenceRendering: false) + let _ = animationRenderer.render(for: CGSize(width: CGFloat(performanceFrameSize), height: CGFloat(performanceFrameSize)), useReferenceRendering: false) frameIndex = (frameIndex + 1) % animationContainer.animation.frameCount numUpdates += 1 let timestamp = CFAbsoluteTimeGetCurrent() diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.cpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.cpp index 02fb2d5665..e9b2afb90e 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.cpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.cpp @@ -1403,15 +1403,6 @@ void ShapeCompositionLayer::updateRenderTree(BezierPathsBoundingBoxContext &boun _contentRenderTreeNode->_masksToBounds = _contentsLayer->masksToBounds(); _contentRenderTreeNode->_isHidden = _contentsLayer->isHidden(); - assert(position() == Vector2D::Zero()); - assert(transform().isIdentity()); - assert(opacity() == 1.0); - assert(!masksToBounds()); - assert(!isHidden()); - assert(_contentsLayer->bounds() == CGRect(0.0, 0.0, 0.0, 0.0)); - assert(_contentsLayer->position() == Vector2D::Zero()); - assert(!_contentsLayer->masksToBounds()); - _renderTreeNode->_bounds = bounds(); _renderTreeNode->_position = position(); _renderTreeNode->_transform = transform();