Switch GrYUVProvider over to GrTextureProxies
This is split out of: https://skia-review.googlesource.com/c/8823/ (Remove GrFragmentProcessor-derived class' GrTexture-based ctors)
Change-Id: I302e6b4c1ffed449a990288ec06f2dfdcdadf1f8
Reviewed-on: https://skia-review.googlesource.com/9448
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index 196723c..1d2f0d1 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -557,7 +557,7 @@
kLockTexturePathCount);
GrTexture* tex2 = proxy->instantiate(ctx->resourceProvider());
if (tex2) {
- return set_key_and_return(ctx->resourceProvider(), SkSafeRef(tex2), key);
+ return set_key_and_return(ctx->resourceProvider(), SkRef(tex2), key);
}
}
}
@@ -581,11 +581,13 @@
if (!ctx->contextPriv().disableGpuYUVConversion()) {
ScopedGenerator generator(fSharedGenerator);
Generator_GrYUVProvider provider(generator);
- sk_sp<GrTexture> tex = provider.refAsTexture(ctx, desc, true);
- if (tex) {
+ if (sk_sp<GrTextureProxy> proxy = provider.refAsTextureProxy(ctx, desc, true)) {
SK_HISTOGRAM_ENUMERATION("LockTexturePath", kYUV_LockTexturePath,
kLockTexturePathCount);
- return set_key_and_return(ctx->resourceProvider(), tex.release(), key);
+ GrTexture* tex2 = proxy->instantiate(ctx->resourceProvider());
+ if (tex2) {
+ return set_key_and_return(ctx->resourceProvider(), SkRef(tex2), key);
+ }
}
}