| Index: src/gpu/GrGpuResourceCacheAccess.h
|
| diff --git a/src/gpu/GrGpuResourceCacheAccess.h b/src/gpu/GrGpuResourceCacheAccess.h
|
| index 33fe1ad93a36cc58e4dca4e6b30d233c07d39d2d..474438fa9ce29407c044feb5df030a40e9a7d8cb 100644
|
| --- a/src/gpu/GrGpuResourceCacheAccess.h
|
| +++ b/src/gpu/GrGpuResourceCacheAccess.h
|
| @@ -29,11 +29,12 @@ public:
|
| }
|
|
|
| /**
|
| - * Is the resource currently cached as scratch? This means it has a valid scratch key and does
|
| - * not have a content key.
|
| + * Is the resource currently cached as scratch? This means it is cached, has a valid scratch
|
| + * key, and does not have a content key.
|
| */
|
| bool isScratch() const {
|
| - return !this->getContentKey().isValid() && fResource->fScratchKey.isValid();
|
| + return !this->getContentKey().isValid() && fResource->fScratchKey.isValid() &&
|
| + this->isBudgeted();
|
| }
|
|
|
| /**
|
| @@ -62,7 +63,11 @@ public:
|
| /**
|
| * Does the resource count against the resource budget?
|
| */
|
| - bool isBudgeted() const { return GrGpuResource::kCached_LifeCycle == fResource->fLifeCycle; }
|
| + bool isBudgeted() const {
|
| + bool ret = GrGpuResource::kCached_LifeCycle == fResource->fLifeCycle;
|
| + SkASSERT(ret || !this->getContentKey().isValid());
|
| + return ret;
|
| + }
|
|
|
| /**
|
| * If the resource is uncached make it cached. Has no effect on resources that are wrapped or
|
| @@ -71,6 +76,12 @@ public:
|
| void makeBudgeted() { fResource->makeBudgeted(); }
|
|
|
| /**
|
| + * If the resource is cached make it uncached. Has no effect on resources that are wrapped or
|
| + * already uncached. Furthermore, resources with content keys cannot be made unbudgeted.
|
| + */
|
| + void makeUnbudgeted() { fResource->makeUnbudgeted(); }
|
| +
|
| + /**
|
| * Called by the cache to delete the resource under normal circumstances.
|
| */
|
| void release() {
|
|
|