aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-09-06 10:54:16 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-06 15:13:18 +0000
commite1fbf170580a4b932d0abcb11593fb1ef0cac60b (patch)
tree700b31d273eb5f3b81db11f2e2729c2350b2617b
parent52cb5fe23b8f960bb3248620c8f4e2f2957b6685 (diff)
Try finding exact scratch texture in cache before approx
Bug: skia: Change-Id: Ia65b94bde7aa52e951ba94a0012e794f02c3177e Reviewed-on: https://skia-review.googlesource.com/42940 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
-rw-r--r--src/gpu/GrResourceProvider.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index c272c969fa..cd337b27c2 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -196,14 +196,16 @@ sk_sp<GrTexture> GrResourceProvider::createApproxTexture(const GrSurfaceDesc& de
return nullptr;
}
- GrSurfaceDesc copyDesc = desc;
+ if (auto tex = this->refScratchTexture(desc, flags)) {
+ return tex;
+ }
+ GrSurfaceDesc copyDesc = desc;
// bin by pow2 with a reasonable min
copyDesc.fWidth = SkTMax(kMinScratchTextureSize, GrNextPow2(desc.fWidth));
copyDesc.fHeight = SkTMax(kMinScratchTextureSize, GrNextPow2(desc.fHeight));
- sk_sp<GrTexture> tex = this->refScratchTexture(copyDesc, flags);
- if (tex) {
+ if (auto tex = this->refScratchTexture(copyDesc, flags)) {
return tex;
}