8 #ifndef SkSurface_DEFINED
9 #define SkSurface_DEFINED
13 #include "SkSurfaceProps.h"
50 void (*releaseProc)(
void* pixels,
void* context),
69 return MakeRaster(info, 0, props);
118 return MakeFromBackendTexture(ctx, desc,
nullptr, props);
124 return MakeFromBackendRenderTarget(ctx, desc,
nullptr, props);
129 return MakeFromBackendTextureAsRenderTarget(ctx, desc,
nullptr, props);
138 int sampleCount, GrSurfaceOrigin,
144 return MakeRenderTarget(context, budgeted, info, sampleCount,
145 kBottomLeft_GrSurfaceOrigin, props);
149 return MakeRenderTarget(gr, b, info, 0, kBottomLeft_GrSurfaceOrigin,
nullptr);
152 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
155 return MakeRasterDirect(info, pixels, rowBytes, props).
release();
159 void (*releaseProc)(
void* pixels,
void* context),
161 return MakeRasterDirectReleaseProc(info, pixels, rowBytes, releaseProc, context,
166 return MakeRaster(info, rowBytes, props).
release();
169 return MakeRaster(info, props).
release();
171 static SkSurface* NewRasterN32Premul(
int width,
int height,
177 return MakeFromBackendTexture(ctx, desc, props).release();
182 return NewFromBackendTexture(ctx, desc, props);
186 return MakeFromBackendRenderTarget(ctx, d, props).release();
191 return MakeFromBackendTextureAsRenderTarget(ctx, desc, props).release();
195 return MakeRenderTarget(ctx, b, info, sampleCount, props).release();
198 return NewRenderTarget(gr, b, info, 0);
203 int width()
const {
return fWidth; }
204 int height()
const {
return fHeight; }
215 uint32_t generationID();
239 void notifyContentWillChange(ContentChangeMode mode);
250 static const BackendHandleAccess kFlushRead_TextureHandleAccess =
251 kFlushRead_BackendHandleAccess;
252 static const BackendHandleAccess kFlushWrite_TextureHandleAccess =
253 kFlushWrite_BackendHandleAccess;
254 static const BackendHandleAccess kDiscardWrite_TextureHandleAccess =
255 kDiscardWrite_BackendHandleAccess;
265 GrBackendObject getTextureHandle(BackendHandleAccess);
273 bool getRenderTargetHandle(GrBackendObject*, BackendHandleAccess);
319 #ifdef SK_SUPPORT_LEGACY_IMAGEFACTORY
320 SkImage* newImageSnapshot(SkBudgeted budgeted = SkBudgeted::kYes) {
321 return this->makeImageSnapshot(budgeted).release();
323 SkImage* newImageSnapshot(SkBudgeted budgeted, ForceUnique force) {
324 return this->makeImageSnapshot(budgeted, force).release();
348 #ifdef SK_SUPPORT_LEGACY_PEEKPIXELS_PARMS
349 const void* peekPixels(
SkImageInfo* info,
size_t* rowBytes);
370 bool readPixels(
const SkImageInfo& dstInfo,
void* dstPixels,
size_t dstRowBytes,
378 void prepareForExternalIO();
385 void dirtyGenerationID() {
393 uint32_t fGenerationID;
T *SK_WARN_UNUSED_RESULT release()
Return the bare pointer, and set the internal object pointer to nullptr.
Definition: SkRefCnt.h:363
A Canvas encapsulates all of the state about drawing into a device (bitmap).
Definition: SkCanvas.h:58
Definition: GrTypes.h:557
Describe an image's dimensions and pixel type.
Definition: SkImageInfo.h:181
Describes properties and constraints of a given SkSurface.
Definition: SkSurfaceProps.h:51
Pairs SkImageInfo with actual pixels and rowbytes.
Definition: SkPixmap.h:23
SkSurface represents the backend/results of drawing to a canvas.
Definition: SkSurface.h:31
static sk_sp< SkSurface > MakeRaster(const SkImageInfo &info, const SkSurfaceProps *props=nullptr)
Allocate a new surface, automatically computing the rowBytes.
Definition: SkSurface.h:67
Definition: SkRefCnt.h:135
Gr can wrap an existing render target created by the client in the 3D API with a GrRenderTarget objec...
Definition: GrTypes.h:588
The SkPaint class holds the style and color information about how to draw geometries, text and bitmaps.
Definition: SkPaint.h:46
caller must over-write the entire backend object
Definition: SkSurface.h:244
static SkImageInfo MakeN32Premul(int width, int height, sk_sp< SkColorSpace > cs=nullptr)
Sets colortype to the native ARGB32 type, and the alphatype to premul.
Definition: SkImageInfo.h:212
static sk_sp< SkSurface > MakeFromBackendTexture(GrContext *ctx, const GrBackendTextureDesc &desc, const SkSurfaceProps *props)
Legacy versions of the above factories, without color space support.
Definition: SkSurface.h:116
static sk_sp< SkSurface > MakeRasterN32Premul(int width, int height, const SkSurfaceProps *props=nullptr)
Helper version of NewRaster.
Definition: SkSurface.h:77
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:258
ContentChangeMode
Modes that can be passed to notifyContentWillChange.
Definition: SkSurface.h:220
Definition: GrContext.h:48
Use this mode if prior surface contents need to be preserved or if in doubt.
Definition: SkSurface.h:230
caller may read from the backend object
Definition: SkSurface.h:242
Use this mode if it is known that the upcoming content changes will clear or overwrite prior contents...
Definition: SkSurface.h:225
ForceUnique
In rare instances a client may want a unique copy of the SkSurface's contents in an image snapshot...
Definition: SkSurface.h:313
GrRenderTarget represents a 2D buffer of pixels that can be rendered to.
Definition: GrRenderTarget.h:26
caller may write to the backend object
Definition: SkSurface.h:243
SkImage is an abstraction for drawing a rectagle of pixels, though the particular type of image could...
Definition: SkImage.h:45
BackendHandleAccess
Definition: SkSurface.h:241