8 #ifndef SkSGNode_DEFINED
9 #define SkSGNode_DEFINED
21 class InvalidationController;
51 explicit Node(uint32_t invalTraits);
59 bool hasInval()
const {
return fFlags & kInvalidated_Flag; }
71 kInvalidated_Flag = 1 << 0,
72 kDamage_Flag = 1 << 1,
73 kObserverArray_Flag = 1 << 2,
74 kInTraversal_Flag = 1 << 3,
77 template <
typename Func>
78 void forEachInvalObserver(Func&&)
const;
87 const uint32_t fInvalTraits : 2;
89 uint32_t fNodeFlags : 8;
99 #define SG_ATTRIBUTE(attr_name, attr_type, attr_container) \
100 const attr_type& get##attr_name() const { return attr_container; } \
101 void set##attr_name(const attr_type& v) { \
102 if (attr_container == v) return; \
103 attr_container = v; \
104 this->invalidate(); \
106 void set##attr_name(attr_type&& v) { \
107 if (attr_container == v) return; \
108 attr_container = std::move(v); \
109 this->invalidate(); \
112 #define SG_MAPPED_ATTRIBUTE(attr_name, attr_type, attr_container) \
113 attr_type get##attr_name() const { return attr_container.get##attr_name(); } \
114 void set##attr_name(const attr_type& v) { \
115 if (attr_container.get##attr_name() == v) return; \
116 attr_container.set##attr_name(v); \
117 this->invalidate(); \
119 void set##attr_name(attr_type&& v) { \
120 if (attr_container.get##attr_name() == v) return; \
121 attr_container.set##attr_name(std::move(v)); \
122 this->invalidate(); \
SkCanvas provides an interface for drawing, and how the drawing is clipped and transformed.
Definition: SkCanvas.h:99
SkMatrix holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:53
Definition: SkRefCnt.h:119
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:220
Receiver for invalidation events.
Definition: SkSGInvalidationController.h:25
Base class for all scene graph nodes.
Definition: SkSGNode.h:32
const SkRect & revalidate(InvalidationController *, const SkMatrix &)
const SkRect & bounds() const
Definition: SkSGNode.h:54
Node * fInvalObserver
Definition: SkSGNode.h:83
friend class NodePriv
Definition: SkSGNode.h:92
void invalidate(bool damage=true)
Node(uint32_t invalTraits)
void observeInval(const sk_sp< Node > &)
bool hasInval() const
Definition: SkSGNode.h:59
InvalTraits
Definition: SkSGNode.h:42
@ kOverrideDamage_Trait
Definition: SkSGNode.h:48
@ kBubbleDamage_Trait
Definition: SkSGNode.h:45
std::vector< Node * > * fInvalObserverArray
Definition: SkSGNode.h:84
virtual SkRect onRevalidate(InvalidationController *, const SkMatrix &ctm)=0
void unobserveInval(const sk_sp< Node > &)
Base class for nodes which can render to a canvas.
Definition: SkSGRenderNode.h:27
SkRect holds four float coordinates describing the upper and lower bounds of a rectangle.
Definition: SkRect.h:582