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

#include <SkClipStackDevice.h>

Inheritance diagram for SkClipStackDevice:
SkDevice SkRefCnt SkRefCntBase SkPDFDevice SkSVGDevice

Public Member Functions

 SkClipStackDevice (const SkImageInfo &info, const SkSurfaceProps &props)
 
SkClipStackcs ()
 
const SkClipStackcs () const
 
void pushClipStack () override
 
void popClipStack () override
 
void clipRect (const SkRect &rect, SkClipOp, bool aa) override
 
void clipRRect (const SkRRect &rrect, SkClipOp, bool aa) override
 
void clipPath (const SkPath &path, SkClipOp, bool aa) override
 
void clipRegion (const SkRegion &deviceRgn, SkClipOp) override
 
void replaceClip (const SkIRect &rect) override
 
bool isClipAntiAliased () const override
 
bool isClipWideOpen () const override
 
bool isClipEmpty () const override
 
bool isClipRect () const override
 
void android_utils_clipAsRgn (SkRegion *) const override
 
SkIRect devClipBounds () const override
 
- Public Member Functions inherited from SkDevice
 SkDevice (const SkImageInfo &, const SkSurfaceProps &)
 
const SkImageInfoimageInfo () const
 
int width () const
 
int height () const
 
bool isOpaque () const
 
SkIRect bounds () const
 
SkISize size () const
 
const SkSurfacePropssurfaceProps () const
 
SkScalerContextFlags scalerContextFlags () const
 
virtual SkStrikeDeviceInfo strikeDeviceInfo () const
 
bool writePixels (const SkPixmap &src, int x, int y)
 
bool readPixels (const SkPixmap &dst, int x, int y)
 
bool accessPixels (SkPixmap *pmap)
 
bool peekPixels (SkPixmap *)
 
const SkM44localToDevice44 () const
 
const SkMatrixlocalToDevice () const
 
const SkM44deviceToGlobal () const
 
const SkM44globalToDevice () const
 
SkIPoint getOrigin () const
 
bool isPixelAlignedToGlobal () const
 
SkMatrix getRelativeTransform (const SkDevice &) const
 
void setLocalToDevice (const SkM44 &localToDevice)
 
void setGlobalCTM (const SkM44 &ctm)
 
void getGlobalBounds (SkIRect *bounds) const
 
SkIRect getGlobalBounds () const
 
void clipShader (sk_sp< SkShader > sh, SkClipOp op)
 
virtual bool android_utils_clipWithStencil ()
 
virtual bool useDrawCoverageMaskForMaskFilters () const
 
virtual bool isNoPixelsDevice () const
 
virtual void * getRasterHandle () const
 
virtual GrRecordingContextrecordingContext () const
 
virtual skgpu::graphite::Recorderrecorder () const
 
virtual skgpu::ganesh::DeviceasGaneshDevice ()
 
virtual skgpu::graphite::DeviceasGraphiteDevice ()
 
virtual void setImmutable ()
 
virtual sk_sp< SkSurfacemakeSurface (const SkImageInfo &, const SkSurfaceProps &)
 
virtual sk_sp< SkDevicecreateDevice (const CreateInfo &, const SkPaint *)
 
void drawGlyphRunList (SkCanvas *, const sktext::GlyphRunList &glyphRunList, const SkPaint &paint)
 
virtual sk_sp< sktext::gpu::SlugconvertGlyphRunListToSlug (const sktext::GlyphRunList &glyphRunList, const SkPaint &paint)
 
virtual void drawSlug (SkCanvas *, const sktext::gpu::Slug *slug, const SkPaint &paint)
 
virtual void drawPaint (const SkPaint &paint)=0
 
virtual void drawPoints (SkCanvas::PointMode mode, size_t count, const SkPoint[], const SkPaint &paint)=0
 
virtual void drawRect (const SkRect &r, const SkPaint &paint)=0
 
virtual void drawRegion (const SkRegion &r, const SkPaint &paint)
 
virtual void drawOval (const SkRect &oval, const SkPaint &paint)=0
 
virtual void drawArc (const SkRect &oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, const SkPaint &paint)
 
virtual void drawRRect (const SkRRect &rr, const SkPaint &paint)=0
 
virtual void drawDRRect (const SkRRect &outer, const SkRRect &inner, const SkPaint &)
 
virtual void drawPath (const SkPath &path, const SkPaint &paint, bool pathIsMutable=false)=0
 
virtual void drawImageRect (const SkImage *, const SkRect *src, const SkRect &dst, const SkSamplingOptions &, const SkPaint &, SkCanvas::SrcRectConstraint)=0
 
virtual bool shouldDrawAsTiledImageRect () const
 
virtual bool drawAsTiledImageRect (SkCanvas *, const SkImage *, const SkRect *src, const SkRect &dst, const SkSamplingOptions &, const SkPaint &, SkCanvas::SrcRectConstraint)
 
virtual void drawImageLattice (const SkImage *, const SkCanvas::Lattice &, const SkRect &dst, SkFilterMode, const SkPaint &)
 
virtual void drawVertices (const SkVertices *, sk_sp< SkBlender >, const SkPaint &, bool skipColorXform=false)=0
 
virtual void drawMesh (const SkMesh &mesh, sk_sp< SkBlender >, const SkPaint &)=0
 
virtual void drawShadow (const SkPath &, const SkDrawShadowRec &)
 
virtual void drawPatch (const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], sk_sp< SkBlender >, const SkPaint &paint)
 
virtual void drawAtlas (const SkRSXform[], const SkRect[], const SkColor[], int count, sk_sp< SkBlender >, const SkPaint &)
 
virtual void drawAnnotation (const SkRect &, const char[], SkData *)
 
virtual void drawEdgeAAQuad (const SkRect &rect, const SkPoint clip[4], SkCanvas::QuadAAFlags aaFlags, const SkColor4f &color, SkBlendMode mode)
 
virtual void drawEdgeAAImageSet (const SkCanvas::ImageSetEntry[], int count, const SkPoint dstClips[], const SkMatrix preViewMatrices[], const SkSamplingOptions &, const SkPaint &, SkCanvas::SrcRectConstraint)
 
virtual void drawDrawable (SkCanvas *, SkDrawable *, const SkMatrix *)
 
virtual sk_sp< SkSpecialImagesnapSpecial (const SkIRect &subset, bool forceCopy=false)
 
virtual sk_sp< SkSpecialImagesnapSpecialScaled (const SkIRect &subset, const SkISize &dstDims)
 
sk_sp< SkSpecialImagesnapSpecial ()
 
virtual void drawDevice (SkDevice *, const SkSamplingOptions &, const SkPaint &)
 
virtual void drawSpecial (SkSpecialImage *, const SkMatrix &localToDevice, const SkSamplingOptions &, const SkPaint &, SkCanvas::SrcRectConstraint constraint=SkCanvas::kStrict_SrcRectConstraint)
 
virtual void drawCoverageMask (const SkSpecialImage *, const SkMatrix &maskToDevice, const SkSamplingOptions &, const SkPaint &)
 
virtual bool drawBlurredRRect (const SkRRect &, const SkPaint &, float deviceSigma)
 
void drawFilteredImage (const skif::Mapping &mapping, SkSpecialImage *src, SkColorType ct, const SkImageFilter *, const SkSamplingOptions &, const SkPaint &)
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Private Member Functions

void onClipShader (sk_sp< SkShader >) override
 

Additional Inherited Members

- Protected Member Functions inherited from SkDevice
virtual sk_sp< SkSpecialImagemakeSpecial (const SkBitmap &)
 
virtual sk_sp< SkSpecialImagemakeSpecial (const SkImage *)
 
void setDeviceCoordinateSystem (const SkM44 &deviceToGlobal, const SkM44 &globalToDevice, const SkM44 &localToDevice, int bufferOriginX, int bufferOriginY)
 
void setOrigin (const SkM44 &globalCTM, int x, int y)
 
bool checkLocalToDeviceDirty ()
 

Detailed Description

Definition at line 26 of file SkClipStackDevice.h.

Constructor & Destructor Documentation

◆ SkClipStackDevice()

SkClipStackDevice::SkClipStackDevice ( const SkImageInfo info,
const SkSurfaceProps props 
)
inline

Definition at line 28 of file SkClipStackDevice.h.

29 : SkDevice(info, props)
30 , fClipStack(fStorage, sizeof(fStorage))
31 {}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213

Member Function Documentation

◆ android_utils_clipAsRgn()

void SkClipStackDevice::android_utils_clipAsRgn ( SkRegion rgn) const
overridevirtual

Implements SkDevice.

Definition at line 106 of file SkClipStackDevice.cpp.

106 {
107 SkClipStack::BoundsType boundType;
108 bool isIntersectionOfRects;
110 fClipStack.getBounds(&bounds, &boundType, &isIntersectionOfRects);
111 if (isIntersectionOfRects && SkClipStack::kNormal_BoundsType == boundType) {
112 rgn->setRect(bounds.round());
113 } else {
114 SkRegion boundsRgn({0, 0, this->width(), this->height()});
115 SkPath tmpPath;
116
117 *rgn = boundsRgn;
118 SkClipStack::B2TIter iter(fClipStack);
119 while (auto elem = iter.next()) {
120 tmpPath.rewind();
121 elem->asDeviceSpacePath(&tmpPath);
122 SkRegion tmpRgn;
123 tmpRgn.setPath(tmpPath, boundsRgn);
124 if (elem->isReplaceOp()) {
125 // All replace elements are rectangles
126 // TODO: SkClipStack can be simplified to be I,D,R ops now, which means element
127 // iteration can be from top of the stack to the most recent replace element.
128 // When that's done, this loop will be simplifiable.
129 rgn->setRect(elem->getDeviceSpaceRect().round());
130 } else {
131 rgn->op(tmpRgn, static_cast<SkRegion::Op>(elem->getOp()));
132 }
133 }
134 }
135}
void getBounds(SkRect *canvFiniteBound, BoundsType *boundType, bool *isIntersectionOfRects=nullptr) const
int height() const
Definition SkDevice.h:120
int width() const
Definition SkDevice.h:119
SkIRect bounds() const
Definition SkDevice.h:125
bool op(const SkIRect &rect, Op op)
Definition SkRegion.h:384
bool setRect(const SkIRect &rect)
Definition SkRegion.cpp:192
bool setPath(const SkPath &path, const SkRegion &clip)

◆ clipPath()

void SkClipStackDevice::clipPath ( const SkPath path,
SkClipOp  op,
bool  aa 
)
overridevirtual

Implements SkDevice.

Definition at line 50 of file SkClipStackDevice.cpp.

50 {
51 fClipStack.clipPath(path, this->localToDevice(), op, aa);
52}
void clipPath(const SkPath &, const SkMatrix &matrix, SkClipOp, bool doAA)
const SkMatrix & localToDevice() const
Definition SkDevice.h:179

◆ clipRect()

void SkClipStackDevice::clipRect ( const SkRect rect,
SkClipOp  op,
bool  aa 
)
overridevirtual

Implements SkDevice.

Definition at line 42 of file SkClipStackDevice.cpp.

42 {
43 fClipStack.clipRect(rect, this->localToDevice(), op, aa);
44}
void clipRect(const SkRect &, const SkMatrix &matrix, SkClipOp, bool doAA)

◆ clipRegion()

void SkClipStackDevice::clipRegion ( const SkRegion deviceRgn,
SkClipOp  op 
)
overridevirtual

Implements SkDevice.

Definition at line 58 of file SkClipStackDevice.cpp.

58 {
59 SkIPoint origin = this->getOrigin();
60 SkRegion tmp;
62 rgn.getBoundaryPath(&path);
63 path.transform(SkMatrix::Translate(-origin));
64 fClipStack.clipPath(path, SkMatrix::I(), op, false);
65}
SkIPoint getOrigin() const
Definition SkDevice.cpp:90
static SkMatrix Translate(SkScalar dx, SkScalar dy)
Definition SkMatrix.h:91
static const SkMatrix & I()
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57

◆ clipRRect()

void SkClipStackDevice::clipRRect ( const SkRRect rrect,
SkClipOp  op,
bool  aa 
)
overridevirtual

Implements SkDevice.

Definition at line 46 of file SkClipStackDevice.cpp.

46 {
47 fClipStack.clipRRect(rrect, this->localToDevice(), op, aa);
48}
void clipRRect(const SkRRect &, const SkMatrix &matrix, SkClipOp, bool doAA)

◆ cs() [1/2]

SkClipStack & SkClipStackDevice::cs ( )
inline

Definition at line 33 of file SkClipStackDevice.h.

33{ return fClipStack; }

◆ cs() [2/2]

const SkClipStack & SkClipStackDevice::cs ( ) const
inline

Definition at line 34 of file SkClipStackDevice.h.

34{ return fClipStack; }

◆ devClipBounds()

SkIRect SkClipStackDevice::devClipBounds ( ) const
overridevirtual

Returns the bounding box of the current clip, in this device's coordinate space. No pixels outside of these bounds will be touched by draws unless the clip is further modified (at which point this will return the updated bounds).

Implements SkDevice.

Definition at line 24 of file SkClipStackDevice.cpp.

24 {
25 SkIRect r = fClipStack.bounds(this->imageInfo().bounds()).roundOut();
26 if (!r.isEmpty()) {
27 SkASSERT(this->imageInfo().bounds().contains(r));
28 }
29 return r;
30}
#define SkASSERT(cond)
Definition SkAssert.h:116
static bool contains(const SkRect &r, SkPoint p)
SkRect bounds(const SkIRect &deviceBounds) const
const SkImageInfo & imageInfo() const
Definition SkDevice.h:117
bool isEmpty() const
Definition SkRect.h:202
void roundOut(SkIRect *dst) const
Definition SkRect.h:1241

◆ isClipAntiAliased()

bool SkClipStackDevice::isClipAntiAliased ( ) const
overridevirtual

Implements SkDevice.

Definition at line 72 of file SkClipStackDevice.cpp.

72 {
73 SkClipStack::B2TIter iter(fClipStack);
74 const SkClipStack::Element* element;
75
76 while ((element = iter.next()) != nullptr) {
77 if (element->isAA()) {
78 return true;
79 }
80 }
81 return false;
82}
bool isAA() const
Inverts the fill of the clip shape. Note that a kEmpty element remains kEmpty.

◆ isClipEmpty()

bool SkClipStackDevice::isClipEmpty ( ) const
overridevirtual

Implements SkDevice.

Definition at line 88 of file SkClipStackDevice.cpp.

88 {
89 return fClipStack.isEmpty(SkIRect::MakeWH(this->width(), this->height()));
90}
bool isEmpty(const SkIRect &deviceBounds) const
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
Definition SkRect.h:56

◆ isClipRect()

bool SkClipStackDevice::isClipRect ( ) const
overridevirtual

Implements SkDevice.

Definition at line 92 of file SkClipStackDevice.cpp.

92 {
93 if (this->isClipWideOpen()) {
94 return true;
95 } else if (this->isClipEmpty()) {
96 return false;
97 }
98
100 bool isIntersectionOfRects;
102 fClipStack.getBounds(&bounds, &boundType, &isIntersectionOfRects);
103 return isIntersectionOfRects && boundType == SkClipStack::kNormal_BoundsType;
104}
bool isClipWideOpen() const override
bool isClipEmpty() const override

◆ isClipWideOpen()

bool SkClipStackDevice::isClipWideOpen ( ) const
overridevirtual

Implements SkDevice.

Definition at line 84 of file SkClipStackDevice.cpp.

84 {
85 return fClipStack.quickContains(SkRect::MakeIWH(this->width(), this->height()));
86}
bool quickContains(const SkRect &devRect) const
static SkRect MakeIWH(int w, int h)
Definition SkRect.h:623

◆ onClipShader()

void SkClipStackDevice::onClipShader ( sk_sp< SkShader shader)
overrideprivatevirtual

Implements SkDevice.

Definition at line 54 of file SkClipStackDevice.cpp.

54 {
55 fClipStack.clipShader(std::move(shader));
56}
void clipShader(sk_sp< SkShader >)

◆ popClipStack()

void SkClipStackDevice::popClipStack ( )
overridevirtual

Implements SkDevice.

Definition at line 38 of file SkClipStackDevice.cpp.

38 {
39 fClipStack.restore();
40}

◆ pushClipStack()

void SkClipStackDevice::pushClipStack ( )
overridevirtual

Implements SkDevice.

Definition at line 34 of file SkClipStackDevice.cpp.

34 {
35 fClipStack.save();
36}

◆ replaceClip()

void SkClipStackDevice::replaceClip ( const SkIRect rect)
overridevirtual

Implements SkDevice.

Definition at line 67 of file SkClipStackDevice.cpp.

67 {
68 SkRect deviceRect = SkMatrixPriv::MapRect(this->globalToDevice(), SkRect::Make(rect));
69 fClipStack.replaceClip(deviceRect, /*doAA=*/false);
70}
void replaceClip(const SkRect &devRect, bool doAA)
const SkM44 & globalToDevice() const
Definition SkDevice.h:191
static SkRect MapRect(const SkM44 &m, const SkRect &r)
Definition SkM44.cpp:216
static SkRect Make(const SkISize &size)
Definition SkRect.h:669

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