Reduce use of SkImage_Base::peekTexture
Change-Id: I079093c9706df4911d47fba04b786e59240e8cb4
Reviewed-on: https://skia-review.googlesource.com/7792
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index c425d27..ef25844 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -93,8 +93,13 @@
return true;
}
-sk_sp<GrSurfaceProxy> SkImage_Gpu::refProxy() const {
- return GrSurfaceProxy::MakeWrapped(fTexture);
+sk_sp<GrTextureProxy> SkImage_Gpu::asTextureProxyRef() const {
+ sk_sp<GrSurfaceProxy> sProxy = GrSurfaceProxy::MakeWrapped(fTexture);
+ if (!sProxy) {
+ return nullptr;
+ }
+
+ return sk_ref_sp(sProxy->asTextureProxy());
}
GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, const GrSamplerParams& params,
@@ -104,7 +109,7 @@
if (texColorSpace) {
*texColorSpace = this->fColorSpace;
}
- GrTextureAdjuster adjuster(this->peekTexture(), this->alphaType(), this->bounds(),
+ GrTextureAdjuster adjuster(fTexture.get(), this->alphaType(), this->bounds(),
this->uniqueID(), this->fColorSpace.get());
return adjuster.refTextureSafeForParams(params, nullptr, scaleAdjust);
}