Make SkImageCacherator be deferred (take 2)
Split out of: https://skia-review.googlesource.com/c/8823/ (Remove GrFragmentProcessor-derived class' GrTexture-based ctors)
This is a second pass at: https://skia-review.googlesource.com/c/9945/ (Make SkImageCacherator be deferred)
Change-Id: I3451383eed497d1235686e8961087859c7c7bd30
Reviewed-on: https://skia-review.googlesource.com/10034
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrTextureMaker.cpp b/src/gpu/GrTextureMaker.cpp
index 06a8f27..f5ee4d3 100644
--- a/src/gpu/GrTextureMaker.cpp
+++ b/src/gpu/GrTextureMaker.cpp
@@ -102,9 +102,16 @@
GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams, bool willBeMipped,
SkColorSpace* dstColorSpace) {
- sk_sp<GrTexture> original(this->refOriginalTexture(willBeMipped, dstColorSpace));
+ sk_sp<GrTextureProxy> original(this->refOriginalTextureProxy(willBeMipped, dstColorSpace));
if (!original) {
return nullptr;
}
- return CopyOnGpu(original.get(), nullptr, copyParams);
+
+ sk_sp<GrTextureProxy> copy = CopyOnGpu(fContext, std::move(original), nullptr, copyParams);
+ if (!copy) {
+ return nullptr;
+ }
+
+ sk_sp<GrTexture> tex(SkSafeRef(copy->instantiate(fContext->resourceProvider())));
+ return tex.release();
}