Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Private 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
 
void clipShader (sk_sp< SkShader > sh, SkClipOp op)
 
virtual bool android_utils_clipWithStencil ()
 
virtual bool useDrawCoverageMaskForMaskFilters () 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 drawRegion (const SkRegion &r, const SkPaint &paint)
 
virtual void drawArc (const SkRect &oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, const SkPaint &paint)
 
virtual void drawDRRect (const SkRRect &outer, const SkRRect &inner, const SkPaint &)
 
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 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 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 ()
 

Private Member Functions

void onClipShader (sk_sp< SkShader > shader) override
 

Detailed Description

Definition at line 570 of file SkDevice.h.

Constructor & Destructor Documentation

◆ SkNoPixelsDevice() [1/2]

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

Definition at line 517 of file SkDevice.cpp.

518 : SkNoPixelsDevice(bounds, props, nullptr) {}
SkIRect bounds() const
Definition SkDevice.h:125

◆ SkNoPixelsDevice() [2/2]

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

Definition at line 520 of file SkDevice.cpp.

523 std::move(colorSpace)), props) {
524 // this fails if we enable this assert: DiscardableImageMapTest.GetDiscardableImagesInRectMaxImage
525 //SkASSERT(bounds.width() >= 0 && bounds.height() >= 0);
526
527 this->setOrigin(SkM44(), bounds.left(), bounds.top());
528 fClipStack.emplace_back(this->bounds(), /*isAA=*/false, /*isRect=*/true);
529}
@ kUnknown_SkAlphaType
uninitialized
Definition SkAlphaType.h:27
@ kUnknown_SkColorType
uninitialized
Definition SkColorType.h:20
void setOrigin(const SkM44 &globalCTM, int x, int y)
Definition SkDevice.h:509
Definition SkM44.h:150
T & emplace_back(Args &&... args)
Definition SkTArray.h:243
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 595 of file SkDevice.h.

595 {
596 rgn->setRect(this->devClipBounds());
597 }
SkIRect devClipBounds() const override
Definition SkDevice.h:598
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 591 of file SkDevice.cpp.

591 {
592 // Toggle op if the path is inverse filled
593 if (path.isInverseFillType()) {
595 }
596 this->writableClip().op(op, this->localToDevice44(), path.getBounds(),
597 aa, /*fillsBounds=*/false);
598}
const SkM44 & localToDevice44() const
Definition SkDevice.h:178
const SkRect & getBounds() const
Definition SkPath.cpp:420
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 581 of file SkDevice.cpp.

581 {
582 this->writableClip().op(op, this->localToDevice44(), rect,
583 aa, /*fillsBounds=*/true);
584}

◆ clipRegion()

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

Implements SkDevice.

Definition at line 600 of file SkDevice.cpp.

600 {
601 this->writableClip().op(op, this->globalToDevice(), SkRect::Make(globalRgn.getBounds()),
602 /*isAA=*/false, /*fillsBounds=*/globalRgn.isRect());
603}
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 586 of file SkDevice.cpp.

586 {
587 this->writableClip().op(op, this->localToDevice44(), rrect.getBounds(),
588 aa, /*fillsBounds=*/rrect.isRect());
589}
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 598 of file SkDevice.h.

598{ 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 611 of file SkDevice.h.

611{}

◆ drawImageRect()

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

Implements SkDevice.

Definition at line 604 of file SkDevice.h.

606 {}

◆ drawMesh()

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

Implements SkDevice.

Definition at line 613 of file SkDevice.h.

613{}

◆ drawOval()

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

Implements SkDevice.

Definition at line 608 of file SkDevice.h.

608{}

◆ drawPaint()

void SkNoPixelsDevice::drawPaint ( const SkPaint paint)
inlineoverrideprotectedvirtual

Implements SkDevice.

Definition at line 602 of file SkDevice.h.

602{}

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

610{}

◆ drawPoints()

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

Implements SkDevice.

Definition at line 603 of file SkDevice.h.

603{}

◆ drawRect()

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

Implements SkDevice.

Definition at line 607 of file SkDevice.h.

607{}

◆ drawRRect()

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

Implements SkDevice.

Definition at line 609 of file SkDevice.h.

609{}

◆ drawSlug()

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

Reimplemented from SkDevice.

Definition at line 615 of file SkDevice.h.

615{}

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

612{}

◆ isClipAntiAliased()

bool SkNoPixelsDevice::isClipAntiAliased ( ) const
inlineoverridevirtual

Implements SkDevice.

Definition at line 588 of file SkDevice.h.

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

◆ isClipEmpty()

bool SkNoPixelsDevice::isClipEmpty ( ) const
inlineoverridevirtual

Implements SkDevice.

Definition at line 589 of file SkDevice.h.

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

◆ isClipRect()

bool SkNoPixelsDevice::isClipRect ( ) const
inlineoverridevirtual

Implements SkDevice.

Definition at line 590 of file SkDevice.h.

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

◆ isClipWideOpen()

bool SkNoPixelsDevice::isClipWideOpen ( ) const
inlineoverridevirtual

Implements SkDevice.

Definition at line 591 of file SkDevice.h.

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

◆ isNoPixelsDevice()

bool SkNoPixelsDevice::isNoPixelsDevice ( ) const
inlineoverrideprotectedvirtual

Reimplemented from SkDevice.

Definition at line 618 of file SkDevice.h.

618{ return true; }

◆ onClipShader()

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

Implements SkDevice.

Definition at line 605 of file SkDevice.cpp.

605 {
606 this->writableClip().fIsRect = false;
607}

◆ onDrawGlyphRunList()

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

Implements SkDevice.

Definition at line 616 of file SkDevice.h.

616{}

◆ popClipStack()

void SkNoPixelsDevice::popClipStack ( )
overridevirtual

Implements SkDevice.

Definition at line 556 of file SkDevice.cpp.

556 {
557 SkASSERT(!fClipStack.empty());
558 if (fClipStack.back().fDeferredSaveCount > 0) {
559 fClipStack.back().fDeferredSaveCount--;
560 } else {
561 fClipStack.pop_back();
562 SkASSERT(!fClipStack.empty());
563 }
564}
#define SkASSERT(cond)
Definition SkAssert.h:116
bool empty() const
Definition SkTArray.h:194

◆ pushClipStack()

void SkNoPixelsDevice::pushClipStack ( )
overridevirtual

Implements SkDevice.

Definition at line 551 of file SkDevice.cpp.

551 {
552 SkASSERT(!fClipStack.empty());
553 fClipStack.back().fDeferredSaveCount++;
554}

◆ replaceClip()

void SkNoPixelsDevice::replaceClip ( const SkIRect rect)
overridevirtual

Implements SkDevice.

Definition at line 609 of file SkDevice.cpp.

609 {
610 SkIRect deviceRect = SkMatrixPriv::MapRect(this->globalToDevice(), SkRect::Make(rect)).round();
611 if (!deviceRect.intersect(this->bounds())) {
612 deviceRect.setEmpty();
613 }
614 auto& clip = this->writableClip();
615 clip.fClipBounds = deviceRect;
616 clip.fIsRect = true;
617 clip.fIsAA = false;
618}
static SkRect MapRect(const SkM44 &m, const SkRect &r)
Definition SkM44.cpp:216
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 531 of file SkDevice.cpp.

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