Lottie cleanup

This commit is contained in:
Isaac 2024-05-15 14:57:37 +04:00
parent c1160ee190
commit bf292c0066
3 changed files with 1 additions and 41 deletions

View File

@ -12,17 +12,8 @@ _inputMatte(inputMatte) {
addSublayer(_inputMatte);
}
void InvertedMatteLayer::setup() {
_inputMatte->setLayerDelegate(shared_from_base<InvertedMatteLayer>());
}
void InvertedMatteLayer::frameUpdated(double frame) {
setNeedsDisplay(true);
}
std::shared_ptr<InvertedMatteLayer> makeInvertedMatteLayer(std::shared_ptr<CompositionLayer> compositionLayer) {
auto result = std::make_shared<InvertedMatteLayer>(compositionLayer);
result->setup();
return result;
}

View File

@ -7,7 +7,6 @@
#include "Lottie/Private/Model/Layers/LayerModel.hpp"
#include "Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.hpp"
#include "Lottie/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.hpp"
#include "Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayerDelegate.hpp"
#include <memory>
@ -17,16 +16,12 @@ class CompositionLayer;
class InvertedMatteLayer;
/// A layer that inverses the alpha output of its input layer.
class InvertedMatteLayer: public CALayer, public CompositionLayerDelegate {
class InvertedMatteLayer: public CALayer {
public:
InvertedMatteLayer(std::shared_ptr<CompositionLayer> inputMatte);
void setup();
std::shared_ptr<CompositionLayer> _inputMatte;
virtual void frameUpdated(double frame) override;
virtual bool isInvertedMatte() const override {
return true;
}
@ -103,10 +98,6 @@ public:
_maskLayer->updateWithFrame(frame, forceUpdates);
}
}
if (const auto delegate = _layerDelegate.lock()) {
delegate->frameUpdated(frame);
}
}
virtual void displayContentsWithFrame(double frame, bool forceUpdates) {
@ -132,13 +123,6 @@ public:
}
}
std::weak_ptr<CompositionLayerDelegate> const &layerDelegate() const {
return _layerDelegate;
}
void setLayerDelegate(std::weak_ptr<CompositionLayerDelegate> const &layerDelegate) {
_layerDelegate = layerDelegate;
}
std::shared_ptr<CALayer> const &contentsLayer() const {
return _contentsLayer;
}
@ -184,8 +168,6 @@ protected:
std::optional<MatteType> _matteType;
private:
std::weak_ptr<CompositionLayerDelegate> _layerDelegate;
std::shared_ptr<LayerTransformNode> _transformNode;
std::shared_ptr<MaskContainerLayer> _maskLayer;

View File

@ -1,13 +0,0 @@
#ifndef CompositionLayerDelegate_hpp
#define CompositionLayerDelegate_hpp
namespace lottie {
class CompositionLayerDelegate {
public:
virtual void frameUpdated(double frame) = 0;
};
}
#endif /* CompositionLayerDelegate_hpp */