Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
SkNullSurface Class Reference
Inheritance diagram for SkNullSurface:
SkSurface_Base SkSurface SkRefCnt SkRefCntBase

Public Member Functions

 SkNullSurface (int width, int height)
 
SkSurface_Base::Type type () const override
 
- Public Member Functions inherited from SkSurface_Base
 SkSurface_Base (int width, int height, const SkSurfaceProps *)
 
 SkSurface_Base (const SkImageInfo &, const SkSurfaceProps *)
 
 ~SkSurface_Base () override
 
bool replaceBackendTexture (const GrBackendTexture &, GrSurfaceOrigin, ContentChangeMode, TextureReleaseProc, ReleaseContext) override
 
virtual Type type () const
 
bool isRasterBacked () const
 
bool isGaneshBacked () const
 
bool isGraphiteBacked () const
 
virtual GrRecordingContextonGetRecordingContext () const
 
virtual skgpu::graphite::RecorderonGetRecorder () const
 
virtual SkCanvasonNewCanvas ()=0
 
virtual sk_sp< SkSurfaceonNewSurface (const SkImageInfo &)=0
 
virtual sk_sp< SkImageonNewImageSnapshot (const SkIRect *subset=nullptr)
 
virtual void onWritePixels (const SkPixmap &, int x, int y)=0
 
virtual void onAsyncRescaleAndReadPixels (const SkImageInfo &, const SkIRect srcRect, RescaleGamma, RescaleMode, ReadPixelsCallback, ReadPixelsContext)
 
virtual void onAsyncRescaleAndReadPixelsYUV420 (SkYUVColorSpace, bool readAlpha, sk_sp< SkColorSpace > dstColorSpace, SkIRect srcRect, SkISize dstSize, RescaleGamma, RescaleMode, ReadPixelsCallback, ReadPixelsContext)
 
virtual void onDraw (SkCanvas *, SkScalar x, SkScalar y, const SkSamplingOptions &, const SkPaint *)
 
virtual void onDiscard ()
 
virtual bool onCopyOnWrite (ContentChangeMode)=0
 
virtual void onRestoreBackingMutability ()
 
virtual bool onWait (int numSemaphores, const GrBackendSemaphore *waitSemaphores, bool deleteSemaphoresAfterWait)
 
virtual bool onCharacterize (GrSurfaceCharacterization *) const
 
virtual bool onIsCompatible (const GrSurfaceCharacterization &) const
 
virtual sk_sp< const SkCapabilitiesonCapabilities ()
 
SkCanvasgetCachedCanvas ()
 
sk_sp< SkImagerefCachedImage ()
 
bool hasCachedImage () const
 
uint32_t newGenerationID ()
 
- Public Member Functions inherited from SkSurface
bool isCompatible (const GrSurfaceCharacterization &characterization) const
 
int width () const
 
int height () const
 
virtual SkImageInfo imageInfo () const
 
uint32_t generationID ()
 
void notifyContentWillChange (ContentChangeMode mode)
 
GrRecordingContextrecordingContext () const
 
skgpu::graphite::Recorderrecorder () const
 
virtual bool replaceBackendTexture (const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, ContentChangeMode mode=kRetain_ContentChangeMode, TextureReleaseProc=nullptr, ReleaseContext=nullptr)=0
 
SkCanvasgetCanvas ()
 
sk_sp< const SkCapabilitiescapabilities ()
 
sk_sp< SkSurfacemakeSurface (const SkImageInfo &imageInfo)
 
sk_sp< SkSurfacemakeSurface (int width, int height)
 
sk_sp< SkImagemakeImageSnapshot ()
 
sk_sp< SkImagemakeImageSnapshot (const SkIRect &bounds)
 
void draw (SkCanvas *canvas, SkScalar x, SkScalar y, const SkSamplingOptions &sampling, const SkPaint *paint)
 
void draw (SkCanvas *canvas, SkScalar x, SkScalar y, const SkPaint *paint=nullptr)
 
bool peekPixels (SkPixmap *pixmap)
 
bool readPixels (const SkPixmap &dst, int srcX, int srcY)
 
bool readPixels (const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY)
 
bool readPixels (const SkBitmap &dst, int srcX, int srcY)
 
void asyncRescaleAndReadPixels (const SkImageInfo &info, const SkIRect &srcRect, RescaleGamma rescaleGamma, RescaleMode rescaleMode, ReadPixelsCallback callback, ReadPixelsContext context)
 
void asyncRescaleAndReadPixelsYUV420 (SkYUVColorSpace yuvColorSpace, sk_sp< SkColorSpace > dstColorSpace, const SkIRect &srcRect, const SkISize &dstSize, RescaleGamma rescaleGamma, RescaleMode rescaleMode, ReadPixelsCallback callback, ReadPixelsContext context)
 
void asyncRescaleAndReadPixelsYUVA420 (SkYUVColorSpace yuvColorSpace, sk_sp< SkColorSpace > dstColorSpace, const SkIRect &srcRect, const SkISize &dstSize, RescaleGamma rescaleGamma, RescaleMode rescaleMode, ReadPixelsCallback callback, ReadPixelsContext context)
 
void writePixels (const SkPixmap &src, int dstX, int dstY)
 
void writePixels (const SkBitmap &src, int dstX, int dstY)
 
const SkSurfacePropsprops () const
 
bool wait (int numSemaphores, const GrBackendSemaphore *waitSemaphores, bool deleteSemaphoresAfterWait=true)
 
bool characterize (GrSurfaceCharacterization *characterization) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Protected Member Functions

SkCanvasonNewCanvas () override
 
sk_sp< SkSurfaceonNewSurface (const SkImageInfo &info) override
 
sk_sp< SkImageonNewImageSnapshot (const SkIRect *subsetOrNull) override
 
void onWritePixels (const SkPixmap &, int x, int y) override
 
void onDraw (SkCanvas *, SkScalar, SkScalar, const SkSamplingOptions &, const SkPaint *) override
 
bool onCopyOnWrite (ContentChangeMode) override
 
sk_sp< const SkCapabilitiesonCapabilities () override
 
SkImageInfo imageInfo () const override
 
- Protected Member Functions inherited from SkSurface
 SkSurface (int width, int height, const SkSurfaceProps *surfaceProps)
 
 SkSurface (const SkImageInfo &imageInfo, const SkSurfaceProps *surfaceProps)
 
void dirtyGenerationID ()
 

Additional Inherited Members

- Public Types inherited from SkSurface_Base
enum class  Type { kNull , kGanesh , kGraphite , kRaster }
 
- Public Types inherited from SkSurface
enum  ContentChangeMode { kDiscard_ContentChangeMode , kRetain_ContentChangeMode }
 
enum class  BackendHandleAccess {
  kFlushRead , kFlushWrite , kDiscardWrite , kFlushRead_BackendHandleAccess = kFlushRead ,
  kFlushWrite_BackendHandleAccess = kFlushWrite , kDiscardWrite_BackendHandleAccess = kDiscardWrite
}
 
using ReleaseContext = void *
 
using TextureReleaseProc = void(*)(ReleaseContext)
 
using AsyncReadResult = SkImage::AsyncReadResult
 
using ReadPixelsContext = void *
 
using ReadPixelsCallback = void(ReadPixelsContext, std::unique_ptr< const AsyncReadResult >)
 
using RescaleGamma = SkImage::RescaleGamma
 
using RescaleMode = SkImage::RescaleMode
 
- Static Public Attributes inherited from SkSurface
static constexpr BackendHandleAccess kFlushRead_BackendHandleAccess
 
static constexpr BackendHandleAccess kFlushWrite_BackendHandleAccess
 
static constexpr BackendHandleAccess kDiscardWrite_BackendHandleAccess
 

Detailed Description

Definition at line 23 of file SkSurface_Null.cpp.

Constructor & Destructor Documentation

◆ SkNullSurface()

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

Definition at line 25 of file SkSurface_Null.cpp.

25: SkSurface_Base(width, height, nullptr) {}
SkSurface_Base(int width, int height, const SkSurfaceProps *)
int width() const
Definition: SkSurface.h:178
int height() const
Definition: SkSurface.h:184

Member Function Documentation

◆ imageInfo()

SkImageInfo SkNullSurface::imageInfo ( ) const
inlineoverrideprotectedvirtual

Returns an ImageInfo describing the surface.

Reimplemented from SkSurface.

Definition at line 45 of file SkSurface_Null.cpp.

45 {
46 return SkImageInfo::MakeUnknown(this->width(), this->height());
47 }
static SkImageInfo MakeUnknown()
Definition: SkImageInfo.h:357

◆ onCapabilities()

sk_sp< const SkCapabilities > SkNullSurface::onCapabilities ( )
inlineoverrideprotectedvirtual

Reimplemented from SkSurface_Base.

Definition at line 41 of file SkSurface_Null.cpp.

41 {
42 // Not really, but we have to return *something*
44 }
static sk_sp< const SkCapabilities > RasterBackend()

◆ onCopyOnWrite()

bool SkNullSurface::onCopyOnWrite ( ContentChangeMode  )
inlineoverrideprotectedvirtual

If the surface is about to change, we call this so that our subclass can optionally fork their backend (copy-on-write) in case it was being shared with the cachedImage.

Returns false if the backing cannot be un-shared.

Implements SkSurface_Base.

Definition at line 40 of file SkSurface_Null.cpp.

40{ return true; }

◆ onDraw()

void SkNullSurface::onDraw ( SkCanvas canvas,
SkScalar  x,
SkScalar  y,
const SkSamplingOptions sampling,
const SkPaint paint 
)
inlineoverrideprotectedvirtual

Default implementation:

image = this->newImageSnapshot(); if (image) { image->draw(canvas, ...); image->unref(); }

Reimplemented from SkSurface_Base.

Definition at line 39 of file SkSurface_Null.cpp.

39{}

◆ onNewCanvas()

SkCanvas * SkNullSurface::onNewCanvas ( )
inlineoverrideprotectedvirtual

Allocate a canvas that will draw into this surface. We will cache this canvas, to return the same object to the caller multiple times. We take ownership, and will call unref() on the canvas when we go out of scope.

Implements SkSurface_Base.

Definition at line 31 of file SkSurface_Null.cpp.

31 {
32 return new SkNoDrawCanvas(this->width(), this->height());
33 }

◆ onNewImageSnapshot()

sk_sp< SkImage > SkNullSurface::onNewImageSnapshot ( const SkIRect subset)
inlineoverrideprotectedvirtual

Allocate an SkImage that represents the current contents of the surface. This needs to be able to outlive the surface itself (if need be), and must faithfully represent the current contents, even if the surface is changed after this called (e.g. it is drawn to via its canvas).

If a subset is specified, the the impl must make a copy, rather than try to wait on copy-on-write.

Reimplemented from SkSurface_Base.

Definition at line 37 of file SkSurface_Null.cpp.

37{ return nullptr; }

◆ onNewSurface()

sk_sp< SkSurface > SkNullSurface::onNewSurface ( const SkImageInfo info)
inlineoverrideprotectedvirtual

Implements SkSurface_Base.

Definition at line 34 of file SkSurface_Null.cpp.

34 {
35 return SkSurfaces::Null(info.width(), info.height());
36 }
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
SK_API sk_sp< SkSurface > Null(int width, int height)

◆ onWritePixels()

void SkNullSurface::onWritePixels ( const SkPixmap ,
int  x,
int  y 
)
inlineoverrideprotectedvirtual

Implements SkSurface_Base.

Definition at line 38 of file SkSurface_Null.cpp.

38{}

◆ type()

SkSurface_Base::Type SkNullSurface::type ( ) const
inlineoverridevirtual

Reimplemented from SkSurface_Base.

Definition at line 28 of file SkSurface_Null.cpp.


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