Index: src/gpu/GrResourceCache.cpp |
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp |
index cb6bcf75fd7fa284276828679b24dc2df888e1c5..66d32352083098c7ad4e42eac4e1835ddbcf6e48 100644 |
--- a/src/gpu/GrResourceCache.cpp |
+++ b/src/gpu/GrResourceCache.cpp |
@@ -371,6 +371,30 @@ void GrResourceCache::notifyCntReachedZero(GrGpuResource* resource, uint32_t fla |
return; |
} |
+ if (resource->type1() == GrGpuResource::kSurface) { |
+ GrRenderTarget* rt = resource->arrgh(); |
+ |
+ // TODO: add an assert here that the DT's RT is already closed && discarded! |
+ // closed means: official DT ptr is NULL and bit set |
+ // All the counts have reached 0! |
+ if (rt && rt->getLastDrawTarget()) { |
+ SkASSERT(rt->getLastDrawTarget()->isClosed() || rt->getLastDrawTarget()->isEmpty3()); |
+ } |
+ |
+ if (rt) { |
+ rt->setLastDrawTarget(NULL); |
+ } |
+ |
+ if (resource->getUniqueKey().isValid()) { |
+ SkASSERT(resource->fromRawPixels2() || resource->fException2); |
+ } else { |
+ SkASSERT(resource->exception() || !resource->fromRawPixels2()); |
+ resource->setException(false); |
+ resource->setFromRawPixels(false); |
+ resource->fException2 = false; |
+ } |
+ } |
+ |
SkASSERT(resource->isPurgeable()); |
this->removeFromNonpurgeableArray(resource); |
fPurgeableQueue.insert(resource); |