Index: include/gpu/GrTexture.h |
diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h |
index 1b9f7b75017adb0190ff9f503baa0ca12e9240cf..ac31f51b001b693a571022e794c15a4ccd6f59d2 100644 |
--- a/include/gpu/GrTexture.h |
+++ b/include/gpu/GrTexture.h |
@@ -44,22 +44,16 @@ public: |
return 0 != (fDesc.fFlags & flags); |
} |
- void dirtyMipMaps(bool mipMapsDirty) { |
- fMipMapsDirty = mipMapsDirty; |
- } |
+ void dirtyMipMaps(bool mipMapsDirty); |
bool mipMapsAreDirty() const { |
- return fMipMapsDirty; |
+ return kValid_MipMapsStatus != fMipMapsStatus; |
} |
/** |
* Approximate number of bytes used by the texture |
*/ |
- virtual size_t gpuMemorySize() const SK_OVERRIDE { |
- return (size_t) fDesc.fWidth * |
- fDesc.fHeight * |
- GrBytesPerPixel(fDesc.fConfig); |
- } |
+ virtual size_t gpuMemorySize() const SK_OVERRIDE; |
// GrSurface overrides |
virtual bool readPixels(int left, int top, int width, int height, |
@@ -144,7 +138,7 @@ protected: |
GrTexture(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc) |
: INHERITED(gpu, isWrapped, desc) |
, fRenderTarget(NULL) |
- , fMipMapsDirty(true) { |
+ , fMipMapsStatus(kNotAllocated_MipMapsStatus) { |
// only make sense if alloc size is pow2 |
fShiftFixedX = 31 - SkCLZ(fDesc.fWidth); |
@@ -159,12 +153,18 @@ protected: |
void validateDesc() const; |
private: |
+ enum MipMapsStatus { |
+ kNotAllocated_MipMapsStatus, |
+ kAllocated_MipMapsStatus, |
+ kValid_MipMapsStatus |
+ }; |
+ |
// 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; |
- bool fMipMapsDirty; |
+ MipMapsStatus fMipMapsStatus; |
virtual void internal_dispose() const SK_OVERRIDE; |