8 #ifndef SkSurface_DEFINED
9 #define SkSurface_DEFINED
27 class GrSurfaceCharacterization;
82 return Raster(imageInfo, 0, props);
172 bool isCompatible(
const GrSurfaceCharacterization& characterization)
const;
178 int width()
const {
return fWidth; }
235 kFlushRead_BackendHandleAccess = kFlushRead,
236 kFlushWrite_BackendHandleAccess = kFlushWrite,
237 kDiscardWrite_BackendHandleAccess = kDiscardWrite,
242 BackendHandleAccess::kFlushRead;
244 BackendHandleAccess::kFlushWrite;
246 BackendHandleAccess::kDiscardWrite;
625 bool deleteSemaphoresAfterWait =
true);
654 uint32_t fGenerationID;
GrSurfaceOrigin
GPU SkImage and SkSurfaces can be stored such that (0, 0) in texture space may correspond to either t...
Definition: GrTypes.h:156
SkYUVColorSpace
Definition: SkImageInfo.h:68
float SkScalar
Definition: SkScalar.h:14
Wrapper class for passing into and receiving data from Ganesh about a backend semaphore object.
Definition: GrBackendSemaphore.h:34
Definition: GrBackendSurface.h:176
Definition: GrRecordingContext.h:42
SkBitmap describes a two-dimensional raster pixel array.
Definition: SkBitmap.h:59
SkCanvas provides an interface for drawing, and how the drawing is clipped and transformed.
Definition: SkCanvas.h:99
Definition: SkCapabilities.h:21
Definition: SkColorSpace.h:107
The result from asyncRescaleAndReadPixels() or asyncRescaleAndReadPixelsYUV420().
Definition: SkImage.h:552
RescaleMode
Definition: SkImage.h:578
RescaleGamma
Definition: SkImage.h:576
SkPaint controls options applied when drawing.
Definition: SkPaint.h:44
SkPixmap provides a utility to pair SkImageInfo with pixels and row bytes.
Definition: SkPixmap.h:40
size_t rowBytes() const
Returns row bytes, the interval from one pixel row to the next.
Definition: SkPixmap.h:145
void * writable_addr() const
Returns writable base pixel address.
Definition: SkPixmap.h:483
const SkImageInfo & info() const
Returns width, height, SkAlphaType, SkColorType, and SkColorSpace.
Definition: SkPixmap.h:135
Definition: SkRefCnt.h:119
Describes properties and constraints of a given SkSurface.
Definition: SkSurfaceProps.h:52
SkSurface is responsible for managing the pixels that a canvas draws into.
Definition: SkSurface.h:161
void dirtyGenerationID()
Definition: SkSurface.h:646
ContentChangeMode
Definition: SkSurface.h:203
@ kDiscard_ContentChangeMode
discards surface on change
Definition: SkSurface.h:204
@ kRetain_ContentChangeMode
preserves surface on change
Definition: SkSurface.h:205
const SkSurfaceProps & props() const
Returns SkSurfaceProps for surface.
Definition: SkSurface.h:604
bool readPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY)
Copies SkRect of pixels from SkCanvas into dstPixels.
void(ReadPixelsContext, std::unique_ptr< const AsyncReadResult >) ReadPixelsCallback
Client-provided callback to asyncRescaleAndReadPixels() or asyncRescaleAndReadPixelsYUV420() that is ...
Definition: SkSurface.h:469
int width() const
Returns pixel count in each row; may be zero or greater.
Definition: SkSurface.h:178
sk_sp< const SkCapabilities > capabilities()
Returns SkCapabilities that describes the capabilities of the SkSurface's device.
bool characterize(GrSurfaceCharacterization *characterization) const
Initializes GrSurfaceCharacterization that can be used to perform GPU back-end processing in a separa...
virtual bool replaceBackendTexture(const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, ContentChangeMode mode=kRetain_ContentChangeMode, TextureReleaseProc=nullptr, ReleaseContext=nullptr)=0
If the surface was made via MakeFromBackendTexture then it's backing texture may be substituted with ...
sk_sp< SkSurface > makeSurface(const SkImageInfo &imageInfo)
Returns a compatible SkSurface, or nullptr.
void writePixels(const SkBitmap &src, int dstX, int dstY)
Copies SkRect of pixels from the src SkBitmap to the SkSurface.
void draw(SkCanvas *canvas, SkScalar x, SkScalar y, const SkSamplingOptions &sampling, const SkPaint *paint)
Draws SkSurface contents to canvas, with its top-left corner at (x, y).
GrRecordingContext * recordingContext() const
Returns the recording context being used by the SkSurface.
void asyncRescaleAndReadPixels(const SkImageInfo &info, const SkIRect &srcRect, RescaleGamma rescaleGamma, RescaleMode rescaleMode, ReadPixelsCallback callback, ReadPixelsContext context)
Makes surface pixel data available to caller, possibly asynchronously.
bool isCompatible(const GrSurfaceCharacterization &characterization) const
Is this surface compatible with the provided characterization?
virtual SkImageInfo imageInfo() const
Returns an ImageInfo describing the surface.
Definition: SkSurface.h:188
void draw(SkCanvas *canvas, SkScalar x, SkScalar y, const SkPaint *paint=nullptr)
Definition: SkSurface.h:349
bool peekPixels(SkPixmap *pixmap)
Copies SkSurface pixel address, row bytes, and SkImageInfo to SkPixmap, if address is available,...
sk_sp< SkSurface > makeSurface(int width, int height)
Calls makeSurface(ImageInfo) with the same ImageInfo as this surface, but with the specified width an...
SkSurface(const SkImageInfo &imageInfo, const SkSurfaceProps *surfaceProps)
sk_sp< SkImage > makeImageSnapshot()
Returns SkImage capturing SkSurface contents.
int height() const
Returns pixel row count; may be zero or greater.
Definition: SkSurface.h:184
void asyncRescaleAndReadPixelsYUVA420(SkYUVColorSpace yuvColorSpace, sk_sp< SkColorSpace > dstColorSpace, const SkIRect &srcRect, const SkISize &dstSize, RescaleGamma rescaleGamma, RescaleMode rescaleMode, ReadPixelsCallback callback, ReadPixelsContext context)
Identical to asyncRescaleAndReadPixelsYUV420 but a fourth plane is returned in the AsyncReadResult pa...
void(*)(ReleaseContext) TextureReleaseProc
User function called when supplied texture may be deleted.
Definition: SkSurface.h:251
void * ReleaseContext
Caller data passed to TextureReleaseProc; may be nullptr.
Definition: SkSurface.h:249
bool readPixels(const SkBitmap &dst, int srcX, int srcY)
Copies SkRect of pixels from SkSurface into bitmap.
void asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvColorSpace, sk_sp< SkColorSpace > dstColorSpace, const SkIRect &srcRect, const SkISize &dstSize, RescaleGamma rescaleGamma, RescaleMode rescaleMode, ReadPixelsCallback callback, ReadPixelsContext context)
Similar to asyncRescaleAndReadPixels but performs an additional conversion to YUV.
SkSurface(int width, int height, const SkSurfaceProps *surfaceProps)
void writePixels(const SkPixmap &src, int dstX, int dstY)
Copies SkRect of pixels from the src SkPixmap to the SkSurface.
void notifyContentWillChange(ContentChangeMode mode)
Notifies that SkSurface contents will be changed by code outside of Skia.
BackendHandleAccess
Definition: SkSurface.h:229
bool wait(int numSemaphores, const GrBackendSemaphore *waitSemaphores, bool deleteSemaphoresAfterWait=true)
Inserts a list of GPU semaphores that the current GPU-backed API must wait on before executing any mo...
SkCanvas * getCanvas()
Returns SkCanvas that draws into SkSurface.
bool readPixels(const SkPixmap &dst, int srcX, int srcY)
Copies SkRect of pixels to dst.
void * ReadPixelsContext
Client-provided context that is passed to client-provided ReadPixelsContext.
Definition: SkSurface.h:464
skgpu::graphite::Recorder * recorder() const
Returns the recorder being used by the SkSurface.
sk_sp< SkImage > makeImageSnapshot(const SkIRect &bounds)
Like the no-parameter version, this returns an image of the current surface contents.
uint32_t generationID()
Returns unique value identifying the content of SkSurface.
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:220
void * ReleaseContext
Caller data passed to RasterReleaseProc; may be nullptr.
Definition: SkImage.h:50
Definition: SkSurface.h:42
SK_API sk_sp< SkSurface > Null(int width, int height)
Returns SkSurface without backing pixels.
void(void *pixels, void *context) PixelsReleaseProc
Definition: SkSurface.h:116
BackendSurfaceAccess
Definition: SkSurface.h:44
@ kPresent
back-end surface will be used for presenting to screen
@ kNoAccess
back-end surface will not be used by client
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
Allocates raster SkSurface.
SK_API sk_sp< SkSurface > WrapPixels(const SkImageInfo &imageInfo, void *pixels, size_t rowBytes, const SkSurfaceProps *surfaceProps=nullptr)
Allocates raster SkSurface.
Definition: SkCanvas.h:73
SkIRect holds four 32-bit integer coordinates describing the upper and lower bounds of a rectangle.
Definition: SkRect.h:32
Describes pixel dimensions and encoding.
Definition: SkImageInfo.h:194
static SkImageInfo MakeUnknown()
Creates SkImageInfo from integral dimensions width and height set to zero, kUnknown_SkColorType,...
Definition: SkImageInfo.h:343
Definition: SkSamplingOptions.h:58