Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
sksg::TransformEffect Class Referencefinal

#include <SkSGTransform.h>

Inheritance diagram for sksg::TransformEffect:
sksg::EffectNode sksg::RenderNode sksg::Node SkRefCnt SkRefCntBase

Public Member Functions

 ~TransformEffect () override
 
const sk_sp< Transform > & getTransform () const
 
- 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
 

Static Public Member Functions

static sk_sp< TransformEffectMake (sk_sp< RenderNode > child, sk_sp< Transform > transform)
 
static sk_sp< TransformEffectMake (sk_sp< RenderNode > child, const SkMatrix &m)
 

Protected Member Functions

void onRender (SkCanvas *, const RenderContext *) const override
 
const RenderNodeonNodeAt (const SkPoint &) const override
 
SkRect onRevalidate (InvalidationController *, const SkMatrix &) override
 
- Protected Member Functions inherited from sksg::EffectNode
 EffectNode (sk_sp< RenderNode >, uint32_t inval_traits=0)
 
 ~EffectNode () override
 
void onRender (SkCanvas *, const RenderContext *) const override
 
const RenderNodeonNodeAt (const SkPoint &) const override
 
SkRect onRevalidate (InvalidationController *, const SkMatrix &) override
 
const sk_sp< RenderNode > & getChild () 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

- Protected Types inherited from sksg::Node
enum  InvalTraits { kBubbleDamage_Trait = 1 << 0 , kOverrideDamage_Trait = 1 << 1 }
 

Detailed Description

Concrete Effect node, binding a Transform to a RenderNode.

Definition at line 95 of file SkSGTransform.h.

Constructor & Destructor Documentation

◆ ~TransformEffect()

sksg::TransformEffect::~TransformEffect ( )
override

Definition at line 176 of file SkSGTransform.cpp.

176 {
177 this->unobserveInval(fTransform);
178}
void unobserveInval(const sk_sp< Node > &)
Definition: SkSGNode.cpp:84

Member Function Documentation

◆ getTransform()

const sk_sp< Transform > & sksg::TransformEffect::getTransform ( ) const
inline

Definition at line 109 of file SkSGTransform.h.

109{ return fTransform; }

◆ Make() [1/2]

static sk_sp< TransformEffect > sksg::TransformEffect::Make ( sk_sp< RenderNode child,
const SkMatrix m 
)
inlinestatic

Definition at line 103 of file SkSGTransform.h.

103 {
104 return Make(std::move(child), Matrix<SkMatrix>::Make(m));
105 }
static sk_sp< Matrix > Make(const SkMatrix &m)
Definition: SkSGTransform.h:70
static sk_sp< TransformEffect > Make(sk_sp< RenderNode > child, sk_sp< Transform > transform)
Definition: SkSGTransform.h:97

◆ Make() [2/2]

static sk_sp< TransformEffect > sksg::TransformEffect::Make ( sk_sp< RenderNode child,
sk_sp< Transform transform 
)
inlinestatic

Definition at line 97 of file SkSGTransform.h.

97 {
98 return child && transform
99 ? sk_sp<TransformEffect>(new TransformEffect(std::move(child), std::move(transform)))
100 : nullptr;
101 }
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition: p3.cpp:47

◆ onNodeAt()

const RenderNode * sksg::TransformEffect::onNodeAt ( const SkPoint p) const
overrideprotectedvirtual

Reimplemented from sksg::EffectNode.

Definition at line 187 of file SkSGTransform.cpp.

187 {
188 const auto p4 = TransformPriv::As<SkM44>(fTransform).map(p.fX, p.fY, 0, 0);
189
190 return this->INHERITED::onNodeAt({p4.x, p4.y});
191}
const RenderNode * onNodeAt(const SkPoint &) const override

◆ onRender()

void sksg::TransformEffect::onRender ( SkCanvas canvas,
const RenderContext ctx 
) const
overrideprotectedvirtual

Reimplemented from sksg::EffectNode.

Definition at line 180 of file SkSGTransform.cpp.

180 {
181 SkAutoCanvasRestore acr(canvas, true);
182 canvas->concat(TransformPriv::As<SkM44>(fTransform));
183
184 this->INHERITED::onRender(canvas, ctx);
185}
void concat(const SkMatrix &matrix)
Definition: SkCanvas.cpp:1318
void onRender(SkCanvas *, const RenderContext *) const override

◆ onRevalidate()

SkRect sksg::TransformEffect::onRevalidate ( InvalidationController ic,
const SkMatrix ctm 
)
overrideprotectedvirtual

Reimplemented from sksg::EffectNode.

Definition at line 193 of file SkSGTransform.cpp.

193 {
194 SkASSERT(this->hasInval());
195
196 // We don't care about matrix reval results.
197 fTransform->revalidate(ic, ctm);
198
199 // TODO: need to update all the reval plumbing for m44.
200 const auto m = TransformPriv::As<SkMatrix>(fTransform);
201 auto bounds = this->INHERITED::onRevalidate(ic, SkMatrix::Concat(ctm, m));
202 m.mapRect(&bounds);
203
204 return bounds;
205}
#define SkASSERT(cond)
Definition: SkAssert.h:116
static SkMatrix Concat(const SkMatrix &a, const SkMatrix &b)
Definition: SkMatrix.h:1775
SkRect onRevalidate(InvalidationController *, const SkMatrix &) override
const SkRect & bounds() const
Definition: SkSGNode.h:55
bool hasInval() const
Definition: SkSGNode.h:60

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