Chromium Code Reviews| Index: src/gpu/GrGpuResourceCacheAccess.h |
| diff --git a/src/gpu/GrGpuResourceCacheAccess.h b/src/gpu/GrGpuResourceCacheAccess.h |
| index ecb73f37eca21fbbccfb3eb19d8967e84f821702..7742aef5b03dab7c4191543097479f7a2aebcad5 100644 |
| --- a/src/gpu/GrGpuResourceCacheAccess.h |
| +++ b/src/gpu/GrGpuResourceCacheAccess.h |
| @@ -29,6 +29,11 @@ public: |
| } |
| /** |
| + * Changes whether the resource counts against the resource cache budget. |
| + */ |
| + void setBudgeted(bool countsAgainstBudget) { fResource->setBudgeted(countsAgainstBudget); } |
|
bsalomon
2014/11/13 19:20:54
This class provides privileged access the parts of
|
| + |
| + /** |
| * Is the resource currently cached as scratch? This means it has a valid scratch key and does |
| * not have a content key. |
| */ |
| @@ -48,14 +53,26 @@ public: |
| * If the resource is currently cached by a content key, the key is returned, otherwise NULL. |
| */ |
| const GrResourceKey* getContentKey() const { |
| - if (fResource->fContentKeySet) { |
| + if (fResource->fFlags & GrGpuResource::kContentKeySet_Flag) { |
| return &fResource->fContentKey; |
| } |
| return NULL; |
| } |
| + /** |
| + * Is the resource object wrapping an externally allocated GPU resource? |
| + */ |
| bool isWrapped() const { return fResource->isWrapped(); } |
| + /** |
| + * Does the resource count against the resource budget? |
| + */ |
| + bool isBudgeted() const { |
| + bool ret = SkToBool(GrGpuResource::kBudgeted_Flag & fResource->fFlags); |
| + SkASSERT(!(ret && fResource->isWrapped())); |
| + return ret; |
| + } |
| + |
| private: |
| CacheAccess(GrGpuResource* resource) : fResource(resource) { } |
| CacheAccess(const CacheAccess& that) : fResource(that.fResource) { } |