9 #ifndef GrSurface_DEFINED
10 #define GrSurface_DEFINED
13 #include "GrGpuResource.h"
14 #include "SkImageInfo.h"
26 int width()
const {
return fWidth; }
31 int height()
const {
return fHeight; }
38 GrSurfaceOrigin origin()
const {
39 SkASSERT(kTopLeft_GrSurfaceOrigin == fOrigin || kBottomLeft_GrSurfaceOrigin == fOrigin);
49 GrPixelConfig
config()
const {
return fConfig; }
55 virtual const GrTexture* asTexture()
const {
return nullptr; }
61 virtual const GrRenderTarget* asRenderTarget()
const {
return nullptr; }
64 inline GrSurfacePriv surfacePriv();
65 inline const GrSurfacePriv surfacePriv()
const;
67 static size_t WorstCaseSize(
const GrSurfaceDesc& desc,
bool useNextPow2 =
false);
68 static size_t ComputeSize(GrPixelConfig config,
int width,
int height,
int colorSamplesPerPixel,
69 bool hasMIPMaps,
bool useNextPow2 =
false);
73 bool hasPendingRead()
const;
74 bool hasPendingWrite()
const;
75 bool hasPendingIO()
const;
78 friend class GrSurfacePriv;
82 , fConfig(desc.fConfig)
84 , fHeight(desc.fHeight)
85 , fOrigin(desc.fOrigin) {}
93 GrPixelConfig fConfig;
96 GrSurfaceOrigin fOrigin;
Base class for objects that can be kept in the GrResourceCache.
Definition: GrGpuResource.h:144
virtual void onAbandon()
Overridden to abandon any internal handles, ptrs, etc to backend API resources.
Definition: GrGpuResource.h:273
Describes a surface to be created.
Definition: GrTypes.h:589
virtual void onRelease()
Overridden to free GPU resources in the backend API.
Definition: GrGpuResource.h:269
virtual GrRenderTarget * asRenderTarget()
Definition: GrSurface.h:60
virtual GrTexture * asTexture()
Definition: GrSurface.h:54
Definition: GrSurface.h:21
int width() const
Retrieves the width of the surface.
Definition: GrSurface.h:26
SkRect getBoundsRect() const
Helper that gets the width and height of the surface as a bounding rectangle.
Definition: GrSurface.h:36
int height() const
Retrieves the height of the surface.
Definition: GrSurface.h:31
GrPixelConfig config() const
Retrieves the pixel config specified when the surface was created.
Definition: GrSurface.h:49
GrRenderTarget represents a 2D buffer of pixels that can be rendered to.
Definition: GrRenderTarget.h:26
Definition: GrTexture.h:19