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

Unified Diff: include/gpu/GrTexture.h

Issue 257093002: Add size change notifications to GrResourceCache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 years, 7 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/GrCacheable.h ('k') | src/gpu/GrResourceCache.h » ('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 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;
« no previous file with comments | « include/gpu/GrCacheable.h ('k') | src/gpu/GrResourceCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698