diff options
author | 2018-04-12 13:29:08 -0400 | |
---|---|---|
committer | 2018-04-12 18:09:10 +0000 | |
commit | 875f7851f6be2330c56be304bc78e07517a72d6f (patch) | |
tree | cc0f3661b5abae8716b53dbe516591c81e20edaf /src/gpu/GrTextureAdjuster.cpp | |
parent | 6aab2ab762beb0d255529a914e181e927a8e6307 (diff) |
Fail fast when trying to make a texture that's too large
This saves us from doing lots of throwaway decoding work if the image
can't be uploaded.
This is based on -- but doesn't entirely fix --
https://github.com/flutter/flutter/issues/16454
Change-Id: I4025f31f1334b715a04b4503aeb4f857851b5772
Reviewed-on: https://skia-review.googlesource.com/121104
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/GrTextureAdjuster.cpp')
-rw-r--r-- | src/gpu/GrTextureAdjuster.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp index 306ec59220..f30b0eb03d 100644 --- a/src/gpu/GrTextureAdjuster.cpp +++ b/src/gpu/GrTextureAdjuster.cpp @@ -75,6 +75,9 @@ sk_sp<GrTextureProxy> GrTextureAdjuster::refTextureProxySafeForParams(const GrSa return nullptr; } + SkASSERT(this->width() <= fContext->caps()->maxTextureSize() && + this->height() <= fContext->caps()->maxTextureSize()); + if (!GrGpu::IsACopyNeededForTextureParams(fContext->caps(), proxy.get(), proxy->width(), proxy->height(), params, ©Params, scaleAdjust)) { |