diff --git a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/SoftwareLottieRenderer.mm b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/SoftwareLottieRenderer.mm index 3a843f08cf..738a4c02b5 100644 --- a/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/SoftwareLottieRenderer.mm +++ b/Tests/LottieMetalTest/SoftwareLottieRenderer/Sources/SoftwareLottieRenderer.mm @@ -292,13 +292,13 @@ static void processRenderTree(std::shared_ptr const &node, Vecto namespace { -static void drawLottieContentItem(std::shared_ptr parentContext, std::shared_ptr item, double parentAlpha) { +static void drawLottieContentItem(std::shared_ptr parentContext, std::shared_ptr item, float parentAlpha) { if (!item->renderData.isValid) { return; } float normalizedOpacity = item->renderData.layer.opacity(); - double layerAlpha = ((double)normalizedOpacity) * parentAlpha; + float layerAlpha = ((float)normalizedOpacity) * parentAlpha; if (item->renderData.layer.isHidden() || normalizedOpacity == 0.0f) { return; @@ -329,7 +329,7 @@ static void drawLottieContentItem(std::shared_ptr paren parentContext->concatenate(lottie::CATransform3D::identity().translated(lottie::Vector2D(-item->renderData.layer.bounds().x, -item->renderData.layer.bounds().y))); parentContext->concatenate(item->renderData.layer.transform()); - double renderAlpha = 1.0; + float renderAlpha = 1.0; if (tempContext) { renderAlpha = 1.0; } else { @@ -530,12 +530,12 @@ static void drawLottieContentItem(std::shared_ptr paren parentContext->restoreState(); } -static void renderLottieRenderNode(std::shared_ptr node, std::shared_ptr parentContext, lottie::Vector2D const &globalSize, double parentAlpha) { +static void renderLottieRenderNode(std::shared_ptr node, std::shared_ptr parentContext, lottie::Vector2D const &globalSize, float parentAlpha) { if (!node->renderData.isValid) { return; } float normalizedOpacity = node->renderData.layer.opacity(); - double layerAlpha = ((double)normalizedOpacity) * parentAlpha; + float layerAlpha = ((float)normalizedOpacity) * parentAlpha; if (node->renderData.layer.isHidden() || normalizedOpacity == 0.0f) { return; @@ -587,7 +587,7 @@ static void renderLottieRenderNode(std::shared_ptr node, parentContext->concatenate(lottie::CATransform3D::identity().translated(lottie::Vector2D(-node->renderData.layer.bounds().x, -node->renderData.layer.bounds().y))); parentContext->concatenate(node->renderData.layer.transform()); - double renderAlpha = 1.0; + float renderAlpha = 1.0; if (tempContext) { renderAlpha = 1.0; } else { @@ -661,7 +661,7 @@ CGRect getPathNativeBoundingBox(CGPathRef _Nonnull path) { 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()); + processRenderTree(renderNode, lottie::Vector2D((int)size.width, (int)size.height), lottie::CATransform3D::identity().scaled(lottie::Vector2D(size.width / (float)animation.size.width, size.height / (float)animation.size.height)), false, *_bezierPathsBoundingBoxContext.get()); if (useReferenceRendering) { auto context = std::make_shared((int)size.width, (int)size.height); diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.cpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.cpp index 0765e43a96..1a87942244 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.cpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.cpp @@ -1,7 +1,5 @@ #include "CompositionLayer.hpp" -#include "Lottie/Public/Primitives/RenderTree.hpp" - namespace lottie { InvertedMatteLayer::InvertedMatteLayer(std::shared_ptr inputMatte) : diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Animation.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Animation.hpp index f34c23aed9..ffeb67964b 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Animation.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Animation.hpp @@ -90,10 +90,10 @@ public: } } - AnimationFrameTime startFrame = getDouble(json, "ip"); - AnimationFrameTime endFrame = getDouble(json, "op"); + AnimationFrameTime startFrame = (float)getDouble(json, "ip"); + AnimationFrameTime endFrame = (float)getDouble(json, "op"); - float framerate = getDouble(json, "fr"); + float framerate = (float)getDouble(json, "fr"); int width = getInt(json, "w"); int height = getInt(json, "h"); diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Assets/ImageAsset.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Assets/ImageAsset.hpp index 134b82961e..5eea900309 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Assets/ImageAsset.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Assets/ImageAsset.hpp @@ -33,8 +33,8 @@ public: Asset(json) { name = getString(json, "p"); directory = getString(json, "u"); - width = getDouble(json, "w"); - height = getDouble(json, "h"); + width = (float)getDouble(json, "w"); + height = (float)getDouble(json, "h"); _e = getOptionalInt(json, "e"); _t = getOptionalString(json, "t"); diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Assets/PrecompAsset.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Assets/PrecompAsset.hpp index c79dca0066..af169474a7 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Assets/PrecompAsset.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Assets/PrecompAsset.hpp @@ -23,7 +23,9 @@ public: explicit PrecompAsset(lottiejson11::Json::object const &json) noexcept(false) : Asset(json) { - frameRate = getOptionalDouble(json, "fr"); + if (const auto frameRateValue = getOptionalDouble(json, "fr")) { + frameRate = (float)frameRateValue.value(); + } auto layerDictionaries = getObjectArray(json, "layers"); for (size_t i = 0; i < layerDictionaries.size(); i++) { diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Layers/LayerModel.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Layers/LayerModel.hpp index 3508400786..16f84d0f10 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Layers/LayerModel.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Layers/LayerModel.hpp @@ -71,9 +71,9 @@ public: coordinateSpace = std::nullopt; } - inFrame = getDouble(json, "ip"); - outFrame = getDouble(json, "op"); - startTime = getDouble(json, "st"); + inFrame = (float)getDouble(json, "ip"); + outFrame = (float)getDouble(json, "op"); + startTime = (float)getDouble(json, "st"); transform = std::make_shared(getObject(json, "ks")); parent = getOptionalInt(json, "parent"); @@ -141,7 +141,7 @@ public: } if (const auto timeStretchData = getOptionalDouble(json, "sr")) { - _timeStretch = timeStretchData.value(); + _timeStretch = (float)timeStretchData.value(); } if (const auto matteRawValue = getOptionalInt(json, "tt")) { diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Layers/PreCompLayerModel.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Layers/PreCompLayerModel.hpp index 3f861b569c..16a2195a0b 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Layers/PreCompLayerModel.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Layers/PreCompLayerModel.hpp @@ -19,8 +19,8 @@ public: if (const auto timeRemappingData = getOptionalObject(json, "tm")) { timeRemapping = KeyframeGroup(timeRemappingData.value()); } - width = getDouble(json, "w"); - height = getDouble(json, "h"); + width = (float)getDouble(json, "w"); + height = (float)getDouble(json, "h"); } virtual ~PreCompLayerModel() = default; diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Layers/SolidLayerModel.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Layers/SolidLayerModel.hpp index 399105e454..cea0671b49 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Layers/SolidLayerModel.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Layers/SolidLayerModel.hpp @@ -12,8 +12,8 @@ public: explicit SolidLayerModel(lottiejson11::Json::object const &json) noexcept(false) : LayerModel(json) { colorHex = getString(json, "sc"); - width = getDouble(json, "sw"); - height = getDouble(json, "sh"); + width = (float)getDouble(json, "sw"); + height = (float)getDouble(json, "sh"); } virtual ~SolidLayerModel() = default; diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Objects/Marker.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Objects/Marker.hpp index 4f715e9ac7..bd1e5584dd 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Objects/Marker.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Objects/Marker.hpp @@ -20,7 +20,7 @@ public: explicit Marker(lottiejson11::Json::object const &json) noexcept(false) { name = getString(json, "cm"); - frameTime = getDouble(json, "tm"); + frameTime = (float)getDouble(json, "tm"); dr = getOptionalInt(json, "dr"); } diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/ShapeItems/GradientStroke.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/ShapeItems/GradientStroke.hpp index 36319fb11e..95bed62b51 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/ShapeItems/GradientStroke.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/ShapeItems/GradientStroke.hpp @@ -91,7 +91,7 @@ public: } if (const auto miterLimitData = getOptionalDouble(json, "ml")) { - miterLimit = miterLimitData.value(); + miterLimit = (float)miterLimitData.value(); } auto colorsContainer = getObject(json, "g"); diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/ShapeItems/Stroke.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/ShapeItems/Stroke.hpp index 56920e52fa..e306fcd6a6 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/ShapeItems/Stroke.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/ShapeItems/Stroke.hpp @@ -65,7 +65,7 @@ public: } if (const auto miterLimitData = getOptionalDouble(json, "ml")) { - miterLimit = miterLimitData.value(); + miterLimit = (float)miterLimitData.value(); } if (const auto dashElementsData = getOptionalObjectArray(json, "d")) { diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Text/Font.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Text/Font.hpp index 065f3c34fe..b321983e71 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Text/Font.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Text/Font.hpp @@ -29,7 +29,7 @@ public: weight = getOptionalString(json, "fWeight"); fontClass = getOptionalString(json, "fClass"); style = getString(json, "fStyle"); - ascent = getDouble(json, "ascent"); + ascent = (float)getDouble(json, "ascent"); origin = getOptionalInt(json, "origin"); } diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Text/Glyph.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Text/Glyph.hpp index 44d5e771e0..d5c1522850 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Text/Glyph.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Text/Glyph.hpp @@ -34,10 +34,10 @@ public: fontStyle(""), width(0.0) { character = getString(json, "ch"); - fontSize = getDouble(json, "size"); + fontSize = (float)getDouble(json, "size"); fontFamily = getString(json, "fFamily"); fontStyle = getString(json, "style"); - width = getDouble(json, "w"); + width = (float)getDouble(json, "w"); if (const auto shapeContainer = getOptionalObject(json, "data")) { internalHasData = true; diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Text/TextDocument.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Text/TextDocument.hpp index abb85dda71..83ea39ebcc 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Text/TextDocument.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Private/Model/Text/TextDocument.hpp @@ -62,7 +62,7 @@ public: lottiejson11::Json::object const &json = jsonAny.object_items(); text = getString(json, "t"); - fontSize = getDouble(json, "s"); + fontSize = (float)getDouble(json, "s"); fontFamily = getString(json, "f"); auto justificationRawValue = getInt(json, "j"); @@ -81,8 +81,10 @@ public: } tracking = getInt(json, "tr"); - lineHeight = getDouble(json, "lh"); - baseline = getOptionalDouble(json, "ls"); + lineHeight = (float)getDouble(json, "lh"); + if (const auto baselineValue = getOptionalDouble(json, "ls")) { + baseline = (float)baselineValue.value(); + } if (const auto fillColorDataValue = getOptionalAny(json, "fc")) { fillColorData = Color(fillColorDataValue.value()); @@ -92,8 +94,12 @@ public: strokeColorData = Color(strokeColorDataValue.value()); } - strokeWidth = getOptionalDouble(json, "sw"); - strokeOverFill = getOptionalBool(json, "of"); + if (const auto strokeWidthValue = getOptionalDouble(json, "sw")) { + strokeWidth = (float)strokeWidthValue.value(); + } + if (const auto strokeOverFillValue = getOptionalBool(json, "of")) { + strokeOverFill = (float)strokeOverFillValue.value(); + } if (const auto textFramePositionData = getOptionalAny(json, "ps")) { textFramePosition = Vector3D(textFramePositionData.value()); diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Keyframes/Keyframe.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Keyframes/Keyframe.hpp index c4adf10367..a3d12b226f 100644 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Keyframes/Keyframe.hpp +++ b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Keyframes/Keyframe.hpp @@ -162,7 +162,10 @@ public: endValue = T(endValueData.value()); } - time = getOptionalDouble(json.object_items(), "t"); + if (const auto timeValue = getOptionalDouble(json.object_items(), "t")) { + time = (float)timeValue.value(); + } + hold = getOptionalInt(json.object_items(), "h"); if (const auto inTangentData = getOptionalObject(json.object_items(), "i")) { diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/RenderTree.cpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/RenderTree.cpp deleted file mode 100644 index eec19c1596..0000000000 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/RenderTree.cpp +++ /dev/null @@ -1,140 +0,0 @@ -#include "RenderTree.hpp" - -namespace lottie { - -BoundingBoxNode::BoundingBoxNode( - LayerParams const &layer_, - CGRect const &globalRect_, - CGRect const &localRect_, - CATransform3D const &globalTransform_, - bool drawsContent_, - std::shared_ptr renderableItem_, - bool isInvertedMatte_, - std::vector> const &subnodes_, - std::shared_ptr const &mask_ -) : -layer(layer_), -globalRect(globalRect_), -localRect(localRect_), -globalTransform(globalTransform_), -drawsContent(drawsContent_), -renderableItem(renderableItem_), -isInvertedMatte(isInvertedMatte_), -subnodes(subnodes_), -mask(mask_) { -} - -std::shared_ptr boundingBoxTree(std::shared_ptr const &layer, Vector2D const &globalSize, CATransform3D const &parentTransform) { - if (layer->isHidden() || layer->opacity() == 0.0f) { - return nullptr; - } - - if (layer->masksToBounds()) { - if (layer->bounds().empty()) { - return nullptr; - } - } - - auto currentTransform = parentTransform; - - currentTransform = currentTransform.translated(Vector2D(layer->position().x, layer->position().y)); - currentTransform = currentTransform.translated(Vector2D(-layer->bounds().x, -layer->bounds().y)); - currentTransform = layer->transform() * currentTransform; - - if (!currentTransform.isInvertible()) { - return nullptr; - } - - std::optional effectiveLocalBounds; - - auto renderableItem = layer->renderableItem(); - if (renderableItem) { - effectiveLocalBounds = renderableItem->boundingRect(); - } else if (layer->implementsDraw()) { - effectiveLocalBounds = layer->bounds(); - } - - bool isInvertedMatte = layer->isInvertedMatte(); - if (isInvertedMatte) { - effectiveLocalBounds = layer->bounds(); - } - - if (effectiveLocalBounds && effectiveLocalBounds->empty()) { - effectiveLocalBounds = std::nullopt; - } - - std::vector> subnodes; - std::optional subnodesGlobalRect; - - for (const auto &sublayer : layer->sublayers()) { - if (const auto subnode = boundingBoxTree(sublayer, globalSize, currentTransform)) { - subnodes.push_back(subnode); - - if (subnodesGlobalRect) { - subnodesGlobalRect = subnodesGlobalRect->unionWith(subnode->globalRect); - } else { - subnodesGlobalRect = subnode->globalRect; - } - } - } - - std::optional fuzzyGlobalRect; - - if (effectiveLocalBounds) { - CGRect effectiveGlobalBounds = effectiveLocalBounds->applyingTransform(currentTransform); - if (fuzzyGlobalRect) { - fuzzyGlobalRect = fuzzyGlobalRect->unionWith(effectiveGlobalBounds); - } else { - fuzzyGlobalRect = effectiveGlobalBounds; - } - } - - if (subnodesGlobalRect) { - if (fuzzyGlobalRect) { - fuzzyGlobalRect = fuzzyGlobalRect->unionWith(subnodesGlobalRect.value()); - } else { - fuzzyGlobalRect = subnodesGlobalRect; - } - } - - if (!fuzzyGlobalRect) { - return nullptr; - } - - CGRect globalRect( - std::floor(fuzzyGlobalRect->x), - std::floor(fuzzyGlobalRect->y), - std::ceil(fuzzyGlobalRect->width + fuzzyGlobalRect->x - floor(fuzzyGlobalRect->x)), - std::ceil(fuzzyGlobalRect->height + fuzzyGlobalRect->y - floor(fuzzyGlobalRect->y)) - ); - - if (!CGRect(0.0, 0.0, globalSize.x, globalSize.y).intersects(globalRect)) { - return nullptr; - } - - std::shared_ptr maskNode; - if (layer->mask()) { - if (const auto maskNodeValue = boundingBoxTree(layer->mask(), globalSize, currentTransform)) { - if (!maskNodeValue->globalRect.intersects(globalRect)) { - return nullptr; - } - maskNode = maskNodeValue; - } else { - return nullptr; - } - } - - return std::make_shared( - layer, - globalRect, - CGRect(0.0, 0.0, 0.0, 0.0), - currentTransform, - effectiveLocalBounds.has_value(), - renderableItem, - isInvertedMatte, - subnodes, - maskNode - ); -} - -} diff --git a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/RenderTree.hpp b/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/RenderTree.hpp deleted file mode 100644 index 3f190522a0..0000000000 --- a/submodules/TelegramUI/Components/LottieCpp/Sources/Lottie/Public/Primitives/RenderTree.hpp +++ /dev/null @@ -1,172 +0,0 @@ -#ifndef RenderTree_hpp -#define RenderTree_hpp - -#include - -#include -#include "Lottie/Public/Primitives/CALayer.hpp" - -namespace lottie { - -struct BoundingBoxNode { - struct LayerParams { - CGRect _bounds; - Vector2D _position; - CATransform3D _transform; - double _opacity; - bool _masksToBounds; - bool _isHidden; - - LayerParams( - CGRect bounds_, - Vector2D position_, - CATransform3D transform_, - double opacity_, - bool masksToBounds_, - bool isHidden_ - ) : - _bounds(bounds_), - _position(position_), - _transform(transform_), - _opacity(opacity_), - _masksToBounds(masksToBounds_), - _isHidden(isHidden_) { - } - - LayerParams(std::shared_ptr const &layer) : - _bounds(layer->bounds()), - _position(layer->position()), - _transform(layer->transform()), - _opacity(layer->opacity()), - _masksToBounds(layer->masksToBounds()), - _isHidden(layer->isHidden()) { - } - - bool operator==(LayerParams const &rhs) const { - if (_bounds != rhs._bounds) { - return false; - } - if (_position != rhs._position) { - return false; - } - if (_transform != rhs._transform) { - return false; - } - if (_opacity != rhs._opacity) { - return false; - } - if (_masksToBounds != rhs._masksToBounds) { - return false; - } - if (_isHidden != rhs._isHidden) { - return false; - } - return true; - } - - bool operator!=(LayerParams const &rhs) const { - return !(*this == rhs); - } - - CGRect bounds() const { - return _bounds; - } - - Vector2D position() const { - return _position; - } - - CATransform3D transform() const { - return _transform; - } - - double opacity() const { - return _opacity; - } - - bool masksToBounds() const { - return _masksToBounds; - } - - bool isHidden() const { - return _isHidden; - } - }; - - LayerParams layer; - CGRect globalRect; - CGRect localRect; - CATransform3D globalTransform; - bool drawsContent; - std::shared_ptr renderableItem; - bool isInvertedMatte; - std::vector> subnodes; - std::shared_ptr mask; - - explicit BoundingBoxNode( - LayerParams const &layer_, - CGRect const &globalRect_, - CGRect const &localRect_, - CATransform3D const &globalTransform_, - bool drawsContent_, - std::shared_ptr renderableItem_, - bool isInvertedMatte_, - std::vector> const &subnodes_, - std::shared_ptr const &mask_ - ); - - bool operator==(BoundingBoxNode const &rhs) const { - if (layer != rhs.layer) { - return false; - } - if (globalRect != rhs.globalRect) { - return false; - } - if (localRect != rhs.localRect) { - return false; - } - if (globalTransform != rhs.globalTransform) { - return false; - } - if (drawsContent != rhs.drawsContent) { - return false; - } - if ((renderableItem == nullptr) != (rhs.renderableItem == nullptr)) { - return false; - } else if (renderableItem) { - if (!renderableItem->isEqual(rhs.renderableItem)) { - return false; - } - } - if (isInvertedMatte != rhs.isInvertedMatte) { - return false; - } - if (subnodes.size() != rhs.subnodes.size()) { - return false; - } else { - for (size_t i = 0; i < subnodes.size(); i++) { - if ((*subnodes[i].get()) != (*rhs.subnodes[i].get())) { - return false; - } - } - } - if ((mask == nullptr) != (rhs.mask == nullptr)) { - return false; - } else if (mask) { - if ((*mask.get()) != *(rhs.mask.get())) { - return false; - } - } - return true; - } - - bool operator!=(BoundingBoxNode const &rhs) const { - return !(*this == rhs); - } -}; - -std::shared_ptr boundingBoxTree(std::shared_ptr const &layer, Vector2D const &globalSize, CATransform3D const &parentTransform); - -} - -#endif /* RenderTree_hpp */