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

#include <SkSGRect.h>

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

Static Public Member Functions

static sk_sp< RectMake ()
 
static sk_sp< RectMake (const SkRect &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

- 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

Concrete Geometry node, wrapping an SkRect.

Definition at line 34 of file SkSGRect.h.

Member Function Documentation

◆ Make() [1/2]

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

Definition at line 36 of file SkSGRect.h.

36{ return sk_sp<Rect>(new Rect(SkRect::MakeEmpty())); }
static constexpr SkRect MakeEmpty()
Definition: SkRect.h:595

◆ Make() [2/2]

static sk_sp< Rect > sksg::Rect::Make ( const SkRect r)
inlinestatic

Definition at line 37 of file SkSGRect.h.

37{ return sk_sp<Rect>(new Rect(r)); }

◆ onAsPath()

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

Implements sksg::GeometryNode.

Definition at line 40 of file SkSGRect.cpp.

40 {
41 return SkPath::Rect(fRect, this->getDirection(), this->getInitialPointIndex());
42}
static SkPath Rect(const SkRect &, SkPathDirection=SkPathDirection::kCW, unsigned startIndex=0)
Definition: SkPath.cpp:3586

◆ onClip()

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

Implements sksg::GeometryNode.

Definition at line 22 of file SkSGRect.cpp.

22 {
23 canvas->clipRect(fRect, SkClipOp::kIntersect, antiAlias);
24}
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361

◆ onContains()

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

Implements sksg::GeometryNode.

Definition at line 30 of file SkSGRect.cpp.

30 {
31 return fRect.contains(p.x(), p.y());
32}
bool contains(SkScalar x, SkScalar y) const
Definition: extension.cpp:19

◆ onDraw()

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

Implements sksg::GeometryNode.

Definition at line 26 of file SkSGRect.cpp.

26 {
27 canvas->drawRect(fRect, paint);
28}
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
const Paint & paint
Definition: color_source.cc:38

◆ onRevalidate()

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

Implements sksg::Node.

Definition at line 34 of file SkSGRect.cpp.

34 {
35 SkASSERT(this->hasInval());
36
37 return fRect;
38}
#define SkASSERT(cond)
Definition: SkAssert.h:116
bool hasInval() const
Definition: SkSGNode.h:60

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