Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
SkRasterClipStack Class Reference

#include <SkRasterClipStack.h>

Inheritance diagram for SkRasterClipStack:
SkNoncopyable

Public Member Functions

 SkRasterClipStack (int width, int height)
 
void setNewSize (int w, int h)
 
const SkRasterCliprc () const
 
void save ()
 
void restore ()
 
void clipRect (const SkMatrix &ctm, const SkRect &rect, SkClipOp op, bool aa)
 
void clipRRect (const SkMatrix &ctm, const SkRRect &rrect, SkClipOp op, bool aa)
 
void clipPath (const SkMatrix &ctm, const SkPath &path, SkClipOp op, bool aa)
 
void clipShader (sk_sp< SkShader > sh)
 
void clipRegion (const SkRegion &rgn, SkClipOp op)
 
void replaceClip (const SkIRect &rect)
 
void validate () const
 

Detailed Description

Definition at line 16 of file SkRasterClipStack.h.

Constructor & Destructor Documentation

◆ SkRasterClipStack()

SkRasterClipStack::SkRasterClipStack ( int  width,
int  height 
)
inline

Definition at line 18 of file SkRasterClipStack.h.

19 : fRootBounds(SkIRect::MakeWH(width, height))
20 , fDisableAA(SkScan::PathRequiresTiling(fRootBounds)) {
21 fStack.emplace_back(SkRasterClip(fRootBounds));
22 SkASSERT(fStack.count() == 1);
23 }
#define SkASSERT(cond)
Definition SkAssert.h:116
static bool PathRequiresTiling(const SkIRect &bounds)
int count() const
T & emplace_back(Args &&... args)
int32_t height
int32_t width
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
Definition SkRect.h:56

Member Function Documentation

◆ clipPath()

void SkRasterClipStack::clipPath ( const SkMatrix ctm,
const SkPath path,
SkClipOp  op,
bool  aa 
)
inline

Definition at line 63 of file SkRasterClipStack.h.

63 {
64 this->writable_rc().op(path, ctm, op, this->finalAA(aa));
65 this->validate();
66 }

◆ clipRect()

void SkRasterClipStack::clipRect ( const SkMatrix ctm,
const SkRect rect,
SkClipOp  op,
bool  aa 
)
inline

Definition at line 53 of file SkRasterClipStack.h.

53 {
54 this->writable_rc().op(rect, ctm, op, this->finalAA(aa));
55 this->validate();
56 }

◆ clipRegion()

void SkRasterClipStack::clipRegion ( const SkRegion rgn,
SkClipOp  op 
)
inline

Definition at line 73 of file SkRasterClipStack.h.

73 {
74 this->writable_rc().op(rgn, op);
75 this->validate();
76 }

◆ clipRRect()

void SkRasterClipStack::clipRRect ( const SkMatrix ctm,
const SkRRect rrect,
SkClipOp  op,
bool  aa 
)
inline

Definition at line 58 of file SkRasterClipStack.h.

58 {
59 this->writable_rc().op(rrect, ctm, op, this->finalAA(aa));
60 this->validate();
61 }

◆ clipShader()

void SkRasterClipStack::clipShader ( sk_sp< SkShader sh)
inline

Definition at line 68 of file SkRasterClipStack.h.

68 {
69 this->writable_rc().op(std::move(sh));
70 this->validate();
71 }

◆ rc()

const SkRasterClip & SkRasterClipStack::rc ( ) const
inline

Definition at line 34 of file SkRasterClipStack.h.

34{ return fStack.back().fRC; }

◆ replaceClip()

void SkRasterClipStack::replaceClip ( const SkIRect rect)
inline

Definition at line 78 of file SkRasterClipStack.h.

78 {
79 SkIRect devRect = rect;
80 if (!devRect.intersect(fRootBounds)) {
81 this->writable_rc().setEmpty();
82 } else {
83 this->writable_rc().setRect(devRect);
84 }
85 }
sk_sp< SkBlender > blender SkRect rect
Definition SkRecords.h:350
bool intersect(const SkIRect &r)
Definition SkRect.h:513

◆ restore()

void SkRasterClipStack::restore ( )
inline

Definition at line 42 of file SkRasterClipStack.h.

42 {
43 SkDEBUGCODE(fCounter -= 1);
44 SkASSERT(fCounter >= 0);
45
46 if (--fStack.back().fDeferredCount < 0) {
47 SkASSERT(fStack.back().fDeferredCount == -1);
48 SkASSERT(fStack.count() > 1);
49 fStack.pop_back();
50 }
51 }
#define SkDEBUGCODE(...)
Definition SkDebug.h:23

◆ save()

void SkRasterClipStack::save ( )
inline

Definition at line 36 of file SkRasterClipStack.h.

36 {
37 SkDEBUGCODE(fCounter += 1);
38 SkASSERT(fStack.back().fDeferredCount >= 0);
39 fStack.back().fDeferredCount += 1;
40 }

◆ setNewSize()

void SkRasterClipStack::setNewSize ( int  w,
int  h 
)
inline

Definition at line 25 of file SkRasterClipStack.h.

25 {
26 fRootBounds.setXYWH(0, 0, w, h);
27
28 SkASSERT(fStack.count() == 1);
29 Rec& rec = fStack.back();
30 SkASSERT(rec.fDeferredCount == 0);
31 rec.fRC.setRect(fRootBounds);
32 }
SkScalar w
SkScalar h
void setXYWH(int32_t x, int32_t y, int32_t width, int32_t height)
Definition SkRect.h:268

◆ validate()

void SkRasterClipStack::validate ( ) const
inline

Definition at line 87 of file SkRasterClipStack.h.

87 {
88#ifdef SK_DEBUG
89 const SkRasterClip& clip = this->rc();
90 if (fRootBounds.isEmpty()) {
92 } else if (!clip.isEmpty()) {
93 SkASSERT(fRootBounds.contains(clip.getBounds()));
94 }
95#endif
96 }
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition SkPath.cpp:3824
bool isEmpty() const
Definition SkPath.cpp:406
const SkRect & getBounds() const
Definition SkPath.cpp:420
const SkRasterClip & rc() const
bool isEmpty() const
Definition SkRect.h:202
bool contains(int32_t x, int32_t y) const
Definition SkRect.h:463

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