Add a parameter GR_ALWAYS_ALLOCATE_ON_HEAP to allow for only ever creating temporary buffers on the heap instead of allowing stack allocation
Unfortunately this can't be a GR_GL_* config like we'd discussed because there are SkAutoSMalloc buffers that are built outside of gl/
R=bsalomon@google.com, bsalomon
BUG=skia:
Author: george@mozilla.com
Review URL: https://codereview.chromium.org/459263003
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index caf16e8..830d06b 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -385,7 +385,7 @@
SkASSERT(!GrPixelConfigIsCompressed(desc.fConfig));
size_t bpp = GrBytesPerPixel(desc.fConfig);
- SkAutoSMalloc<128*128*4> stretchedPixels(bpp * rtDesc.fWidth * rtDesc.fHeight);
+ GrAutoMalloc<128*128*4> stretchedPixels(bpp * rtDesc.fWidth * rtDesc.fHeight);
stretch_image(stretchedPixels.get(), rtDesc.fWidth, rtDesc.fHeight,
srcData, desc.fWidth, desc.fHeight, bpp);
diff --git a/src/gpu/GrTextStrike.cpp b/src/gpu/GrTextStrike.cpp
index 9f9ea13..5606fe3 100644
--- a/src/gpu/GrTextStrike.cpp
+++ b/src/gpu/GrTextStrike.cpp
@@ -306,7 +306,8 @@
int bytesPerPixel = GrMaskFormatBytesPerPixel(fMaskFormat);
size_t size = glyph->fBounds.area() * bytesPerPixel;
- SkAutoSMalloc<1024> storage(size);
+ GrAutoMalloc<1024> storage(size);
+
if (fUseDistanceField) {
if (!scaler->getPackedGlyphDFImage(glyph->fPackedID, glyph->width(),
glyph->height(),
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index ed8279d..7131cfa 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -578,7 +578,7 @@
size_t trimRowBytes = width * bpp;
// in case we need a temporary, trimmed copy of the src pixels
- SkAutoSMalloc<128 * 128> tempStorage;
+ GrAutoMalloc<128 * 128> tempStorage;
// We currently lazily create MIPMAPs when the we see a draw with
// GrTextureParams::kMipMap_FilterMode. Using texture storage requires that the
@@ -1666,7 +1666,7 @@
// determine if GL can read using the passed rowBytes or if we need
// a scratch buffer.
- SkAutoSMalloc<32 * sizeof(GrColor)> scratch;
+ GrAutoMalloc<32 * sizeof(GrColor)> scratch;
if (rowBytes != tightRowBytes) {
if (this->glCaps().packRowLengthSupport()) {
SkASSERT(!(rowBytes % sizeof(GrColor)));