8#ifndef SkSGNode_DEFINED
9#define SkSGNode_DEFINED
22class InvalidationController;
52 explicit Node(uint32_t invalTraits);
60 bool hasInval()
const {
return fFlags & kInvalidated_Flag; }
72 kInvalidated_Flag = 1 << 0,
73 kDamage_Flag = 1 << 1,
74 kObserverArray_Flag = 1 << 2,
75 kInTraversal_Flag = 1 << 3,
78 template <
typename Func>
79 void forEachInvalObserver(Func&&)
const;
88 const uint32_t fInvalTraits : 2;
90 uint32_t fNodeFlags : 8;
100#define SG_ATTRIBUTE(attr_name, attr_type, attr_container) \
101 const attr_type& get##attr_name() const { return attr_container; } \
102 void set##attr_name(const attr_type& v) { \
103 if (attr_container == v) return; \
104 attr_container = v; \
105 this->invalidate(); \
107 void set##attr_name(attr_type&& v) { \
108 if (attr_container == v) return; \
109 attr_container = std::move(v); \
110 this->invalidate(); \
113#define SG_MAPPED_ATTRIBUTE(attr_name, attr_type, attr_container) \
114 attr_type get##attr_name() const { return attr_container.get##attr_name(); } \
115 void set##attr_name(const attr_type& v) { \
116 if (attr_container.get##attr_name() == v) return; \
117 attr_container.set##attr_name(v); \
118 this->invalidate(); \
120 void set##attr_name(attr_type&& v) { \
121 if (attr_container.get##attr_name() == v) return; \
122 attr_container.set##attr_name(std::move(v)); \
123 this->invalidate(); \
const SkRect & revalidate(InvalidationController *, const SkMatrix &)
void observeInval(const sk_sp< Node > &)
void unobserveInval(const sk_sp< Node > &)
const SkRect & bounds() const
std::vector< Node * > * fInvalObserverArray
void invalidate(bool damage=true)
Node(uint32_t invalTraits)
virtual SkRect onRevalidate(InvalidationController *, const SkMatrix &ctm)=0