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

Side by Side Diff: src/gpu/GrTextStrike.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2010 Google Inc. 2 * Copyright 2010 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrGpu.h" 8 #include "GrGpu.h"
9 #include "GrRectanizer.h" 9 #include "GrRectanizer.h"
10 #include "GrTextStrike.h" 10 #include "GrTextStrike.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 SkASSERT(glyph); 299 SkASSERT(glyph);
300 SkASSERT(scaler); 300 SkASSERT(scaler);
301 SkASSERT(fCache.find(glyph->fPackedID)); 301 SkASSERT(fCache.find(glyph->fPackedID));
302 SkASSERT(NULL == glyph->fPlot); 302 SkASSERT(NULL == glyph->fPlot);
303 303
304 SkAutoUnref ar(SkSafeRef(scaler)); 304 SkAutoUnref ar(SkSafeRef(scaler));
305 305
306 int bytesPerPixel = GrMaskFormatBytesPerPixel(fMaskFormat); 306 int bytesPerPixel = GrMaskFormatBytesPerPixel(fMaskFormat);
307 307
308 size_t size = glyph->fBounds.area() * bytesPerPixel; 308 size_t size = glyph->fBounds.area() * bytesPerPixel;
309 #if GR_ALWAYS_ALLOCATE_ON_HEAP
bsalomon 2014/08/12 13:43:53 How about we stick this somewhere: #if GR_ALWAYS_
310 SkAutoMalloc storage(size);
311 #else
309 SkAutoSMalloc<1024> storage(size); 312 SkAutoSMalloc<1024> storage(size);
313 #endif
314
310 if (fUseDistanceField) { 315 if (fUseDistanceField) {
311 if (!scaler->getPackedGlyphDFImage(glyph->fPackedID, glyph->width(), 316 if (!scaler->getPackedGlyphDFImage(glyph->fPackedID, glyph->width(),
312 glyph->height(), 317 glyph->height(),
313 storage.get())) { 318 storage.get())) {
314 return false; 319 return false;
315 } 320 }
316 } else { 321 } else {
317 if (!scaler->getPackedGlyphImage(glyph->fPackedID, glyph->width(), 322 if (!scaler->getPackedGlyphImage(glyph->fPackedID, glyph->width(),
318 glyph->height(), 323 glyph->height(),
319 glyph->width() * bytesPerPixel, 324 glyph->width() * bytesPerPixel,
320 storage.get())) { 325 storage.get())) {
321 return false; 326 return false;
322 } 327 }
323 } 328 }
324 329
325 GrPlot* plot = fAtlas->addToAtlas(&fPlotUsage, glyph->width(), 330 GrPlot* plot = fAtlas->addToAtlas(&fPlotUsage, glyph->width(),
326 glyph->height(), storage.get(), 331 glyph->height(), storage.get(),
327 &glyph->fAtlasLocation); 332 &glyph->fAtlasLocation);
328 333
329 if (NULL == plot) { 334 if (NULL == plot) {
330 return false; 335 return false;
331 } 336 }
332 337
333 glyph->fPlot = plot; 338 glyph->fPlot = plot;
334 return true; 339 return true;
335 } 340 }
OLDNEW
« include/gpu/GrConfig.h ('K') | « src/gpu/GrContext.cpp ('k') | src/gpu/gl/GrGpuGL.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698