Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Protected Member Functions | List of all members
SkNoPixelsDevice Class Reference

#include <SkDevice.h>

Inheritance diagram for SkNoPixelsDevice:
SkDevice SkRefCnt SkRefCntBase GlyphTrackingDevice

Public Member Functions

 SkNoPixelsDevice (const SkIRect &bounds, const SkSurfaceProps &props)
 
 SkNoPixelsDevice (const SkIRect &bounds, const SkSurfaceProps &props, sk_sp< SkColorSpace > colorSpace)
 
bool resetForNextPicture (const SkIRect &bounds)
 
void pushClipStack () override
 
void popClipStack () override
 
void clipRect (const SkRect &rect, SkClipOp op, bool aa) override
 
void clipRRect (const SkRRect &rrect, SkClipOp op, bool aa) override
 
void clipPath (const SkPath &path, SkClipOp op, bool aa) override
 
void clipRegion (const SkRegion &globalRgn, SkClipOp op) override
 
void replaceClip (const SkIRect &rect) override
 
bool isClipAntiAliased () const override
 
bool isClipEmpty () const override
 
bool isClipRect () const override
 
bool isClipWideOpen () const override
 
void android_utils_clipAsRgn (SkRegion *rgn) 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
 
virtual SkIRect devClipBounds () const =0
 
virtual void pushClipStack ()=0
 
virtual void popClipStack ()=0
 
virtual void clipRect (const SkRect &rect, SkClipOp op, bool aa)=0
 
virtual void clipRRect (const SkRRect &rrect, SkClipOp op, bool aa)=0
 
virtual void clipPath (const SkPath &path, SkClipOp op, bool aa)=0
 
virtual void clipRegion (const SkRegion &region, SkClipOp op)=0
 
void clipShader (sk_sp< SkShader > sh, SkClipOp op)
 
virtual void replaceClip (const SkIRect &rect)=0
 
virtual bool isClipAntiAliased () const =0
 
virtual bool isClipEmpty () const =0
 
virtual bool isClipRect () const =0
 
virtual bool isClipWideOpen () const =0
 
virtual void android_utils_clipAsRgn (SkRegion *) const =0
 
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 SkArc &arc, 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
 

Protected Member Functions

void drawPaint (const SkPaint &paint) override
 
void drawPoints (SkCanvas::PointMode, size_t, const SkPoint[], const SkPaint &) override
 
void drawImageRect (const SkImage *, const SkRect *, const SkRect &, const SkSamplingOptions &, const SkPaint &, SkCanvas::SrcRectConstraint) override
 
void drawRect (const SkRect &, const SkPaint &) override
 
void drawOval (const SkRect &, const SkPaint &) override
 
void drawRRect (const SkRRect &, const SkPaint &) override
 
void drawPath (const SkPath &, const SkPaint &, bool) override
 
void drawDevice (SkDevice *, const SkSamplingOptions &, const SkPaint &) override
 
void drawVertices (const SkVertices *, sk_sp< SkBlender >, const SkPaint &, bool) override
 
void drawMesh (const SkMesh &, sk_sp< SkBlender >, const SkPaint &) override
 
void drawSlug (SkCanvas *, const sktext::gpu::Slug *, const SkPaint &) override
 
void onDrawGlyphRunList (SkCanvas *, const sktext::GlyphRunList &, const SkPaint &) override
 
bool isNoPixelsDevice () const override
 
- 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 569 of file SkDevice.h.

Constructor & Destructor Documentation

◆ SkNoPixelsDevice() [1/2]

SkNoPixelsDevice::SkNoPixelsDevice ( const SkIRect bounds,
const SkSurfaceProps props 
)

Definition at line 512 of file SkDevice.cpp.

513 : SkNoPixelsDevice(bounds, props, nullptr) {}
SkIRect bounds() const
Definition: SkDevice.h:125
SkNoPixelsDevice(const SkIRect &bounds, const SkSurfaceProps &props)
Definition: SkDevice.cpp:512

◆ SkNoPixelsDevice() [2/2]

SkNoPixelsDevice::SkNoPixelsDevice ( const SkIRect bounds,
const SkSurfaceProps props,
sk_sp< SkColorSpace colorSpace 
)

Definition at line 515 of file SkDevice.cpp.

518 std::move(colorSpace)), props) {
519 // this fails if we enable this assert: DiscardableImageMapTest.GetDiscardableImagesInRectMaxImage
520 //SkASSERT(bounds.width() >= 0 && bounds.height() >= 0);
521
522 this->setOrigin(SkM44(), bounds.left(), bounds.top());
523 fClipStack.emplace_back(this->bounds(), /*isAA=*/false, /*isRect=*/true);
524}
@ kUnknown_SkAlphaType
uninitialized
Definition: SkAlphaType.h:27
@ kUnknown_SkColorType
uninitialized
Definition: SkColorType.h:20
SkDevice(const SkImageInfo &, const SkSurfaceProps &)
Definition: SkDevice.cpp:45
void setOrigin(const SkM44 &globalCTM, int x, int y)
Definition: SkDevice.h:508
Definition: SkM44.h:150
T & emplace_back(Args &&... args)
Definition: SkTArray.h:248
constexpr int32_t top() const
Definition: SkRect.h:120
constexpr SkISize size() const
Definition: SkRect.h:172
constexpr int32_t left() const
Definition: SkRect.h:113
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)

Member Function Documentation

◆ android_utils_clipAsRgn()

void SkNoPixelsDevice::android_utils_clipAsRgn ( SkRegion rgn) const
inlineoverridevirtual

Implements SkDevice.

Definition at line 594 of file SkDevice.h.

594 {
595 rgn->setRect(this->devClipBounds());
596 }
SkIRect devClipBounds() const override
Definition: SkDevice.h:597
bool setRect(const SkIRect &rect)
Definition: SkRegion.cpp:192

◆ clipPath()

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

Implements SkDevice.

Definition at line 586 of file SkDevice.cpp.

586 {
587 // Toggle op if the path is inverse filled
588 if (path.isInverseFillType()) {
590 }
591 this->writableClip().op(op, this->localToDevice44(), path.getBounds(),
592 aa, /*fillsBounds=*/false);
593}
const SkM44 & localToDevice44() const
Definition: SkDevice.h:178
const SkRect & getBounds() const
Definition: SkPath.cpp:430
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

◆ clipRect()

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

Implements SkDevice.

Definition at line 576 of file SkDevice.cpp.

576 {
577 this->writableClip().op(op, this->localToDevice44(), rect,
578 aa, /*fillsBounds=*/true);
579}

◆ clipRegion()

void SkNoPixelsDevice::clipRegion ( const SkRegion globalRgn,
SkClipOp  op 
)
overridevirtual

Implements SkDevice.

Definition at line 595 of file SkDevice.cpp.

595 {
596 this->writableClip().op(op, this->globalToDevice(), SkRect::Make(globalRgn.getBounds()),
597 /*isAA=*/false, /*fillsBounds=*/globalRgn.isRect());
598}
const SkM44 & globalToDevice() const
Definition: SkDevice.h:191
bool isRect() const
Definition: SkRegion.h:152
const SkIRect & getBounds() const
Definition: SkRegion.h:165
static SkRect Make(const SkISize &size)
Definition: SkRect.h:669

◆ clipRRect()

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

Implements SkDevice.

Definition at line 581 of file SkDevice.cpp.

581 {
582 this->writableClip().op(op, this->localToDevice44(), rrect.getBounds(),
583 aa, /*fillsBounds=*/rrect.isRect());
584}
bool isRect() const
Definition: SkRRect.h:84
const SkRect & getBounds() const
Definition: SkRRect.h:279
SkRRect rrect
Definition: SkRecords.h:232

◆ devClipBounds()

SkIRect SkNoPixelsDevice::devClipBounds ( ) const
inlineoverridevirtual

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 597 of file SkDevice.h.

597{ return this->clip().fClipBounds; }

◆ drawDevice()

void SkNoPixelsDevice::drawDevice ( SkDevice device,
const SkSamplingOptions sampling,
const SkPaint paint 
)
inlineoverrideprotectedvirtual

The SkDevice passed will be an SkDevice which was returned by a call to onCreateDevice on this device with kNeverTile_TileExpectation.

The default implementation calls snapSpecial() and drawSpecial() with the relative transform from the input device to this device. The provided SkPaint cannot have a mask filter or image filter, and any shader is ignored.

Reimplemented from SkDevice.

Definition at line 610 of file SkDevice.h.

610{}

◆ drawImageRect()

void SkNoPixelsDevice::drawImageRect ( const SkImage ,
const SkRect ,
const SkRect ,
const SkSamplingOptions ,
const SkPaint ,
SkCanvas::SrcRectConstraint   
)
inlineoverrideprotectedvirtual

Implements SkDevice.

Definition at line 603 of file SkDevice.h.

605 {}

◆ drawMesh()

void SkNoPixelsDevice::drawMesh ( const SkMesh ,
sk_sp< SkBlender ,
const SkPaint  
)
inlineoverrideprotectedvirtual

Implements SkDevice.

Definition at line 612 of file SkDevice.h.

612{}

◆ drawOval()

void SkNoPixelsDevice::drawOval ( const SkRect ,
const SkPaint  
)
inlineoverrideprotectedvirtual

Implements SkDevice.

Definition at line 607 of file SkDevice.h.

607{}

◆ drawPaint()

void SkNoPixelsDevice::drawPaint ( const SkPaint paint)
inlineoverrideprotectedvirtual

Implements SkDevice.

Definition at line 601 of file SkDevice.h.

601{}

◆ drawPath()

void SkNoPixelsDevice::drawPath ( const SkPath path,
const SkPaint paint,
bool  pathIsMutable 
)
inlineoverrideprotectedvirtual

If pathIsMutable, then the implementation is allowed to cast path to a non-const pointer and modify it in place (as an optimization). Canvas may do this to implement helpers such as drawOval, by placing a temp path on the stack to hold the representation of the oval.

Implements SkDevice.

Definition at line 609 of file SkDevice.h.

609{}

◆ drawPoints()

void SkNoPixelsDevice::drawPoints ( SkCanvas::PointMode  ,
size_t  ,
const  SkPoint[],
const SkPaint  
)
inlineoverrideprotectedvirtual

Implements SkDevice.

Definition at line 602 of file SkDevice.h.

602{}

◆ drawRect()

void SkNoPixelsDevice::drawRect ( const SkRect ,
const SkPaint  
)
inlineoverrideprotectedvirtual

Implements SkDevice.

Definition at line 606 of file SkDevice.h.

606{}

◆ drawRRect()

void SkNoPixelsDevice::drawRRect ( const SkRRect ,
const SkPaint  
)
inlineoverrideprotectedvirtual

Implements SkDevice.

Definition at line 608 of file SkDevice.h.

608{}

◆ drawSlug()

void SkNoPixelsDevice::drawSlug ( SkCanvas ,
const sktext::gpu::Slug ,
const SkPaint  
)
inlineoverrideprotectedvirtual

Reimplemented from SkDevice.

Definition at line 614 of file SkDevice.h.

614{}

◆ drawVertices()

void SkNoPixelsDevice::drawVertices ( const SkVertices ,
sk_sp< SkBlender ,
const SkPaint ,
bool  skipColorXform 
)
inlineoverrideprotectedvirtual

If skipColorXform is true, then the implementation should assume that the provided vertex colors are already in the destination color space.

Implements SkDevice.

Definition at line 611 of file SkDevice.h.

611{}

◆ isClipAntiAliased()

bool SkNoPixelsDevice::isClipAntiAliased ( ) const
inlineoverridevirtual

Implements SkDevice.

Definition at line 587 of file SkDevice.h.

587{ return this->clip().fIsAA; }

◆ isClipEmpty()

bool SkNoPixelsDevice::isClipEmpty ( ) const
inlineoverridevirtual

Implements SkDevice.

Definition at line 588 of file SkDevice.h.

588{ return this->devClipBounds().isEmpty(); }
bool isEmpty() const
Definition: SkRect.h:202

◆ isClipRect()

bool SkNoPixelsDevice::isClipRect ( ) const
inlineoverridevirtual

Implements SkDevice.

Definition at line 589 of file SkDevice.h.

589{ return this->clip().fIsRect && !this->isClipEmpty(); }
bool isClipEmpty() const override
Definition: SkDevice.h:588

◆ isClipWideOpen()

bool SkNoPixelsDevice::isClipWideOpen ( ) const
inlineoverridevirtual

Implements SkDevice.

Definition at line 590 of file SkDevice.h.

590 {
591 return this->clip().fIsRect &&
592 this->devClipBounds() == this->bounds();
593 }

◆ isNoPixelsDevice()

bool SkNoPixelsDevice::isNoPixelsDevice ( ) const
inlineoverrideprotectedvirtual

Reimplemented from SkDevice.

Definition at line 617 of file SkDevice.h.

617{ return true; }

◆ onDrawGlyphRunList()

void SkNoPixelsDevice::onDrawGlyphRunList ( SkCanvas ,
const sktext::GlyphRunList ,
const SkPaint  
)
inlineoverrideprotectedvirtual

Implements SkDevice.

Reimplemented in GlyphTrackingDevice.

Definition at line 615 of file SkDevice.h.

615{}

◆ popClipStack()

void SkNoPixelsDevice::popClipStack ( )
overridevirtual

Implements SkDevice.

Definition at line 551 of file SkDevice.cpp.

551 {
552 SkASSERT(!fClipStack.empty());
553 if (fClipStack.back().fDeferredSaveCount > 0) {
554 fClipStack.back().fDeferredSaveCount--;
555 } else {
556 fClipStack.pop_back();
557 SkASSERT(!fClipStack.empty());
558 }
559}
#define SkASSERT(cond)
Definition: SkAssert.h:116
bool empty() const
Definition: SkTArray.h:199

◆ pushClipStack()

void SkNoPixelsDevice::pushClipStack ( )
overridevirtual

Implements SkDevice.

Definition at line 546 of file SkDevice.cpp.

546 {
547 SkASSERT(!fClipStack.empty());
548 fClipStack.back().fDeferredSaveCount++;
549}

◆ replaceClip()

void SkNoPixelsDevice::replaceClip ( const SkIRect rect)
overridevirtual

Implements SkDevice.

Definition at line 604 of file SkDevice.cpp.

604 {
605 SkIRect deviceRect = SkMatrixPriv::MapRect(this->globalToDevice(), SkRect::Make(rect)).round();
606 if (!deviceRect.intersect(this->bounds())) {
607 deviceRect.setEmpty();
608 }
609 auto& clip = this->writableClip();
610 clip.fClipBounds = deviceRect;
611 clip.fIsRect = true;
612 clip.fIsAA = false;
613}
static SkRect MapRect(const SkM44 &m, const SkRect &r)
Definition: SkM44.cpp:216
Definition: SkRect.h:32
bool intersect(const SkIRect &r)
Definition: SkRect.h:513
void setEmpty()
Definition: SkRect.h:242
void round(SkIRect *dst) const
Definition: SkRect.h:1228

◆ resetForNextPicture()

bool SkNoPixelsDevice::resetForNextPicture ( const SkIRect bounds)

Definition at line 526 of file SkDevice.cpp.

526 {
527 // Resetting should only happen on the root SkNoPixelsDevice, so its device-to-global
528 // transform should be pixel aligned.
530 // We can only reset the device as long as its dimensions are not changing.
531 if (bounds.width() != this->width() || bounds.height() != this->height()) {
532 return false;
533 }
534
535 // And the canvas should have restored back to the original save count.
536 SkASSERT(fClipStack.size() == 1 && fClipStack[0].fDeferredSaveCount == 0);
537 // But in the event that the clip was modified w/o a save(), reset the tracking state
538 fClipStack[0].fClipBounds = this->bounds();
539 fClipStack[0].fIsAA = false;
540 fClipStack[0].fIsRect = true;
541
542 this->setOrigin(SkM44(), bounds.left(), bounds.top());
543 return true;
544}
bool isPixelAlignedToGlobal() const
Definition: SkDevice.cpp:82
int size() const
Definition: SkTArray.h:421
constexpr int32_t height() const
Definition: SkRect.h:165
constexpr int32_t width() const
Definition: SkRect.h:158

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