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

#include <SkSGPath.h>

Inheritance diagram for sksg::Path:
sksg::GeometryNode sksg::Node SkRefCnt SkRefCntBase

Public Member Functions

SkPathFillType getFillType () const
 
void setFillType (SkPathFillType fillType)
 
- 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
 

Static Public Member Functions

static sk_sp< PathMake ()
 
static sk_sp< PathMake (const SkPath &r)
 

Protected Member Functions

void onClip (SkCanvas *, bool antiAlias) const override
 
void onDraw (SkCanvas *, const SkPaint &) const override
 
bool onContains (const SkPoint &) const override
 
SkRect onRevalidate (InvalidationController *, const SkMatrix &) override
 
SkPath onAsPath () const override
 
- 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

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

Detailed Description

Concrete Geometry node, wrapping an SkPath.

Definition at line 29 of file SkSGPath.h.

Member Function Documentation

◆ getFillType()

SkPathFillType sksg::Path::getFillType ( ) const
inline

Definition at line 39 of file SkSGPath.h.

39 {
40 return fPath.getFillType();
41 }
SkPathFillType getFillType() const
Definition: SkPath.h:230

◆ Make() [1/2]

static sk_sp< Path > sksg::Path::Make ( )
inlinestatic

Definition at line 31 of file SkSGPath.h.

31{ return sk_sp<Path>(new Path(SkPath())); }
Definition: SkPath.h:59

◆ Make() [2/2]

static sk_sp< Path > sksg::Path::Make ( const SkPath r)
inlinestatic

Definition at line 32 of file SkSGPath.h.

32{ return sk_sp<Path>(new Path(r)); }

◆ onAsPath()

SkPath sksg::Path::onAsPath ( ) const
overrideprotectedvirtual

Implements sksg::GeometryNode.

Definition at line 46 of file SkSGPath.cpp.

46 {
47 return fPath;
48}

◆ onClip()

void sksg::Path::onClip ( SkCanvas canvas,
bool  antiAlias 
) const
overrideprotectedvirtual

Implements sksg::GeometryNode.

Definition at line 23 of file SkSGPath.cpp.

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

◆ onContains()

bool sksg::Path::onContains ( const SkPoint p) const
overrideprotectedvirtual

Implements sksg::GeometryNode.

Definition at line 31 of file SkSGPath.cpp.

31 {
32 return fPath.contains(p.x(), p.y());
33}
bool contains(SkScalar x, SkScalar y) const
Definition: SkPath.cpp:3118

◆ onDraw()

void sksg::Path::onDraw ( SkCanvas canvas,
const SkPaint paint 
) const
overrideprotectedvirtual

Implements sksg::GeometryNode.

Definition at line 27 of file SkSGPath.cpp.

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

◆ onRevalidate()

SkRect sksg::Path::onRevalidate ( InvalidationController ,
const SkMatrix  
)
overrideprotectedvirtual

Implements sksg::Node.

Definition at line 35 of file SkSGPath.cpp.

35 {
36 SkASSERT(this->hasInval());
37
38 const auto ft = fPath.getFillType();
40 // "Containing" fills have finite bounds.
41 ? fPath.computeTightBounds()
42 // Inverse fills are "infinite".
44}
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkRect computeTightBounds() const
Definition: SkPath.cpp:3446
static SkRect MakeLargeS32()
Definition: SkRectPriv.h:33
bool hasInval() const
Definition: SkSGNode.h:60

◆ setFillType()

void sksg::Path::setFillType ( SkPathFillType  fillType)
inline

Definition at line 43 of file SkSGPath.h.

43 {
44 if (fillType != fPath.getFillType()) {
45 fPath.setFillType(fillType);
46 this->invalidate();
47 }
48 }
void setFillType(SkPathFillType ft)
Definition: SkPath.h:235
void invalidate(bool damage=true)
Definition: SkSGNode.cpp:113

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