Flutter Engine
The Flutter Engine
Protected Member Functions | List of all members
sksg::CustomRenderNode Class Reference

#include <SkSGRenderNode.h>

Inheritance diagram for sksg::CustomRenderNode:
sksg::RenderNode sksg::Node SkRefCnt SkRefCntBase skottie::internal::MotionBlurEffect

Protected Member Functions

 CustomRenderNode (std::vector< sk_sp< RenderNode > > &&children)
 
 ~CustomRenderNode () override
 
const std::vector< sk_sp< RenderNode > > & children () const
 
bool hasChildrenInval () const
 
- Protected Member Functions inherited from sksg::RenderNode
 RenderNode (uint32_t inval_traits=0)
 
virtual void onRender (SkCanvas *, const RenderContext *) const =0
 
virtual const RenderNodeonNodeAt (const SkPoint &p) const =0
 
- Protected Member Functions inherited from sksg::Node
 Node (uint32_t invalTraits)
 
 ~Node () override
 
const SkRectbounds () const
 
bool hasInval () const
 
virtual SkRect onRevalidate (InvalidationController *, const SkMatrix &ctm)=0
 
void observeInval (const sk_sp< Node > &)
 
void unobserveInval (const sk_sp< Node > &)
 

Additional Inherited Members

- Public Member Functions inherited from sksg::RenderNode
void render (SkCanvas *, const RenderContext *=nullptr) const
 
const RenderNodenodeAt (const SkPoint &point) const
 
bool isVisible () const
 
void setVisible (bool)
 
- Public Member Functions inherited from sksg::Node
const SkRectrevalidate (InvalidationController *, const SkMatrix &)
 
void invalidate (bool damage=true)
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 
- Protected Types inherited from sksg::Node
enum  InvalTraits { kBubbleDamage_Trait = 1 << 0 , kOverrideDamage_Trait = 1 << 1 }
 

Detailed Description

Clients outside SkSG looking to implement custom render nodes, should derive from this class instead of RenderNode. It handles various book-keeping, and provides a controlled extension point.

Definition at line 140 of file SkSGRenderNode.h.

Constructor & Destructor Documentation

◆ CustomRenderNode()

sksg::CustomRenderNode::CustomRenderNode ( std::vector< sk_sp< RenderNode > > &&  children)
explicitprotected

Definition at line 237 of file SkSGRenderNode.cpp.

238 : INHERITED(kOverrideDamage_Trait) // We cannot make any assumptions - override conservatively.
239 , fChildren(std::move(children)) {
240 for (const auto& child : fChildren) {
241 this->observeInval(child);
242 }
243}
const std::vector< sk_sp< RenderNode > > & children() const
void observeInval(const sk_sp< Node > &)
Definition: SkSGNode.cpp:61
@ kOverrideDamage_Trait
Definition: SkSGNode.h:49

◆ ~CustomRenderNode()

sksg::CustomRenderNode::~CustomRenderNode ( )
overrideprotected

Definition at line 245 of file SkSGRenderNode.cpp.

245 {
246 for (const auto& child : fChildren) {
247 this->unobserveInval(child);
248 }
249}
void unobserveInval(const sk_sp< Node > &)
Definition: SkSGNode.cpp:84

Member Function Documentation

◆ children()

const std::vector< sk_sp< RenderNode > > & sksg::CustomRenderNode::children ( ) const
inlineprotected

Definition at line 145 of file SkSGRenderNode.h.

145{ return fChildren; }

◆ hasChildrenInval()

bool sksg::CustomRenderNode::hasChildrenInval ( ) const
protected

Definition at line 251 of file SkSGRenderNode.cpp.

251 {
252 for (const auto& child : fChildren) {
253 if (NodePriv::HasInval(child)) {
254 return true;
255 }
256 }
257
258 return false;
259}
static bool HasInval(const sk_sp< Node > &node)
Definition: SkSGNodePriv.h:19

The documentation for this class was generated from the following files: