Make lazy proxies have 2 modes for proxy/surface key management.
kSynced: Proxy and GrSurface key kept in sync.
kUnsynced: Proxy and GrSurface keys are unrelated.
This will allow cross-context image generators' lazy instantiation
callbacks to use unique keys to find any pre-existing backing GrTexture
rather than keeping an unref'ed bare pointer to the GrTexture.
Bug: skia:8927
Change-Id: Id15e2a64e8d2e56c4ce70b9399eb1d8bcea6ac9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/204723
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ccpr/GrCCClipPath.cpp b/src/gpu/ccpr/GrCCClipPath.cpp
index 8b8d8a6..4c82fb1 100644
--- a/src/gpu/ccpr/GrCCClipPath.cpp
+++ b/src/gpu/ccpr/GrCCClipPath.cpp
@@ -20,10 +20,8 @@
GrSRGBEncoded::kNo);
fAtlasLazyProxy = GrProxyProvider::MakeFullyLazyProxy(
- [this](GrResourceProvider* resourceProvider) {
- if (!resourceProvider) {
- return sk_sp<GrTexture>();
- }
+ [this](GrResourceProvider* resourceProvider)
+ -> GrSurfaceProxy::LazyInstantiationResult {
SkASSERT(fHasAtlas);
SkASSERT(!fHasAtlasTransform);
@@ -31,7 +29,7 @@
if (!textureProxy || !textureProxy->instantiate(resourceProvider)) {
fAtlasScale = fAtlasTranslate = {0, 0};
SkDEBUGCODE(fHasAtlasTransform = true);
- return sk_sp<GrTexture>();
+ return {};
}
SkASSERT(kTopLeft_GrSurfaceOrigin == textureProxy->origin());