aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrGpuResource.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-11-17 07:34:06 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-17 07:34:06 -0800
commitdace19ec17e85872df3fb35212e1b8bce72018b6 (patch)
tree3bcea7c36f7b836a4b638007fd890a2057c0f653 /src/gpu/GrGpuResource.cpp
parentc6ad9eefa0f8d0c2ede9884b446c65dde9b04dd1 (diff)
Correct accounting for wrapped resources
Diffstat (limited to 'src/gpu/GrGpuResource.cpp')
-rw-r--r--src/gpu/GrGpuResource.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp
index fcc5f4de50..ea3756b8dd 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -87,6 +87,11 @@ bool GrGpuResource::setContentKey(const GrResourceKey& contentKey) {
// Currently this can only be called once and can't be called when the resource is scratch.
SkASSERT(!contentKey.isScratch());
SkASSERT(this->internalHasRef());
+
+ // Wrapped resources can never have a key.
+ if (this->isWrapped()) {
+ return false;
+ }
if (fContentKeySet || this->wasDestroyed()) {
return false;
@@ -116,6 +121,10 @@ void GrGpuResource::setScratchKey(const GrResourceKey& scratchKey) {
SkASSERT(fScratchKey.isNullScratch());
SkASSERT(scratchKey.isScratch());
SkASSERT(!scratchKey.isNullScratch());
+ // Wrapped resources can never have a key.
+ if (this->isWrapped()) {
+ return;
+ }
fScratchKey = scratchKey;
}