diff options
author | Robert Phillips <robertphillips@google.com> | 2017-03-22 12:21:03 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-22 17:29:08 +0000 |
commit | 801f8b824fee6397422e47537f0f13034ac54ce6 (patch) | |
tree | 0832759a300aae586bada42a87e425512459ff7f /src/gpu/GrImageTextureMaker.cpp | |
parent | 44c1b111c7528cdbcfbd76989e0701ce9bbddf58 (diff) |
Make SkImageCacherator be deferred
Split out of: https://skia-review.googlesource.com/c/8823/ (Remove GrFragmentProcessor-derived class' GrTexture-based ctors)
Change-Id: I16cf0aea9d887e5ebe053e9b5c94a970dc254beb
Reviewed-on: https://skia-review.googlesource.com/9945
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrImageTextureMaker.cpp')
-rw-r--r-- | src/gpu/GrImageTextureMaker.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/gpu/GrImageTextureMaker.cpp b/src/gpu/GrImageTextureMaker.cpp index a7fc1a353c..47a2f4f14c 100644 --- a/src/gpu/GrImageTextureMaker.cpp +++ b/src/gpu/GrImageTextureMaker.cpp @@ -32,16 +32,21 @@ GrImageTextureMaker::GrImageTextureMaker(GrContext* context, SkImageCacherator* } GrTexture* GrImageTextureMaker::refOriginalTexture(bool willBeMipped, SkColorSpace* dstColorSpace) { - return fCacher->lockTexture(this->context(), fOriginalKey, fClient, fCachingHint, willBeMipped, - dstColorSpace); + sk_sp<GrTextureProxy> proxy = fCacher->lockTextureProxy(this->context(), fOriginalKey, + fClient, fCachingHint, willBeMipped, + dstColorSpace); + if (!proxy) { + return nullptr; + } + + sk_sp<GrTexture> tex(SkSafeRef(proxy->instantiate(this->context()->resourceProvider()))); + return tex.release(); } sk_sp<GrTextureProxy> GrImageTextureMaker::refOriginalTextureProxy(bool willBeMipped, SkColorSpace* dstColorSpace) { - sk_sp<GrTexture> tex(fCacher->lockTexture(this->context(), fOriginalKey, fClient, fCachingHint, - willBeMipped, dstColorSpace)); - - return GrSurfaceProxy::MakeWrapped(std::move(tex)); + return fCacher->lockTextureProxy(this->context(), fOriginalKey, fClient, fCachingHint, + willBeMipped, dstColorSpace); } void GrImageTextureMaker::makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey, |