From c429baf7a28205a19975cfbb60db1b7bfc9c61fa Mon Sep 17 00:00:00 2001 From: ericrk Date: Thu, 24 Mar 2016 15:35:45 -0700 Subject: [PATCH] Add getDeferredTextureImageData early out Currently, when dealing with deferred texture image data, we will decode the image even if it will later fail to upload to the GPU due to size constraints. This change adds an early out to our initial decode / sizing logic. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1831873002 Review URL: https://codereview.chromium.org/1831873002 --- src/image/SkImage_Gpu.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 7a99dfeaa5..60eedbc9a7 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -355,6 +355,11 @@ size_t SkImage::getDeferredTextureImageData(const GrContextThreadSafeProxy& prox return 0; } + const int maxTextureSize = proxy.fCaps->maxTextureSize(); + if (width() > maxTextureSize || height() > maxTextureSize) { + return 0; + } + SkAutoPixmapStorage pixmap; SkImageInfo info; size_t pixelSize = 0;