From 59d8d311d428bbcf16ac179a234eccaf5d2313ca Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Sun, 19 May 2024 02:11:00 +0400 Subject: [PATCH] Refactoring --- .../SoftwareLottieRenderer/Sources/Canvas.h | 2 +- .../Sources/CoreGraphicsCanvasImpl.h | 2 +- .../Sources/CoreGraphicsCanvasImpl.mm | 2 +- .../Sources/NullCanvasImpl.h | 4 +- .../Sources/NullCanvasImpl.mm | 4 +- .../Sources/SoftwareLottieRenderer.mm | 48 ++++++++--------- .../Sources/ThorVGCanvasImpl.h | 6 +-- .../Sources/ThorVGCanvasImpl.mm | 6 +-- .../Sources/ViewController.swift | 2 +- .../PublicHeaders/LottieCpp/BezierPath.h | 2 +- .../PublicHeaders/LottieCpp/CGPath.h | 4 +- .../PublicHeaders/LottieCpp/CGPathCocoa.h | 2 +- .../PublicHeaders/LottieCpp/CurveVertex.h | 2 +- .../PublicHeaders/LottieCpp/RenderTreeNode.h | 8 +-- .../PublicHeaders/LottieCpp/Vectors.h | 54 +++++++++---------- .../PublicHeaders/LottieCpp/VectorsCocoa.h | 4 +- .../CompLayers/PreCompositionLayer.hpp | 6 +-- .../CompLayers/ShapeCompositionLayer.cpp | 26 ++++----- .../MainThreadAnimationLayer.hpp | 2 +- .../Utility/LayerTransformNode.hpp | 8 +-- .../Nodes/Text/TextAnimatorNode.hpp | 12 ++--- .../Private/Utility/Primitives/BezierPath.cpp | 4 +- .../Lottie/Public/Primitives/CALayer.hpp | 6 +-- .../Lottie/Public/Primitives/CGPath.cpp | 8 +-- .../Lottie/Public/Primitives/CGPath.mm | 2 +- .../Lottie/Public/Primitives/Vectors.mm | 28 +++++----- 26 files changed, 127 insertions(+), 127 deletions(-) diff --git a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/Canvas.h b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/Canvas.h index 9eb9bc90d6..25fbffc6da 100644 --- a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/Canvas.h +++ b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/Canvas.h @@ -81,7 +81,7 @@ public: virtual void setAlpha(float alpha) = 0; - virtual void concatenate(lottie::CATransform3D const &transform) = 0; + virtual void concatenate(lottie::Transform3D const &transform) = 0; virtual void draw(std::shared_ptr const &other, lottie::CGRect const &rect) = 0; }; diff --git a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/CoreGraphicsCanvasImpl.h b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/CoreGraphicsCanvasImpl.h index 3a4176ba0d..b7139a8e8f 100644 --- a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/CoreGraphicsCanvasImpl.h +++ b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/CoreGraphicsCanvasImpl.h @@ -40,7 +40,7 @@ public: virtual void fill(lottie::CGRect const &rect, lottie::Color const &fillColor) override; virtual void setBlendMode(BlendMode blendMode) override; virtual void setAlpha(float alpha) override; - virtual void concatenate(lottie::CATransform3D const &transform) override; + virtual void concatenate(lottie::Transform3D const &transform) override; virtual std::shared_ptr makeImage() const; virtual void draw(std::shared_ptr const &other, lottie::CGRect const &rect) override; diff --git a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/CoreGraphicsCanvasImpl.mm b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/CoreGraphicsCanvasImpl.mm index d9fd69f65c..ef9089971f 100644 --- a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/CoreGraphicsCanvasImpl.mm +++ b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/CoreGraphicsCanvasImpl.mm @@ -509,7 +509,7 @@ void CanvasImpl::setAlpha(float alpha) { CGContextSetAlpha(_context, alpha); } -void CanvasImpl::concatenate(lottie::CATransform3D const &transform) { +void CanvasImpl::concatenate(lottie::Transform3D const &transform) { CGContextConcatCTM(_context, CATransform3DGetAffineTransform(nativeTransform(transform))); } diff --git a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/NullCanvasImpl.h b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/NullCanvasImpl.h index 92e930e316..faba71da5a 100644 --- a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/NullCanvasImpl.h +++ b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/NullCanvasImpl.h @@ -30,7 +30,7 @@ public: virtual void setAlpha(float alpha) override; - virtual void concatenate(lottie::CATransform3D const &transform) override; + virtual void concatenate(lottie::Transform3D const &transform) override; virtual void draw(std::shared_ptr const &other, lottie::CGRect const &rect) override; @@ -39,7 +39,7 @@ public: private: float _width = 0.0f; float _height = 0.0f; - lottie::CATransform3D _transform; + lottie::Transform3D _transform; }; } diff --git a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/NullCanvasImpl.mm b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/NullCanvasImpl.mm index 29d14e03ed..1b2cb78bfd 100644 --- a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/NullCanvasImpl.mm +++ b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/NullCanvasImpl.mm @@ -12,7 +12,7 @@ void addEnumeratedPath(CanvasPathEnumerator const &enumeratePath) { } NullCanvasImpl::NullCanvasImpl(int width, int height) : -_width(width), _height(height), _transform(lottie::CATransform3D::identity()) { +_width(width), _height(height), _transform(lottie::Transform3D::identity()) { } NullCanvasImpl::~NullCanvasImpl() { @@ -69,7 +69,7 @@ void NullCanvasImpl::setBlendMode(BlendMode blendMode) { void NullCanvasImpl::setAlpha(float alpha) { } -void NullCanvasImpl::concatenate(lottie::CATransform3D const &transform) { +void NullCanvasImpl::concatenate(lottie::Transform3D const &transform) { } void NullCanvasImpl::draw(std::shared_ptr const &other, lottie::CGRect const &rect) { diff --git a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/SoftwareLottieRenderer.mm b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/SoftwareLottieRenderer.mm index aa4005b252..def813ef48 100644 --- a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/SoftwareLottieRenderer.mm +++ b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/SoftwareLottieRenderer.mm @@ -15,17 +15,17 @@ static constexpr float minGlobalRectCalculationSize = 200.0f; struct TransformedPath { lottie::BezierPath path; - lottie::CATransform3D transform; + lottie::Transform3D transform; - TransformedPath(lottie::BezierPath const &path_, lottie::CATransform3D const &transform_) : + TransformedPath(lottie::BezierPath const &path_, lottie::Transform3D const &transform_) : path(path_), transform(transform_) { } }; -static lottie::CGRect collectPathBoundingBoxes(std::shared_ptr item, size_t subItemLimit, lottie::CATransform3D const &parentTransform, bool skipApplyTransform, lottie::BezierPathsBoundingBoxContext &bezierPathsBoundingBoxContext) { +static lottie::CGRect collectPathBoundingBoxes(std::shared_ptr item, size_t subItemLimit, lottie::Transform3D const &parentTransform, bool skipApplyTransform, lottie::BezierPathsBoundingBoxContext &bezierPathsBoundingBoxContext) { //TODO:remove skipApplyTransform - lottie::CATransform3D effectiveTransform = parentTransform; + lottie::Transform3D effectiveTransform = parentTransform; if (!skipApplyTransform && item->isGroup) { effectiveTransform = item->transform * effectiveTransform; } @@ -56,9 +56,9 @@ static lottie::CGRect collectPathBoundingBoxes(std::shared_ptr item, size_t subItemLimit, lottie::CATransform3D const &parentTransform, bool skipApplyTransform, std::function const &onPath) { +static void enumeratePaths(std::shared_ptr item, size_t subItemLimit, lottie::Transform3D const &parentTransform, bool skipApplyTransform, std::function const &onPath) { //TODO:remove skipApplyTransform - lottie::CATransform3D effectiveTransform = parentTransform; + lottie::Transform3D effectiveTransform = parentTransform; if (!skipApplyTransform && item->isGroup) { effectiveTransform = item->transform * effectiveTransform; } @@ -80,14 +80,14 @@ static void enumeratePaths(std::shared_ptr it namespace lottie { -static std::optional getRenderContentItemGlobalRect(std::shared_ptr const &contentItem, lottie::Vector2D const &globalSize, lottie::CATransform3D const &parentTransform, BezierPathsBoundingBoxContext &bezierPathsBoundingBoxContext) { +static std::optional getRenderContentItemGlobalRect(std::shared_ptr const &contentItem, lottie::Vector2D const &globalSize, lottie::Transform3D const &parentTransform, BezierPathsBoundingBoxContext &bezierPathsBoundingBoxContext) { auto currentTransform = parentTransform; - CATransform3D localTransform = contentItem->transform; + Transform3D localTransform = contentItem->transform; currentTransform = localTransform * currentTransform; std::optional globalRect; for (const auto &shadingVariant : contentItem->shadings) { - lottie::CGRect shapeBounds = collectPathBoundingBoxes(contentItem, shadingVariant->subItemLimit, lottie::CATransform3D::identity(), true, bezierPathsBoundingBoxContext); + lottie::CGRect shapeBounds = collectPathBoundingBoxes(contentItem, shadingVariant->subItemLimit, lottie::Transform3D::identity(), true, bezierPathsBoundingBoxContext); if (shadingVariant->stroke) { shapeBounds = shapeBounds.insetBy(-shadingVariant->stroke->lineWidth / 2.0, -shadingVariant->stroke->lineWidth / 2.0); @@ -128,14 +128,14 @@ static std::optional getRenderContentItemGlobalRect(std::shared_ptr getRenderNodeGlobalRect(std::shared_ptr const &node, lottie::Vector2D const &globalSize, lottie::CATransform3D const &parentTransform, bool isInvertedMatte, BezierPathsBoundingBoxContext &bezierPathsBoundingBoxContext) { +static std::optional getRenderNodeGlobalRect(std::shared_ptr const &node, lottie::Vector2D const &globalSize, lottie::Transform3D const &parentTransform, bool isInvertedMatte, BezierPathsBoundingBoxContext &bezierPathsBoundingBoxContext) { if (node->isHidden() || node->alpha() < minVisibleAlpha) { return std::nullopt; } auto currentTransform = parentTransform; Vector2D localTranslation(node->position().x + -node->bounds().x, node->position().y + -node->bounds().y); - CATransform3D localTransform = node->transform(); + Transform3D localTransform = node->transform(); localTransform = localTransform.translated(localTranslation); currentTransform = localTransform * currentTransform; @@ -181,9 +181,9 @@ static std::optional getRenderNodeGlobalRect(std::shared_ptr const &parentContext, std::shared_ptr item, float parentAlpha, lottie::Vector2D const &globalSize, lottie::CATransform3D const &parentTransform, lottie::BezierPathsBoundingBoxContext &bezierPathsBoundingBoxContext) { +static void drawLottieContentItem(std::shared_ptr const &parentContext, std::shared_ptr item, float parentAlpha, lottie::Vector2D const &globalSize, lottie::Transform3D const &parentTransform, lottie::BezierPathsBoundingBoxContext &bezierPathsBoundingBoxContext) { auto currentTransform = parentTransform; - lottie::CATransform3D localTransform = item->transform; + lottie::Transform3D localTransform = item->transform; currentTransform = localTransform * currentTransform; float normalizedOpacity = item->alpha; @@ -217,7 +217,7 @@ static void drawLottieContentItem(std::shared_ptr const tempContext = tempContextValue; currentContext = &tempContext; - (*currentContext)->concatenate(lottie::CATransform3D::identity().translated(lottie::Vector2D(-globalRect->x, -globalRect->y))); + (*currentContext)->concatenate(lottie::Transform3D::identity().translated(lottie::Vector2D(-globalRect->x, -globalRect->y))); (*currentContext)->saveState(); (*currentContext)->concatenate(currentTransform); @@ -270,7 +270,7 @@ static void drawLottieContentItem(std::shared_ptr const }; } else { iteratePaths = [&](std::function iterate) { - enumeratePaths(item, shading->subItemLimit, lottie::CATransform3D::identity(), true, [&](lottie::BezierPath const &sourcePath, lottie::CATransform3D const &transform) { + enumeratePaths(item, shading->subItemLimit, lottie::Transform3D::identity(), true, [&](lottie::BezierPath const &sourcePath, lottie::Transform3D const &transform) { auto path = sourcePath.copyUsingTransform(transform); lottieRendering::PathCommand pathCommand; @@ -458,7 +458,7 @@ static void drawLottieContentItem(std::shared_ptr const parentContext->restoreState(); } -static void renderLottieRenderNode(std::shared_ptr node, std::shared_ptr const &parentContext, lottie::Vector2D const &globalSize, lottie::CATransform3D const &parentTransform, float parentAlpha, bool isInvertedMatte, lottie::BezierPathsBoundingBoxContext &bezierPathsBoundingBoxContext) { +static void renderLottieRenderNode(std::shared_ptr node, std::shared_ptr const &parentContext, lottie::Vector2D const &globalSize, lottie::Transform3D const &parentTransform, float parentAlpha, bool isInvertedMatte, lottie::BezierPathsBoundingBoxContext &bezierPathsBoundingBoxContext) { float normalizedOpacity = node->alpha(); float layerAlpha = ((float)normalizedOpacity) * parentAlpha; @@ -468,7 +468,7 @@ static void renderLottieRenderNode(std::shared_ptr node, auto currentTransform = parentTransform; lottie::Vector2D localTranslation(node->position().x + -node->bounds().x, node->position().y + -node->bounds().y); - lottie::CATransform3D localTransform = node->transform(); + lottie::Transform3D localTransform = node->transform(); localTransform = localTransform.translated(localTranslation); currentTransform = localTransform * currentTransform; @@ -511,7 +511,7 @@ static void renderLottieRenderNode(std::shared_ptr node, if ((node->mask() && !node->mask()->isHidden() && node->mask()->alpha() >= minVisibleAlpha) || masksToBounds) { auto maskBackingStorage = parentContext->makeLayer((int)(globalRect->width), (int)(globalRect->height)); - maskBackingStorage->concatenate(lottie::CATransform3D::identity().translated(lottie::Vector2D(-globalRect->x, -globalRect->y))); + maskBackingStorage->concatenate(lottie::Transform3D::identity().translated(lottie::Vector2D(-globalRect->x, -globalRect->y))); maskBackingStorage->concatenate(currentTransform); if (masksToBounds) { @@ -528,7 +528,7 @@ static void renderLottieRenderNode(std::shared_ptr node, tempContext = tempContextValue; currentContext = tempContextValue; - currentContext->concatenate(lottie::CATransform3D::identity().translated(lottie::Vector2D(-globalRect->x, -globalRect->y))); + currentContext->concatenate(lottie::Transform3D::identity().translated(lottie::Vector2D(-globalRect->x, -globalRect->y))); currentContext->saveState(); currentContext->concatenate(currentTransform); @@ -536,8 +536,8 @@ static void renderLottieRenderNode(std::shared_ptr node, currentContext = parentContext; } - parentContext->concatenate(lottie::CATransform3D::identity().translated(lottie::Vector2D(node->position().x, node->position().y))); - parentContext->concatenate(lottie::CATransform3D::identity().translated(lottie::Vector2D(-node->bounds().x, -node->bounds().y))); + parentContext->concatenate(lottie::Transform3D::identity().translated(lottie::Vector2D(node->position().x, node->position().y))); + parentContext->concatenate(lottie::Transform3D::identity().translated(lottie::Vector2D(-node->bounds().x, -node->bounds().y))); parentContext->concatenate(node->transform()); float renderAlpha = 1.0; @@ -608,13 +608,13 @@ CGRect getPathNativeBoundingBox(CGPathRef _Nonnull path) { return nil; } - lottie::CATransform3D rootTransform = lottie::CATransform3D::identity().scaled(lottie::Vector2D(size.width / (float)animation.size.width, size.height / (float)animation.size.height)); + lottie::Transform3D rootTransform = lottie::Transform3D::identity().scaled(lottie::Vector2D(size.width / (float)animation.size.width, size.height / (float)animation.size.height)); if (useReferenceRendering) { auto context = std::make_shared((int)size.width, (int)size.height); CGPoint scale = CGPointMake(size.width / (CGFloat)animation.size.width, size.height / (CGFloat)animation.size.height); - context->concatenate(lottie::CATransform3D::makeScale(scale.x, scale.y, 1.0)); + context->concatenate(lottie::Transform3D::makeScale(scale.x, scale.y, 1.0)); renderLottieRenderNode(renderNode, context, lottie::Vector2D(context->width(), context->height()), rootTransform, 1.0, false, *_bezierPathsBoundingBoxContext.get()); @@ -626,7 +626,7 @@ CGRect getPathNativeBoundingBox(CGPathRef _Nonnull path) { auto context = std::make_shared((int)size.width, (int)size.height); CGPoint scale = CGPointMake(size.width / (CGFloat)animation.size.width, size.height / (CGFloat)animation.size.height); - context->concatenate(lottie::CATransform3D::makeScale(scale.x, scale.y, 1.0)); + context->concatenate(lottie::Transform3D::makeScale(scale.x, scale.y, 1.0)); renderLottieRenderNode(renderNode, context, lottie::Vector2D(context->width(), context->height()), rootTransform, 1.0, false, *_bezierPathsBoundingBoxContext.get()); diff --git a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/ThorVGCanvasImpl.h b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/ThorVGCanvasImpl.h index 2e822f7ffc..b3550f2247 100644 --- a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/ThorVGCanvasImpl.h +++ b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/ThorVGCanvasImpl.h @@ -32,7 +32,7 @@ public: virtual void setAlpha(float alpha) override; - virtual void concatenate(lottie::CATransform3D const &transform) override; + virtual void concatenate(lottie::Transform3D const &transform) override; virtual void draw(std::shared_ptr const &other, lottie::CGRect const &rect) override; @@ -52,8 +52,8 @@ private: std::unique_ptr _canvas; float _alpha = 1.0; - lottie::CATransform3D _transform; - std::vector _stateStack; + lottie::Transform3D _transform; + std::vector _stateStack; int _bytesPerRow = 0; uint32_t *_backingData = nullptr; int _statsNumStrokes = 0; diff --git a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/ThorVGCanvasImpl.mm b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/ThorVGCanvasImpl.mm index 4573881392..bd8e3d9b6f 100644 --- a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/ThorVGCanvasImpl.mm +++ b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/ThorVGCanvasImpl.mm @@ -27,7 +27,7 @@ void tvgPath(CanvasPathEnumerator const &enumeratePath, tvg::Shape *shape) { }); } -tvg::Matrix tvgTransform(lottie::CATransform3D const &transform) { +tvg::Matrix tvgTransform(lottie::Transform3D const &transform) { CGAffineTransform affineTransform = CATransform3DGetAffineTransform(lottie::nativeTransform(transform)); tvg::Matrix result; result.e11 = affineTransform.a; @@ -45,7 +45,7 @@ tvg::Matrix tvgTransform(lottie::CATransform3D const &transform) { } ThorVGCanvasImpl::ThorVGCanvasImpl(int width, int height) : -_width(width), _height(height), _transform(lottie::CATransform3D::identity()) { +_width(width), _height(height), _transform(lottie::Transform3D::identity()) { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ tvg::Initializer::init(0); @@ -259,7 +259,7 @@ void ThorVGCanvasImpl::setAlpha(float alpha) { _alpha = alpha; } -void ThorVGCanvasImpl::concatenate(lottie::CATransform3D const &transform) { +void ThorVGCanvasImpl::concatenate(lottie::Transform3D const &transform) { _transform = transform * _transform; /*_canvas->concat(SkM44( transform.m11, transform.m21, transform.m31, transform.m41, diff --git a/Tests/LottieMetalTest/Sources/ViewController.swift b/Tests/LottieMetalTest/Sources/ViewController.swift index 2efe5e5fbf..5bb4863b6a 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) } diff --git a/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/BezierPath.h b/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/BezierPath.h index 7fa0b83ffe..2fd05533e4 100644 --- a/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/BezierPath.h +++ b/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/BezierPath.h @@ -122,7 +122,7 @@ public: std::optional const &closed() const; void setClosed(std::optional const &closed); std::shared_ptr cgPath() const; - BezierPath copyUsingTransform(CATransform3D const &transform) const; + BezierPath copyUsingTransform(Transform3D const &transform) const; public: BezierPath(std::shared_ptr contents); diff --git a/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/CGPath.h b/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/CGPath.h index d7e445e635..4288688ab8 100644 --- a/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/CGPath.h +++ b/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/CGPath.h @@ -57,7 +57,7 @@ public: virtual bool empty() const = 0; - virtual std::shared_ptr copyUsingTransform(CATransform3D const &transform) const = 0; + virtual std::shared_ptr copyUsingTransform(Transform3D const &transform) const = 0; virtual void addLineTo(Vector2D const &point) = 0; virtual void addCurveTo(Vector2D const &point, Vector2D const &control1, Vector2D const &control2) = 0; @@ -71,7 +71,7 @@ public: virtual bool isEqual(CGPath *other) const = 0; }; -Vector2D transformVector(Vector2D const &v, CATransform3D const &m); +Vector2D transformVector(Vector2D const &v, Transform3D const &m); } diff --git a/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/CGPathCocoa.h b/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/CGPathCocoa.h index bf80eea07b..5626825a62 100644 --- a/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/CGPathCocoa.h +++ b/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/CGPathCocoa.h @@ -22,7 +22,7 @@ public: virtual bool empty() const override; - virtual std::shared_ptr copyUsingTransform(CATransform3D const &transform) const override; + virtual std::shared_ptr copyUsingTransform(Transform3D const &transform) const override; virtual void addLineTo(Vector2D const &point) override; virtual void addCurveTo(Vector2D const &point, Vector2D const &control1, Vector2D const &control2) override; diff --git a/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/CurveVertex.h b/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/CurveVertex.h index 5b15a6eeab..4f5a8a28d5 100644 --- a/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/CurveVertex.h +++ b/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/CurveVertex.h @@ -64,7 +64,7 @@ public: return CurveVertex(point + translation, inTangent + translation, outTangent + translation, false); } - CurveVertex transformed(CATransform3D const &transform) const { + CurveVertex transformed(Transform3D const &transform) const { return CurveVertex(transformVector(point, transform), transformVector(inTangent, transform), transformVector(outTangent, transform), false); } diff --git a/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/RenderTreeNode.h b/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/RenderTreeNode.h index 5ca3ed4bae..5dec74814f 100644 --- a/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/RenderTreeNode.h +++ b/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/RenderTreeNode.h @@ -364,7 +364,7 @@ public: public: bool isGroup = false; - CATransform3D transform = CATransform3D::identity(); + Transform3D transform = Transform3D::identity(); float alpha = 0.0; std::optional trimParams; std::shared_ptr path; @@ -393,7 +393,7 @@ public: RenderTreeNode( CGRect bounds_, Vector2D position_, - CATransform3D transform_, + Transform3D transform_, float alpha_, bool masksToBounds_, bool isHidden_, @@ -427,7 +427,7 @@ public: return _position; } - CATransform3D const &transform() const { + Transform3D const &transform() const { return _transform; } @@ -458,7 +458,7 @@ public: public: CGRect _bounds; Vector2D _position; - CATransform3D _transform = CATransform3D::identity(); + Transform3D _transform = Transform3D::identity(); float _alpha = 1.0f; bool _masksToBounds = false; bool _isHidden = false; diff --git a/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/Vectors.h b/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/Vectors.h index 4f42fe9407..14029225d0 100644 --- a/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/Vectors.h +++ b/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/Vectors.h @@ -148,13 +148,13 @@ inline float radiansToDegrees(float value) { return value * 180.0f / M_PI; } -struct CATransform3D { +struct Transform3D { float m11, m12, m13, m14; float m21, m22, m23, m24; float m31, m32, m33, m34; float m41, m42, m43, m44; - CATransform3D( + Transform3D( float m11_, float m12_, float m13_, float m14_, float m21_, float m22_, float m23_, float m24_, float m31_, float m32_, float m33_, float m34_, @@ -166,14 +166,14 @@ struct CATransform3D { m41(m41_), m42(m42_), m43(m43_), m44(m44_) { } - bool operator==(CATransform3D const &rhs) const { + bool operator==(Transform3D const &rhs) const { return m11 == rhs.m11 && m12 == rhs.m12 && m13 == rhs.m13 && m14 == rhs.m14 && m21 == rhs.m21 && m22 == rhs.m22 && m23 == rhs.m23 && m24 == rhs.m24 && m31 == rhs.m31 && m32 == rhs.m32 && m33 == rhs.m33 && m34 == rhs.m34 && m41 == rhs.m41 && m42 == rhs.m42 && m43 == rhs.m43 && m44 == rhs.m44; } - bool operator!=(CATransform3D const &rhs) const { + bool operator!=(Transform3D const &rhs) const { return !(*this == rhs); } @@ -184,8 +184,8 @@ struct CATransform3D { m41 == 0.0 && m42 == 0.0 && m43 == 0.0 && m44 == 1.0; } - static CATransform3D makeTranslation(float tx, float ty, float tz) { - return CATransform3D( + static Transform3D makeTranslation(float tx, float ty, float tz) { + return Transform3D( 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, @@ -193,8 +193,8 @@ struct CATransform3D { ); } - static CATransform3D makeScale(float sx, float sy, float sz) { - return CATransform3D( + static Transform3D makeScale(float sx, float sy, float sz) { + return Transform3D( sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, @@ -202,14 +202,14 @@ struct CATransform3D { ); } - static CATransform3D makeRotation(float radians, float x, float y, float z); + static Transform3D makeRotation(float radians, float x, float y, float z); - static CATransform3D makeSkew(float skew, float skewAxis) { + static Transform3D makeSkew(float skew, float skewAxis) { float mCos = cos(degreesToRadians(skewAxis)); float mSin = sin(degreesToRadians(skewAxis)); float aTan = tan(degreesToRadians(skew)); - CATransform3D transform1( + Transform3D transform1( mCos, mSin, 0.0, @@ -228,7 +228,7 @@ struct CATransform3D { 1.0 ); - CATransform3D transform2( + Transform3D transform2( 1.0, 0.0, 0.0, @@ -247,7 +247,7 @@ struct CATransform3D { 1.0 ); - CATransform3D transform3( + Transform3D transform3( mCos, -mSin, 0.0, @@ -269,7 +269,7 @@ struct CATransform3D { return transform3 * transform2 * transform1; } - static CATransform3D makeTransform( + static Transform3D makeTransform( Vector2D const &anchor, Vector2D const &position, Vector2D const &scale, @@ -277,38 +277,38 @@ struct CATransform3D { std::optional skew, std::optional skewAxis ) { - CATransform3D result = CATransform3D::identity(); + Transform3D result = Transform3D::identity(); if (skew.has_value() && skewAxis.has_value()) { - result = CATransform3D::identity().translated(position).rotated(rotation).skewed(-skew.value(), skewAxis.value()).scaled(Vector2D(scale.x * 0.01, scale.y * 0.01)).translated(Vector2D(-anchor.x, -anchor.y)); + result = Transform3D::identity().translated(position).rotated(rotation).skewed(-skew.value(), skewAxis.value()).scaled(Vector2D(scale.x * 0.01, scale.y * 0.01)).translated(Vector2D(-anchor.x, -anchor.y)); } else { - result = CATransform3D::identity().translated(position).rotated(rotation).scaled(Vector2D(scale.x * 0.01, scale.y * 0.01)).translated(Vector2D(-anchor.x, -anchor.y)); + result = Transform3D::identity().translated(position).rotated(rotation).scaled(Vector2D(scale.x * 0.01, scale.y * 0.01)).translated(Vector2D(-anchor.x, -anchor.y)); } return result; } - CATransform3D rotated(float degrees) const; + Transform3D rotated(float degrees) const; - CATransform3D translated(Vector2D const &translation) const; + Transform3D translated(Vector2D const &translation) const; - CATransform3D scaled(Vector2D const &scale) const; + Transform3D scaled(Vector2D const &scale) const; - CATransform3D skewed(float skew, float skewAxis) const { - return CATransform3D::makeSkew(skew, skewAxis) * (*this); + Transform3D skewed(float skew, float skewAxis) const { + return Transform3D::makeSkew(skew, skewAxis) * (*this); } - static CATransform3D const &identity() { + static Transform3D const &identity() { return _identity; } - CATransform3D operator*(CATransform3D const &b) const; + Transform3D operator*(Transform3D const &b) const; bool isInvertible() const; - CATransform3D inverted() const; + Transform3D inverted() const; private: - static CATransform3D _identity; + static Transform3D _identity; }; struct CGRect { @@ -359,7 +359,7 @@ struct CGRect { CGRect intersection(CGRect const &other) const; CGRect unionWith(CGRect const &other) const; - CGRect applyingTransform(CATransform3D const &transform) const; + CGRect applyingTransform(Transform3D const &transform) const; }; inline bool isInRangeOrEqual(float value, float from, float to) { diff --git a/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/VectorsCocoa.h b/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/VectorsCocoa.h index d706e3643b..bf8083f45b 100644 --- a/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/VectorsCocoa.h +++ b/submodules/TelegramUI/Components/LottieCpp/PublicHeaders/LottieCpp/VectorsCocoa.h @@ -7,8 +7,8 @@ namespace lottie { -::CATransform3D nativeTransform(CATransform3D const &value); -CATransform3D fromNativeTransform(::CATransform3D const &value); +::CATransform3D nativeTransform(Transform3D const &value); +Transform3D fromNativeTransform(::CATransform3D const &value); } diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.hpp index f2047a4f34..e1538ec1a9 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.hpp @@ -123,7 +123,7 @@ public: auto renderTreeContentItem = std::make_shared( CGRect(0.0, 0.0, 0.0, 0.0), Vector2D(0.0, 0.0), - CATransform3D::identity(), + Transform3D::identity(), 1.0, false, false, @@ -138,7 +138,7 @@ public: _contentsTreeNode = std::make_shared( CGRect(0.0, 0.0, 0.0, 0.0), Vector2D(0.0, 0.0), - CATransform3D::identity(), + Transform3D::identity(), 1.0, false, false, @@ -162,7 +162,7 @@ public: _renderTreeNode = std::make_shared( CGRect(0.0, 0.0, 0.0, 0.0), Vector2D(0.0, 0.0), - CATransform3D::identity(), + Transform3D::identity(), 1.0, false, false, 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 f6419d098d..7f3968b1c8 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 @@ -492,9 +492,9 @@ public: struct TransformedPath { BezierPath path; - CATransform3D transform; + Transform3D transform; - TransformedPath(BezierPath const &path_, CATransform3D const &transform_) : + TransformedPath(BezierPath const &path_, Transform3D const &transform_) : path(path_), transform(transform_) { } @@ -853,13 +853,13 @@ public: _opacityValue = 1.0; } - _transformValue = CATransform3D::identity().translated(Vector2D(positionValue.x, positionValue.y)).rotated(rotationValue).skewed(-skewValue, skewAxisValue).scaled(Vector2D(scaleValue.x * 0.01, scaleValue.y * 0.01)).translated(Vector2D(-anchorValue.x, -anchorValue.y)); + _transformValue = Transform3D::identity().translated(Vector2D(positionValue.x, positionValue.y)).rotated(rotationValue).skewed(-skewValue, skewAxisValue).scaled(Vector2D(scaleValue.x * 0.01, scaleValue.y * 0.01)).translated(Vector2D(-anchorValue.x, -anchorValue.y)); hasValidData = true; } } - CATransform3D const &transform() { + Transform3D const &transform() { return _transformValue; } @@ -878,7 +878,7 @@ public: std::unique_ptr> _skewAxis; std::unique_ptr> _opacity; - CATransform3D _transformValue = CATransform3D::identity(); + Transform3D _transformValue = Transform3D::identity(); float _opacityValue = 1.0; }; @@ -910,11 +910,11 @@ public: std::shared_ptr _contentItem; private: - std::vector collectPaths(size_t subItemLimit, CATransform3D const &parentTransform, bool skipApplyTransform) { + std::vector collectPaths(size_t subItemLimit, Transform3D const &parentTransform, bool skipApplyTransform) { std::vector mappedPaths; //TODO:remove skipApplyTransform - CATransform3D effectiveTransform = parentTransform; + Transform3D effectiveTransform = parentTransform; if (!skipApplyTransform && isGroup && transform) { effectiveTransform = transform->transform() * effectiveTransform; } @@ -942,7 +942,7 @@ public: } CompoundBezierPath trimmedPath = trimCompoundPath(tempPath, currentTrim->start, currentTrim->end, currentTrim->offset, currentTrim->type); for (auto &path : trimmedPath.paths) { - mappedPaths.emplace_back(path, CATransform3D::identity()); + mappedPaths.emplace_back(path, Transform3D::identity()); } } else { for (auto &path : subItemPaths) { @@ -1061,7 +1061,7 @@ public: } void updateContents(std::optional parentTrim) { - CATransform3D containerTransform = CATransform3D::identity(); + Transform3D containerTransform = Transform3D::identity(); float containerOpacity = 1.0; if (transform) { containerTransform = transform->transform(); @@ -1089,7 +1089,7 @@ public: if (parentTrim) { CompoundBezierPath compoundPath; - auto paths = collectPaths(shadingVariant.subItemLimit, CATransform3D::identity(), true); + auto paths = collectPaths(shadingVariant.subItemLimit, Transform3D::identity(), true); for (const auto &path : paths) { compoundPath.appendPath(path.path.copyUsingTransform(path.transform)); } @@ -1104,7 +1104,7 @@ public: } else { if (hasTrims()) { CompoundBezierPath compoundPath; - auto paths = collectPaths(shadingVariant.subItemLimit, CATransform3D::identity(), true); + auto paths = collectPaths(shadingVariant.subItemLimit, Transform3D::identity(), true); for (const auto &path : paths) { compoundPath.appendPath(path.path.copyUsingTransform(path.transform)); } @@ -1325,7 +1325,7 @@ std::shared_ptr ShapeCompositionLayer::renderTreeNode(BezierPath _contentRenderTreeNode = std::make_shared( CGRect(0.0, 0.0, 0.0, 0.0), Vector2D(0.0, 0.0), - CATransform3D::identity(), + Transform3D::identity(), 1.0, false, false, @@ -1351,7 +1351,7 @@ std::shared_ptr ShapeCompositionLayer::renderTreeNode(BezierPath _renderTreeNode = std::make_shared( CGRect(0.0, 0.0, 0.0, 0.0), Vector2D(0.0, 0.0), - CATransform3D::identity(), + Transform3D::identity(), 1.0, false, false, diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/MainThreadAnimationLayer.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/MainThreadAnimationLayer.hpp index 5a8467e0b0..2d080d80d6 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/MainThreadAnimationLayer.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/MainThreadAnimationLayer.hpp @@ -239,7 +239,7 @@ public: _renderTreeNode = std::make_shared( bounds(), position(), - CATransform3D::identity(), + Transform3D::identity(), 1.0, false, false, diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.hpp index d064a16782..79c9950b2a 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.hpp @@ -157,7 +157,7 @@ public: Vector3D anchor = _transformProperties->anchor()->value(); Vector3D scale = _transformProperties->scale()->value(); - _localTransform = CATransform3D::makeTransform( + _localTransform = Transform3D::makeTransform( Vector2D(anchor.x, anchor.y), position, Vector2D(scale.x, scale.y), @@ -181,7 +181,7 @@ public: return _opacity; } - CATransform3D const &globalTransform() { + Transform3D const &globalTransform() { return _globalTransform; } @@ -191,8 +191,8 @@ private: std::shared_ptr _transformProperties; float _opacity = 1.0; - CATransform3D _localTransform = CATransform3D::identity(); - CATransform3D _globalTransform = CATransform3D::identity(); + Transform3D _localTransform = Transform3D::identity(); + Transform3D _globalTransform = Transform3D::identity(); public: virtual LayerTransformNode *asLayerTransformNode() override { diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.hpp index d5f6e2556a..dc252f6102 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.hpp @@ -93,7 +93,7 @@ public: return _childKeypaths; } - CATransform3D caTransform() { + Transform3D caTransform() { Vector2D anchor = Vector2D::Zero(); if (_anchor) { auto anchor3d = _anchor->value(); @@ -126,7 +126,7 @@ public: skewAxis = _skewAxis->value().value; } - return CATransform3D::makeTransform( + return Transform3D::makeTransform( anchor, position, scale, @@ -212,16 +212,16 @@ public: return _parentTextNode; } - CATransform3D xform() { + Transform3D xform() { if (_xform.has_value()) { return _xform.value(); } else if (_parentTextNode) { return _parentTextNode->xform(); } else { - return CATransform3D::identity(); + return Transform3D::identity(); } } - void setXform(CATransform3D const &xform) { + void setXform(Transform3D const &xform) { _xform = xform; } @@ -312,7 +312,7 @@ private: std::shared_ptr _outputPath; - std::optional _xform; + std::optional _xform; std::optional _opacity; std::optional _strokeColor; std::optional _fillColor; diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Utility/Primitives/BezierPath.cpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Utility/Primitives/BezierPath.cpp index 44240211e7..2ab088e42a 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Utility/Primitives/BezierPath.cpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Utility/Primitives/BezierPath.cpp @@ -486,8 +486,8 @@ std::shared_ptr BezierPath::cgPath() const { return _contents->cgPath(); } -BezierPath BezierPath::copyUsingTransform(CATransform3D const &transform) const { - if (transform == CATransform3D::identity()) { +BezierPath BezierPath::copyUsingTransform(Transform3D const &transform) const { + if (transform == Transform3D::identity()) { return (*this); } BezierPath result; diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/CALayer.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/CALayer.hpp index dbc7006416..5a26454a94 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/CALayer.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/CALayer.hpp @@ -89,10 +89,10 @@ public: return bounds(); } - CATransform3D const &transform() const { + Transform3D const &transform() const { return _transform; } - void setTransform(CATransform3D const &transform) { + void setTransform(Transform3D const &transform) { _transform = transform; } @@ -145,7 +145,7 @@ private: float _opacity = 1.0; Vector2D _position = Vector2D(0.0, 0.0); CGRect _bounds = CGRect(0.0, 0.0, 0.0, 0.0); - CATransform3D _transform = CATransform3D::identity(); + Transform3D _transform = Transform3D::identity(); std::shared_ptr _mask; bool _masksToBounds = false; std::optional _compositingFilter; diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/CGPath.cpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/CGPath.cpp index 9b174bed67..d1cf338111 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/CGPath.cpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/CGPath.cpp @@ -35,7 +35,7 @@ void addPointToBoundingRect(bool *isFirst, CGRect *rect, Vector2D const *point) } -Vector2D transformVector(Vector2D const &v, CATransform3D const &m) { +Vector2D transformVector(Vector2D const &v, Transform3D const &m) { return Vector2D( m.m11 * v.x + m.m21 * v.y + m.m41 * 1.0, m.m12 * v.x + m.m22 * v.y + m.m42 * 1.0 @@ -51,7 +51,7 @@ public: virtual bool empty() const override; - virtual std::shared_ptr copyUsingTransform(CATransform3D const &transform) const override; + virtual std::shared_ptr copyUsingTransform(Transform3D const &transform) const override; virtual void addLineTo(Vector2D const &point) override; virtual void addCurveTo(Vector2D const &point, Vector2D const &control1, Vector2D const &control2) override; @@ -108,10 +108,10 @@ bool CGPathImpl::empty() const { return _items.empty(); } -std::shared_ptr CGPathImpl::copyUsingTransform(CATransform3D const &transform) const { +std::shared_ptr CGPathImpl::copyUsingTransform(Transform3D const &transform) const { auto result = std::make_shared(); - if (transform == CATransform3D::identity()) { + if (transform == Transform3D::identity()) { result->_items = _items; return result; } diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/CGPath.mm b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/CGPath.mm index e80342007f..ab13e06922 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/CGPath.mm +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/CGPath.mm @@ -92,7 +92,7 @@ bool CGPathCocoaImpl::empty() const { return CGPathIsEmpty(_path); } -std::shared_ptr CGPathCocoaImpl::copyUsingTransform(CATransform3D const &transform) const { +std::shared_ptr CGPathCocoaImpl::copyUsingTransform(Transform3D const &transform) const { ::CATransform3D nativeTransform; nativeTransform.m11 = transform.m11; nativeTransform.m12 = transform.m12; diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/Vectors.mm b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/Vectors.mm index 277f8f5d69..b6f8276bf7 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/Vectors.mm +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/Vectors.mm @@ -140,7 +140,7 @@ lottiejson11::Json Vector3D::toJson() const { return lottiejson11::Json(result); } -CATransform3D CATransform3D::_identity = CATransform3D( +Transform3D Transform3D::_identity = Transform3D( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, @@ -415,7 +415,7 @@ Vector2D Vector2D::interpolate( return point.point; } -::CATransform3D nativeTransform(CATransform3D const &value) { +::CATransform3D nativeTransform(Transform3D const &value) { ::CATransform3D result; result.m11 = value.m11; @@ -441,8 +441,8 @@ Vector2D Vector2D::interpolate( return result; } -CATransform3D fromNativeTransform(::CATransform3D const &value) { - CATransform3D result = CATransform3D::identity(); +Transform3D fromNativeTransform(::CATransform3D const &value) { + Transform3D result = Transform3D::identity(); result.m11 = value.m11; result.m12 = value.m12; @@ -467,7 +467,7 @@ CATransform3D fromNativeTransform(::CATransform3D const &value) { return result; } -CATransform3D CATransform3D::makeRotation(float radians, float x, float y, float z) { +Transform3D Transform3D::makeRotation(float radians, float x, float y, float z) { return fromNativeTransform(CATransform3DMakeRotation(radians, x, y, z)); /*if (x == 0.0 && y == 0.0 && z == 0.0) { @@ -505,21 +505,21 @@ CATransform3D CATransform3D::makeRotation(float radians, float x, float y, float return returnValue;*/ } -CATransform3D CATransform3D::rotated(float degrees) const { +Transform3D Transform3D::rotated(float degrees) const { return fromNativeTransform(CATransform3DRotate(nativeTransform(*this), degreesToRadians(degrees), 0.0, 0.0, 1.0)); //return CATransform3D::makeRotation(degreesToRadians(degrees), 0.0, 0.0, 1.0) * (*this); } -CATransform3D CATransform3D::translated(Vector2D const &translation) const { +Transform3D Transform3D::translated(Vector2D const &translation) const { return fromNativeTransform(CATransform3DTranslate(nativeTransform(*this), translation.x, translation.y, 0.0)); } -CATransform3D CATransform3D::scaled(Vector2D const &scale) const { +Transform3D Transform3D::scaled(Vector2D const &scale) const { return fromNativeTransform(CATransform3DScale(nativeTransform(*this), scale.x, scale.y, 1.0)); //return CATransform3D::makeScale(scale.x, scale.y, 1.0) * (*this); } -CATransform3D CATransform3D::operator*(CATransform3D const &b) const { +Transform3D Transform3D::operator*(Transform3D const &b) const { if (isIdentity()) { return b; } @@ -541,7 +541,7 @@ CATransform3D CATransform3D::operator*(CATransform3D const &b) const { }; simd_float4x4 simdResult = simd_mul(simdRhs, simdLhs); - return CATransform3D( + return Transform3D( simdResult.columns[0][0], simdResult.columns[1][0], simdResult.columns[2][0], simdResult.columns[3][0], simdResult.columns[0][1], simdResult.columns[1][1], simdResult.columns[2][1], simdResult.columns[3][1], simdResult.columns[0][2], simdResult.columns[1][2], simdResult.columns[2][2], simdResult.columns[3][2], @@ -549,11 +549,11 @@ CATransform3D CATransform3D::operator*(CATransform3D const &b) const { ); } -bool CATransform3D::isInvertible() const { +bool Transform3D::isInvertible() const { return std::abs(m11 * m22 - m12 * m21) >= 0.00000001; } -CATransform3D CATransform3D::inverted() const { +Transform3D Transform3D::inverted() const { simd_float4x4 matrix = { simd_make_float4(m11, m21, m31, m41), simd_make_float4(m12, m22, m32, m42), @@ -561,7 +561,7 @@ CATransform3D CATransform3D::inverted() const { simd_make_float4(m14, m24, m34, m44) }; simd_float4x4 result = simd_inverse(matrix); - CATransform3D nativeResult = CATransform3D( + Transform3D nativeResult = Transform3D( result.columns[0][0], result.columns[1][0], result.columns[2][0], result.columns[3][0], result.columns[0][1], result.columns[1][1], result.columns[2][1], result.columns[3][1], result.columns[0][2], result.columns[1][2], result.columns[2][2], result.columns[3][2], @@ -589,7 +589,7 @@ CGRect CGRect::unionWith(CGRect const &other) const { return CGRect(result.origin.x, result.origin.y, result.size.width, result.size.height); } -CGRect CGRect::applyingTransform(CATransform3D const &transform) const { +CGRect CGRect::applyingTransform(Transform3D const &transform) const { if (transform.isIdentity()) { return *this; }