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

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: Build fixes 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
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/gl/GrGpuGL.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 SkAutoSMalloc<1024> storage(size); 309 GrAutoMalloc<1024> storage(size);
310
310 if (fUseDistanceField) { 311 if (fUseDistanceField) {
311 if (!scaler->getPackedGlyphDFImage(glyph->fPackedID, glyph->width(), 312 if (!scaler->getPackedGlyphDFImage(glyph->fPackedID, glyph->width(),
312 glyph->height(), 313 glyph->height(),
313 storage.get())) { 314 storage.get())) {
314 return false; 315 return false;
315 } 316 }
316 } else { 317 } else {
317 if (!scaler->getPackedGlyphImage(glyph->fPackedID, glyph->width(), 318 if (!scaler->getPackedGlyphImage(glyph->fPackedID, glyph->width(),
318 glyph->height(), 319 glyph->height(),
319 glyph->width() * bytesPerPixel, 320 glyph->width() * bytesPerPixel,
320 storage.get())) { 321 storage.get())) {
321 return false; 322 return false;
322 } 323 }
323 } 324 }
324 325
325 GrPlot* plot = fAtlas->addToAtlas(&fPlotUsage, glyph->width(), 326 GrPlot* plot = fAtlas->addToAtlas(&fPlotUsage, glyph->width(),
326 glyph->height(), storage.get(), 327 glyph->height(), storage.get(),
327 &glyph->fAtlasLocation); 328 &glyph->fAtlasLocation);
328 329
329 if (NULL == plot) { 330 if (NULL == plot) {
330 return false; 331 return false;
331 } 332 }
332 333
333 glyph->fPlot = plot; 334 glyph->fPlot = plot;
334 return true; 335 return true;
335 } 336 }
OLDNEW
« no previous file with comments | « 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