texdata gm: allocate gTextureData on the heap.
This GM is triggering a stack overflow on my laptop when I run it with dm. As
I understand it, the default stack size on a Mac is 64K, but this allocates 640K.
BUG=
R=bsalomon@google.com, robertphillips@google.com
Author: mtklein@google.com
Review URL: https://codereview.chromium.org/26440006
git-svn-id: http://skia.googlecode.com/svn/trunk@11801 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/texdata.cpp b/gm/texdata.cpp
index 645ced1..d2e5d05 100644
--- a/gm/texdata.cpp
+++ b/gm/texdata.cpp
@@ -42,7 +42,7 @@
GrRenderTarget* target = device->accessRenderTarget();
GrContext* ctx = GM::GetGr(canvas);
if (ctx && target) {
- SkPMColor gTextureData[(2 * S) * (2 * S)];
+ SkAutoTArray<SkPMColor> gTextureData((2 * S) * (2 * S));
static const int stride = 2 * S;
static const SkPMColor gray = SkPackARGB32(0x40, 0x40, 0x40, 0x40);
static const SkPMColor white = SkPackARGB32(0xff, 0xff, 0xff, 0xff);
@@ -88,7 +88,7 @@
desc.fWidth = 2 * S;
desc.fHeight = 2 * S;
GrTexture* texture =
- ctx->createUncachedTexture(desc, gTextureData, 0);
+ ctx->createUncachedTexture(desc, gTextureData.get(), 0);
if (!texture) {
return;
@@ -127,7 +127,7 @@
}
}
texture->writePixels(S, (i ? 0 : S), S, S,
- texture->config(), gTextureData,
+ texture->config(), gTextureData.get(),
4 * stride);
ctx->drawRect(paint, SkRect::MakeWH(2*S, 2*S));
}