Flutter Engine
The Flutter Engine
Protected Member Functions | List of all members
sksg::GeometryEffect Class Referenceabstract

#include <SkSGGeometryEffect.h>

Inheritance diagram for sksg::GeometryEffect:
sksg::GeometryNode sksg::Node SkRefCnt SkRefCntBase sksg::DashEffect sksg::GeometryTransform sksg::OffsetEffect sksg::RoundEffect sksg::TrimEffect

Protected Member Functions

 GeometryEffect (sk_sp< GeometryNode >)
 
 ~GeometryEffect () override
 
void onClip (SkCanvas *, bool antiAlias) const final
 
void onDraw (SkCanvas *, const SkPaint &) const final
 
bool onContains (const SkPoint &) const final
 
SkRect onRevalidate (InvalidationController *, const SkMatrix &) final
 
SkPath onAsPath () const final
 
virtual SkPath onRevalidateEffect (const sk_sp< GeometryNode > &)=0
 
- Protected Member Functions inherited from sksg::GeometryNode
 GeometryNode ()
 
virtual void onClip (SkCanvas *, bool antiAlias) const =0
 
virtual void onDraw (SkCanvas *, const SkPaint &) const =0
 
virtual bool onContains (const SkPoint &) const =0
 
virtual SkPath onAsPath () 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::GeometryNode
void clip (SkCanvas *, bool antiAlias) const
 
void draw (SkCanvas *, const SkPaint &) const
 
bool contains (const SkPoint &) const
 
SkPath asPath () const
 
- 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

Base class for geometry effects.

Definition at line 34 of file SkSGGeometryEffect.h.

Constructor & Destructor Documentation

◆ GeometryEffect()

sksg::GeometryEffect::GeometryEffect ( sk_sp< GeometryNode child)
explicitprotected

Definition at line 35 of file SkSGGeometryEffect.cpp.

36 : fChild(std::move(child)) {
37 SkASSERT(fChild);
38
39 this->observeInval(fChild);
40}
#define SkASSERT(cond)
Definition: SkAssert.h:116
void observeInval(const sk_sp< Node > &)
Definition: SkSGNode.cpp:61

◆ ~GeometryEffect()

sksg::GeometryEffect::~GeometryEffect ( )
overrideprotected

Definition at line 42 of file SkSGGeometryEffect.cpp.

42 {
43 this->unobserveInval(fChild);
44}
void unobserveInval(const sk_sp< Node > &)
Definition: SkSGNode.cpp:84

Member Function Documentation

◆ onAsPath()

SkPath sksg::GeometryEffect::onAsPath ( ) const
finalprotectedvirtual

Implements sksg::GeometryNode.

Definition at line 58 of file SkSGGeometryEffect.cpp.

58 {
59 return fPath;
60}

◆ onClip()

void sksg::GeometryEffect::onClip ( SkCanvas canvas,
bool  antiAlias 
) const
finalprotectedvirtual

Implements sksg::GeometryNode.

Definition at line 46 of file SkSGGeometryEffect.cpp.

46 {
47 canvas->clipPath(fPath, SkClipOp::kIntersect, antiAlias);
48}
void clipPath(const SkPath &path, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1456

◆ onContains()

bool sksg::GeometryEffect::onContains ( const SkPoint p) const
finalprotectedvirtual

Implements sksg::GeometryNode.

Definition at line 54 of file SkSGGeometryEffect.cpp.

54 {
55 return fPath.contains(p.x(), p.y());
56}
bool contains(SkScalar x, SkScalar y) const
Definition: SkPath.cpp:3118

◆ onDraw()

void sksg::GeometryEffect::onDraw ( SkCanvas canvas,
const SkPaint paint 
) const
finalprotectedvirtual

Implements sksg::GeometryNode.

Definition at line 50 of file SkSGGeometryEffect.cpp.

50 {
51 canvas->drawPath(fPath, paint);
52}
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
const Paint & paint
Definition: color_source.cc:38

◆ onRevalidate()

SkRect sksg::GeometryEffect::onRevalidate ( InvalidationController ic,
const SkMatrix ctm 
)
finalprotectedvirtual

Implements sksg::Node.

Definition at line 62 of file SkSGGeometryEffect.cpp.

62 {
63 SkASSERT(this->hasInval());
64
65 fChild->revalidate(ic, ctm);
66
67 fPath = this->onRevalidateEffect(fChild);
69
70 return fPath.computeTightBounds();
71}
static void ShrinkToFit(SkPath *path)
Definition: SkPathPriv.h:130
SkRect computeTightBounds() const
Definition: SkPath.cpp:3446
virtual SkPath onRevalidateEffect(const sk_sp< GeometryNode > &)=0
bool hasInval() const
Definition: SkSGNode.h:60

◆ onRevalidateEffect()

virtual SkPath sksg::GeometryEffect::onRevalidateEffect ( const sk_sp< GeometryNode > &  )
protectedpure virtual

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