diff options
author | 2014-09-29 14:20:11 -0700 | |
---|---|---|
committer | 2014-09-29 14:20:11 -0700 | |
commit | c0eb9b9818462471f5fc1c47fa549c6052d8bbae (patch) | |
tree | 9da0008e6fe68fbe2010ad14f5e6c54c7fa5008b /include/gpu/GrSurface.h | |
parent | c5e15a1afab2621e860a251c3fcf5917867ad49f (diff) |
Make "priv" classes for GrTexure and GrSurface.
R=robertphillips@google.com, egdaniel@google.com, joshualitt@google.com, joshualitt@chromium.org
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/596053002
Diffstat (limited to 'include/gpu/GrSurface.h')
-rw-r--r-- | include/gpu/GrSurface.h | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h index 24eb39a81b..23311a2f52 100644 --- a/include/gpu/GrSurface.h +++ b/include/gpu/GrSurface.h @@ -11,11 +11,12 @@ #include "GrTypes.h" #include "GrGpuResource.h" +#include "SkImageInfo.h" #include "SkRect.h" -class GrTexture; class GrRenderTarget; -struct SkImageInfo; +class GrSurfacePriv; +class GrTexture; class GrSurface : public GrGpuResource { public: @@ -59,8 +60,6 @@ public: */ const GrTextureDesc& desc() const { return fDesc; } - SkImageInfo info() const; - /** * @return the texture associated with the surface, may be NULL. */ @@ -74,22 +73,6 @@ public: virtual const GrRenderTarget* asRenderTarget() const = 0; /** - * Checks whether this GrSurface refers to the same GPU object as other. This - * catches the case where a GrTexture and GrRenderTarget refer to the same - * GPU memory. - */ - bool isSameAs(const GrSurface* other) const { - const GrRenderTarget* thisRT = this->asRenderTarget(); - if (thisRT) { - return thisRT == other->asRenderTarget(); - } else { - const GrTexture* thisTex = this->asTexture(); - SkASSERT(thisTex); // We must be one or the other - return thisTex == other->asTexture(); - } - } - - /** * Reads a rectangle of pixels from the surface. * @param left left edge of the rectangle to read (inclusive) * @param top top edge of the rectangle to read (inclusive) @@ -129,17 +112,22 @@ public: size_t rowBytes = 0, uint32_t pixelOpsFlags = 0) = 0; - /** - * Write the contents of the surface to a PNG. Returns true if successful. - * @param filename Full path to desired file - */ - bool savePixels(const char* filename); + /** Access methods that are only to be used within Skia code. */ + inline GrSurfacePriv surfacePriv(); + inline const GrSurfacePriv surfacePriv() const; +protected: + // Methods made available via GrSurfacePriv + SkImageInfo info() const; + bool savePixels(const char* filename); bool hasPendingRead() const; bool hasPendingWrite() const; bool hasPendingIO() const; + bool isSameAs(const GrSurface* other) const; + + // Provides access to methods that should be public within Skia code. + friend class GrSurfacePriv; -protected: GrSurface(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc) : INHERITED(gpu, isWrapped) , fDesc(desc) { @@ -151,4 +139,4 @@ private: typedef GrGpuResource INHERITED; }; -#endif // GrSurface_DEFINED +#endif |