Index: src/gpu/GrGpuResourceCacheAccess.h |
diff --git a/src/gpu/GrGpuResourceCacheAccess.h b/src/gpu/GrGpuResourceCacheAccess.h |
index 7d20fff4732eb687fe87bc423c8aa5c2d0427496..c55bb0777494baa3a9508107baf55d79ee86c23d 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); } |
+ |
+ /** |
* Is the resource currently cached as scratch? This means it has a valid scratch key and does |
* not have a content key. |
*/ |
@@ -48,15 +53,27 @@ 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; |
+ } |
+ |
+ /** |
* Called by the cache to delete the resource under normal circumstances. |
*/ |
void release() { |