Add getDeferredTextureImageData early out
authorericrk <ericrk@chromium.org>
Thu, 24 Mar 2016 22:35:45 +0000 (15:35 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 24 Mar 2016 22:35:45 +0000 (15:35 -0700)
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

index 7a99dfe..60eedbc 100644 (file)
@@ -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;