Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: src/gpu/gl/GrGpuGL.cpp

Issue 459263003: Add a parameter GR_ALWAYS_ALLOCATE_ON_HEAP to allow for only ever creating temporary buffers on the… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/gpu/GrTextStrike.cpp ('K') | « src/gpu/GrTextStrike.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGpuGL.cpp
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index ed8279d865a27424a4ea5a810a5cbd79e61feb2f..bd48033c8a86b4ddb0ce2c2e9743a986c7fec8d0 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -578,7 +578,11 @@ bool GrGpuGL::uploadTexData(const GrGLTexture::Desc& desc,
size_t trimRowBytes = width * bpp;
// in case we need a temporary, trimmed copy of the src pixels
+#if GR_ALWAYS_ALLOCATE_ON_HEAP
+ SkAutoMalloc tempStorage;
+#else
SkAutoSMalloc<128 * 128> tempStorage;
+#endif
// We currently lazily create MIPMAPs when the we see a draw with
// GrTextureParams::kMipMap_FilterMode. Using texture storage requires that the
@@ -1666,7 +1670,13 @@ bool GrGpuGL::onReadPixels(GrRenderTarget* target,
// determine if GL can read using the passed rowBytes or if we need
// a scratch buffer.
+
+#if GR_ALWAYS_ALLOCATE_ON_HEAP
+ SkAutoMalloc scratch;
+#else
SkAutoSMalloc<32 * sizeof(GrColor)> scratch;
+#endif
+
if (rowBytes != tightRowBytes) {
if (this->glCaps().packRowLengthSupport()) {
SkASSERT(!(rowBytes % sizeof(GrColor)));
« src/gpu/GrTextStrike.cpp ('K') | « src/gpu/GrTextStrike.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698