#ifndef FLUTTER_FLOW_OHOS_LAYERS_LAYER_H
#define FLUTTER_FLOW_OHOS_LAYERS_LAYER_H
#include "include/core/SkRRect.h"
#include "include/core/SkRect.h"
#include "flutter/fml/macros.h"
namespace flutter::OHOS {
constexpr uint32_t DEAFAULT_UNIQUEID = -1;
enum Clip { NONE, HARDEDGE, ANTIALIAS, ANTIALIAS_WITH_SAVELAYER };
class ContainerLayer;
struct PaintContext;
class Layer {
public:
Layer() = default;
virtual ~Layer() = default;
virtual void Paint(const PaintContext& paintContext) const {};
virtual void Prepare(const SkMatrix& matrix) {};
ContainerLayer* parent() const
{
return parent_;
}
void setParent(ContainerLayer* parent)
{
parent_ = parent;
}
bool GetNeedsSystemComposite() const
{
return needsSystemComposite_;
}
void SetNeedsSystemComposite(bool value)
{
needsSystemComposite_ = value;
}
const SkRect& GetPaintBounds() const
{
return paintBounds_;
}
void SetPaintBounds(const SkRect& paintBounds)
{
paintBounds_ = paintBounds;
}
bool NeedsPainting() const
{
return !paintBounds_.isEmpty();
}
uint64_t GetUniqueId() const
{
return uniqueId_;
}
private:
ContainerLayer* parent_;
SkRect paintBounds_;
bool needsSystemComposite_ = false;
uint64_t uniqueId_ = DEAFAULT_UNIQUEID;
FML_DISALLOW_COPY_AND_ASSIGN(Layer);
};
}
#endif