mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Lottie cleanup
This commit is contained in:
parent
c1160ee190
commit
bf292c0066
@ -12,17 +12,8 @@ _inputMatte(inputMatte) {
|
|||||||
addSublayer(_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) {
|
std::shared_ptr<InvertedMatteLayer> makeInvertedMatteLayer(std::shared_ptr<CompositionLayer> compositionLayer) {
|
||||||
auto result = std::make_shared<InvertedMatteLayer>(compositionLayer);
|
auto result = std::make_shared<InvertedMatteLayer>(compositionLayer);
|
||||||
result->setup();
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#include "Lottie/Private/Model/Layers/LayerModel.hpp"
|
#include "Lottie/Private/Model/Layers/LayerModel.hpp"
|
||||||
#include "Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.hpp"
|
#include "Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.hpp"
|
||||||
#include "Lottie/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.hpp"
|
#include "Lottie/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.hpp"
|
||||||
#include "Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayerDelegate.hpp"
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -17,16 +16,12 @@ class CompositionLayer;
|
|||||||
class InvertedMatteLayer;
|
class InvertedMatteLayer;
|
||||||
|
|
||||||
/// A layer that inverses the alpha output of its input layer.
|
/// A layer that inverses the alpha output of its input layer.
|
||||||
class InvertedMatteLayer: public CALayer, public CompositionLayerDelegate {
|
class InvertedMatteLayer: public CALayer {
|
||||||
public:
|
public:
|
||||||
InvertedMatteLayer(std::shared_ptr<CompositionLayer> inputMatte);
|
InvertedMatteLayer(std::shared_ptr<CompositionLayer> inputMatte);
|
||||||
|
|
||||||
void setup();
|
|
||||||
|
|
||||||
std::shared_ptr<CompositionLayer> _inputMatte;
|
std::shared_ptr<CompositionLayer> _inputMatte;
|
||||||
|
|
||||||
virtual void frameUpdated(double frame) override;
|
|
||||||
|
|
||||||
virtual bool isInvertedMatte() const override {
|
virtual bool isInvertedMatte() const override {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -103,10 +98,6 @@ public:
|
|||||||
_maskLayer->updateWithFrame(frame, forceUpdates);
|
_maskLayer->updateWithFrame(frame, forceUpdates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const auto delegate = _layerDelegate.lock()) {
|
|
||||||
delegate->frameUpdated(frame);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void displayContentsWithFrame(double frame, bool forceUpdates) {
|
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 {
|
std::shared_ptr<CALayer> const &contentsLayer() const {
|
||||||
return _contentsLayer;
|
return _contentsLayer;
|
||||||
}
|
}
|
||||||
@ -184,8 +168,6 @@ protected:
|
|||||||
std::optional<MatteType> _matteType;
|
std::optional<MatteType> _matteType;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::weak_ptr<CompositionLayerDelegate> _layerDelegate;
|
|
||||||
|
|
||||||
std::shared_ptr<LayerTransformNode> _transformNode;
|
std::shared_ptr<LayerTransformNode> _transformNode;
|
||||||
|
|
||||||
std::shared_ptr<MaskContainerLayer> _maskLayer;
|
std::shared_ptr<MaskContainerLayer> _maskLayer;
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
#ifndef CompositionLayerDelegate_hpp
|
|
||||||
#define CompositionLayerDelegate_hpp
|
|
||||||
|
|
||||||
namespace lottie {
|
|
||||||
|
|
||||||
class CompositionLayerDelegate {
|
|
||||||
public:
|
|
||||||
virtual void frameUpdated(double frame) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* CompositionLayerDelegate_hpp */
|
|
Loading…
x
Reference in New Issue
Block a user