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
This commit is contained in:
ericrk 2016-03-24 15:35:45 -07:00 committed by Commit bot
parent 2b6f13c76c
commit c429baf7a2

View File

@ -355,6 +355,11 @@ size_t SkImage::getDeferredTextureImageData(const GrContextThreadSafeProxy& prox
return 0; return 0;
} }
const int maxTextureSize = proxy.fCaps->maxTextureSize();
if (width() > maxTextureSize || height() > maxTextureSize) {
return 0;
}
SkAutoPixmapStorage pixmap; SkAutoPixmapStorage pixmap;
SkImageInfo info; SkImageInfo info;
size_t pixelSize = 0; size_t pixelSize = 0;