aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrGpuResource.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-12-30 12:50:52 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-30 12:50:52 -0800
commit7775c85611c734a2af709b3a9c127939a4296c48 (patch)
tree5a9b50af9aec7b1b4a03d3162322c51a6eb6bfcc /src/gpu/GrGpuResource.cpp
parentbe9588ade8e3dac0adc8e038c46de006ca21af48 (diff)
Add a simpler key type for scratch resource keys.
Diffstat (limited to 'src/gpu/GrGpuResource.cpp')
-rw-r--r--src/gpu/GrGpuResource.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp
index 2a5718aefa..b2fad0b3f7 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -19,8 +19,7 @@ static inline GrResourceCache2* get_resource_cache2(GrGpu* gpu) {
}
GrGpuResource::GrGpuResource(GrGpu* gpu, bool isWrapped)
- : fScratchKey(GrResourceKey::NullScratchKey())
- , fGpu(gpu)
+ : fGpu(gpu)
, fGpuMemorySize(kInvalidGpuMemorySize)
, fUniqueID(CreateUniqueID()) {
if (isWrapped) {
@@ -91,7 +90,6 @@ void GrGpuResource::didChangeGpuMemorySize() const {
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.
@@ -123,11 +121,10 @@ void GrGpuResource::notifyIsPurgable() const {
}
}
-void GrGpuResource::setScratchKey(const GrResourceKey& scratchKey) {
- SkASSERT(fScratchKey.isNullScratch());
- SkASSERT(scratchKey.isScratch());
- SkASSERT(!scratchKey.isNullScratch());
- // Wrapped resources can never have a key.
+void GrGpuResource::setScratchKey(const GrScratchKey& scratchKey) {
+ SkASSERT(!fScratchKey.isValid());
+ SkASSERT(scratchKey.isValid());
+ // Wrapped resources can never have a scratch key.
if (this->isWrapped()) {
return;
}
@@ -135,9 +132,9 @@ void GrGpuResource::setScratchKey(const GrResourceKey& scratchKey) {
}
void GrGpuResource::removeScratchKey() {
- if (!this->wasDestroyed() && !fScratchKey.isNullScratch()) {
+ if (!this->wasDestroyed() && fScratchKey.isValid()) {
get_resource_cache2(fGpu)->resourceAccess().willRemoveScratchKey(this);
- fScratchKey = GrResourceKey::NullScratchKey();
+ fScratchKey.reset();
}
}