Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Unified Diff: include/gpu/GrTexture.h

Issue 596053002: Make "priv" classes for GrTexure and GrSurface. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add SK_API Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/gpu/GrSurface.h ('k') | src/gpu/GrBitmapTextContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrTexture.h
diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h
index 06ba2e41086f06915d72f5c5f80a50e264e64e13..8bdff34df5ee311a84401b4c19f8bca1d20186d4 100644
--- a/include/gpu/GrTexture.h
+++ b/include/gpu/GrTexture.h
@@ -16,7 +16,7 @@
class GrResourceKey;
class GrTextureParams;
-class GrTextureImpl;
+class GrTexturePriv;
class GrTexture : public GrSurface {
public:
@@ -44,19 +44,6 @@ public:
virtual const GrRenderTarget* asRenderTarget() const SK_OVERRIDE { return fRenderTarget.get(); }
/**
- * Convert from texels to normalized texture coords for POT textures only. Please don't add
- * new callsites for these functions. They are slated for removal.
- */
- SkFixed normalizeFixedX(SkFixed x) const {
- SkASSERT(SkIsPow2(fDesc.fWidth));
- return x >> fShiftFixedX;
- }
- SkFixed normalizeFixedY(SkFixed y) const {
- SkASSERT(SkIsPow2(fDesc.fHeight));
- return y >> fShiftFixedY;
- }
-
- /**
* Return the native ID or handle to the texture, depending on the
* platform. e.g. on OpenGL, return the texture ID.
*/
@@ -67,11 +54,9 @@ public:
* changed externally to Skia.
*/
virtual void textureParamsModified() = 0;
- SK_ATTR_DEPRECATED("Renamed to textureParamsModified.")
- void invalidateCachedState() { this->textureParamsModified(); }
/**
- * Informational texture flags. This will be moved to the private GrTextureImpl class soon.
+ * Informational texture flags. This will be removed soon.
*/
enum FlagBits {
kFirstBit = (kLastPublic_GrTextureFlagBit << 1),
@@ -94,21 +79,16 @@ public:
}
#endif
- GrTextureImpl* impl() { return reinterpret_cast<GrTextureImpl*>(this); }
- const GrTextureImpl* impl() const { return reinterpret_cast<const GrTextureImpl*>(this); }
+ /** Access methods that are only to be used within Skia code. */
+ inline GrTexturePriv texturePriv();
+ inline const GrTexturePriv texturePriv() const;
protected:
// A texture refs its rt representation but not vice-versa. It is up to
// the subclass constructor to initialize this pointer.
SkAutoTUnref<GrRenderTarget> fRenderTarget;
- GrTexture(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc)
- : INHERITED(gpu, isWrapped, desc)
- , fRenderTarget(NULL) {
- // only make sense if alloc size is pow2
- fShiftFixedX = 31 - SkCLZ(fDesc.fWidth);
- fShiftFixedY = 31 - SkCLZ(fDesc.fHeight);
- }
+ GrTexture(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc);
virtual ~GrTexture();
@@ -121,60 +101,23 @@ protected:
private:
void abandonReleaseCommon();
virtual void internal_dispose() const SK_OVERRIDE;
-
- // these two shift a fixed-point value into normalized coordinates
- // for this texture if the texture is power of two sized.
- int fShiftFixedX;
- int fShiftFixedY;
-
- typedef GrSurface INHERITED;
-};
-
-class GrTextureImpl : public GrTexture {
-public:
- SK_DECLARE_INST_COUNT(GrTextureImpl)
-
- void setFlag(GrTextureFlags flags) {
- fDesc.fFlags = fDesc.fFlags | flags;
- }
- void resetFlag(GrTextureFlags flags) {
- fDesc.fFlags = fDesc.fFlags & ~flags;
- }
- bool isSetFlag(GrTextureFlags flags) const {
- return 0 != (fDesc.fFlags & flags);
- }
-
void dirtyMipMaps(bool mipMapsDirty);
- bool mipMapsAreDirty() const {
- return kValid_MipMapsStatus != fMipMapsStatus;
- }
-
- bool hasMipMaps() const {
- return kNotAllocated_MipMapsStatus != fMipMapsStatus;
- }
-
- static GrResourceKey ComputeKey(const GrGpu* gpu,
- const GrTextureParams* params,
- const GrTextureDesc& desc,
- const GrCacheID& cacheID);
- static GrResourceKey ComputeScratchKey(const GrTextureDesc& desc);
- static bool NeedsResizing(const GrResourceKey& key);
- static bool NeedsBilerp(const GrResourceKey& key);
-
-protected:
- GrTextureImpl(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc);
-
-private:
enum MipMapsStatus {
kNotAllocated_MipMapsStatus,
kAllocated_MipMapsStatus,
kValid_MipMapsStatus
};
- MipMapsStatus fMipMapsStatus;
+ MipMapsStatus fMipMapsStatus;
+ // These two shift a fixed-point value into normalized coordinates
+ // for this texture if the texture is power of two sized.
+ int fShiftFixedX;
+ int fShiftFixedY;
+
+ friend class GrTexturePriv;
- typedef GrTexture INHERITED;
+ typedef GrSurface INHERITED;
};
/**
« no previous file with comments | « include/gpu/GrSurface.h ('k') | src/gpu/GrBitmapTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698