aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-02-02 17:25:26 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-02 17:25:26 -0800
commit563ff60b33fa50b9c6a48dd048b8b36a88596668 (patch)
tree2261ccbdff97301f12545e593d0d55a6d47345e3 /src
parent6eff8701f027016fbb3147412ec2292dcec2b7f5 (diff)
make getContentKey() available in GrGpuResource public interface
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrGpuResourceCacheAccess.h9
-rw-r--r--src/gpu/GrResourceCache2.cpp16
-rw-r--r--src/gpu/GrResourceCache2.h2
3 files changed, 11 insertions, 16 deletions
diff --git a/src/gpu/GrGpuResourceCacheAccess.h b/src/gpu/GrGpuResourceCacheAccess.h
index aa2337d7f2..867252d783 100644
--- a/src/gpu/GrGpuResourceCacheAccess.h
+++ b/src/gpu/GrGpuResourceCacheAccess.h
@@ -33,7 +33,7 @@ public:
* key, and does not have a content key.
*/
bool isScratch() const {
- return !this->getContentKey().isValid() && fResource->fScratchKey.isValid() &&
+ return !fResource->getContentKey().isValid() && fResource->fScratchKey.isValid() &&
this->isBudgeted();
}
@@ -51,11 +51,6 @@ public:
void removeScratchKey() const { fResource->removeScratchKey(); }
/**
- * If the resource is currently cached by a content key, the key is returned, otherwise NULL.
- */
- const GrContentKey& getContentKey() const { return fResource->fContentKey; }
-
- /**
* Is the resource object wrapping an externally allocated GPU resource?
*/
bool isWrapped() const { return GrGpuResource::kWrapped_LifeCycle == fResource->fLifeCycle; }
@@ -65,7 +60,7 @@ public:
*/
bool isBudgeted() const {
bool ret = GrGpuResource::kCached_LifeCycle == fResource->fLifeCycle;
- SkASSERT(ret || !this->getContentKey().isValid());
+ SkASSERT(ret || !fResource->getContentKey().isValid());
return ret;
}
diff --git a/src/gpu/GrResourceCache2.cpp b/src/gpu/GrResourceCache2.cpp
index 65894d3314..99c4270f99 100644
--- a/src/gpu/GrResourceCache2.cpp
+++ b/src/gpu/GrResourceCache2.cpp
@@ -132,8 +132,8 @@ void GrResourceCache2::removeResource(GrGpuResource* resource) {
if (resource->cacheAccess().getScratchKey().isValid()) {
fScratchMap.remove(resource->cacheAccess().getScratchKey(), resource);
}
- if (resource->cacheAccess().getContentKey().isValid()) {
- fContentHash.remove(resource->cacheAccess().getContentKey());
+ if (resource->getContentKey().isValid()) {
+ fContentHash.remove(resource->getContentKey());
}
this->validate();
}
@@ -225,9 +225,9 @@ bool GrResourceCache2::didSetContentKey(GrGpuResource* resource) {
SkASSERT(!fPurging);
SkASSERT(resource);
SkASSERT(this->isInCache(resource));
- SkASSERT(resource->cacheAccess().getContentKey().isValid());
+ SkASSERT(resource->getContentKey().isValid());
- GrGpuResource* res = fContentHash.find(resource->cacheAccess().getContentKey());
+ GrGpuResource* res = fContentHash.find(resource->getContentKey());
if (NULL != res) {
return false;
}
@@ -281,7 +281,7 @@ void GrResourceCache2::notifyPurgeable(GrGpuResource* resource) {
// Also purge if the resource has neither a valid scratch key nor a content key.
bool noKey = !resource->cacheAccess().getScratchKey().isValid() &&
- !resource->cacheAccess().getContentKey().isValid();
+ !resource->getContentKey().isValid();
if (overBudget || noKey) {
release = true;
}
@@ -435,18 +435,18 @@ void GrResourceCache2::validate() const {
}
if (resource->cacheAccess().isScratch()) {
- SkASSERT(!resource->cacheAccess().getContentKey().isValid());
+ SkASSERT(!resource->getContentKey().isValid());
++scratch;
SkASSERT(fScratchMap.countForKey(resource->cacheAccess().getScratchKey()));
SkASSERT(!resource->cacheAccess().isWrapped());
} else if (resource->cacheAccess().getScratchKey().isValid()) {
SkASSERT(!resource->cacheAccess().isBudgeted() ||
- resource->cacheAccess().getContentKey().isValid());
+ resource->getContentKey().isValid());
++couldBeScratch;
SkASSERT(fScratchMap.countForKey(resource->cacheAccess().getScratchKey()));
SkASSERT(!resource->cacheAccess().isWrapped());
}
- const GrContentKey& contentKey = resource->cacheAccess().getContentKey();
+ const GrContentKey& contentKey = resource->getContentKey();
if (contentKey.isValid()) {
++content;
SkASSERT(fContentHash.find(contentKey) == resource);
diff --git a/src/gpu/GrResourceCache2.h b/src/gpu/GrResourceCache2.h
index d5c418238b..9c9900a424 100644
--- a/src/gpu/GrResourceCache2.h
+++ b/src/gpu/GrResourceCache2.h
@@ -194,7 +194,7 @@ private:
struct ContentHashTraits {
static const GrContentKey& GetKey(const GrGpuResource& r) {
- return r.cacheAccess().getContentKey();
+ return r.getContentKey();
}
static uint32_t Hash(const GrContentKey& key) { return key.hash(); }