aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTextureProxy.cpp
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-09-26 12:49:26 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-26 17:11:21 +0000
commitcd871401114f402e72420ccd49edecee2532b0e6 (patch)
treea323510790f271cc2e0a85487ab52cbc7ffc9339 /src/gpu/GrTextureProxy.cpp
parent98a6216b18b57c2f7a0d58f542c60503686aed69 (diff)
Add ability to remove unique key from proxy and underlying surface.
Bug: skia: Change-Id: I66b891ce9ca35906fdbddb36f565b35b25825112 Reviewed-on: https://skia-review.googlesource.com/51240 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrTextureProxy.cpp')
-rw-r--r--src/gpu/GrTextureProxy.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp
index 3c2fc33741..9aeec8d2aa 100644
--- a/src/gpu/GrTextureProxy.cpp
+++ b/src/gpu/GrTextureProxy.cpp
@@ -28,8 +28,8 @@ GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf, GrSurfaceOrigin origin)
, fMipColorMode(fTarget->asTexture()->texturePriv().mipColorMode())
, fCache(nullptr) {
if (fTarget->getUniqueKey().isValid()) {
- fUniqueKey = fTarget->getUniqueKey();
fCache = fTarget->asTexture()->getContext()->getResourceCache();
+ fCache->adoptUniqueKeyFromSurface(this, fTarget);
}
}
@@ -38,7 +38,7 @@ GrTextureProxy::~GrTextureProxy() {
// at this point. Zero out the pointer so the cache invalidation code doesn't try to use it.
fTarget = nullptr;
if (fUniqueKey.isValid()) {
- fCache->processInvalidProxyUniqueKey(fUniqueKey);
+ fCache->processInvalidProxyUniqueKey(fUniqueKey, this, false);
} else {
SkASSERT(!fCache);
}
@@ -97,8 +97,7 @@ void GrTextureProxy::setUniqueKey(GrResourceCache* cache, const GrUniqueKey& key
SkASSERT(key.isValid());
SkASSERT(!fUniqueKey.isValid()); // proxies can only ever get one uniqueKey
- if (fTarget) {
- SkASSERT(!fTarget->getUniqueKey().isValid());
+ if (fTarget && !fTarget->getUniqueKey().isValid()) {
fTarget->resourcePriv().setUniqueKey(key);
SkASSERT(fTarget->getUniqueKey() == key);
}