summaryrefslogtreecommitdiff
path: root/gpu/GrTexture.h
diff options
context:
space:
mode:
Diffstat (limited to 'gpu/GrTexture.h')
-rw-r--r--gpu/GrTexture.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/gpu/GrTexture.h b/gpu/GrTexture.h
index 1b9f7b7..ac31f51 100644
--- a/gpu/GrTexture.h
+++ b/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;