Reduce stack usage for Google3.
authorbenjaminwagner <benjaminwagner@google.com>
Wed, 3 Feb 2016 20:20:19 +0000 (12:20 -0800)
committerCommit bot <commit-bot@chromium.org>
Wed, 3 Feb 2016 20:20:19 +0000 (12:20 -0800)
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1663013004

Review URL: https://codereview.chromium.org/1663013004

src/gpu/GrTextureToYUVPlanes.cpp

index 6a8d7b6..19283ee 100644 (file)
@@ -170,7 +170,12 @@ bool GrTextureToYUVPlanes(GrTexture* texture, const SkISize sizes[3], void* cons
             SkASSERT(sizes[0] == sizes[1] && sizes[1] == sizes[2]);
             SkISize yuvSize = sizes[0];
             // We have no kRGB_888 pixel format, so readback rgba and then copy three channels.
+#if defined(GOOGLE3)
+            // Stack frame size is limited in GOOGLE3.
+            SkAutoSTMalloc<48 * 48, uint32_t> tempYUV(yuvSize.fWidth * yuvSize.fHeight);
+#else
             SkAutoSTMalloc<128 * 128, uint32_t> tempYUV(yuvSize.fWidth * yuvSize.fHeight);
+#endif
             if (!yuvTex->readPixels(0, 0, yuvSize.fWidth, yuvSize.fHeight,
                                     kRGBA_8888_GrPixelConfig, tempYUV.get(), 0)) {
                 return false;
@@ -207,7 +212,12 @@ bool GrTextureToYUVPlanes(GrTexture* texture, const SkISize sizes[3], void* cons
                 SkASSERT(sizes[1].fWidth == sizes[2].fWidth);
                 SkISize uvSize = sizes[1];
                 // We have no kRG_88 pixel format, so readback rgba and then copy two channels.
+#if defined(GOOGLE3)
+                // Stack frame size is limited in GOOGLE3.
+                SkAutoSTMalloc<48 * 48, uint32_t> tempUV(uvSize.fWidth * uvSize.fHeight);
+#else
                 SkAutoSTMalloc<128 * 128, uint32_t> tempUV(uvSize.fWidth * uvSize.fHeight);
+#endif
                 if (!uvTex->readPixels(0, 0, uvSize.fWidth, uvSize.fHeight,
                                        kRGBA_8888_GrPixelConfig, tempUV.get(), 0)) {
                     return false;