aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image/SkImage_Gpu.cpp
diff options
context:
space:
mode:
authorGravatar ericrk <ericrk@chromium.org>2016-03-24 15:35:45 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-24 15:35:45 -0700
commitc429baf7a28205a19975cfbb60db1b7bfc9c61fa (patch)
tree298452d5fbbffe9d0c023e0f7f7d6d5f187f97b6 /src/image/SkImage_Gpu.cpp
parent2b6f13c76c99194d4145e171d95c4987585182d2 (diff)
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
Diffstat (limited to 'src/image/SkImage_Gpu.cpp')
-rw-r--r--src/image/SkImage_Gpu.cpp5
1 files changed, 5 insertions, 0 deletions
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;