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

Side by Side Diff: src/gpu/GrTextStrike.cpp

Issue 585853003: Don't try to add large glyphs to the font atlas. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add comments Created 6 years, 3 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/GrTextStrike.h ('k') | no next file » | 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 while (!iter.done()) { 282 while (!iter.done()) {
283 if (plot == (*iter).fPlot) { 283 if (plot == (*iter).fPlot) {
284 (*iter).fPlot = NULL; 284 (*iter).fPlot = NULL;
285 } 285 }
286 ++iter; 286 ++iter;
287 } 287 }
288 288
289 GrAtlas::RemovePlot(&fPlotUsage, plot); 289 GrAtlas::RemovePlot(&fPlotUsage, plot);
290 } 290 }
291 291
292 bool GrTextStrike::glyphTooLargeForAtlas(GrGlyph* glyph) {
293 int width = glyph->fBounds.width();
294 int height = glyph->fBounds.height();
295 int pad = fUseDistanceField ? 2 * SK_DistanceFieldPad : 0;
296 if (width + pad > GR_PLOT_WIDTH) {
297 return true;
298 }
299 if (height + pad > GR_PLOT_HEIGHT) {
300 return true;
301 }
302
303 return false;
304 }
292 305
293 bool GrTextStrike::addGlyphToAtlas(GrGlyph* glyph, GrFontScaler* scaler) { 306 bool GrTextStrike::addGlyphToAtlas(GrGlyph* glyph, GrFontScaler* scaler) {
294 #if 0 // testing hack to force us to flush our cache often 307 #if 0 // testing hack to force us to flush our cache often
295 static int gCounter; 308 static int gCounter;
296 if ((++gCounter % 10) == 0) return false; 309 if ((++gCounter % 10) == 0) return false;
297 #endif 310 #endif
298 311
299 SkASSERT(glyph); 312 SkASSERT(glyph);
300 SkASSERT(scaler); 313 SkASSERT(scaler);
301 SkASSERT(fCache.find(glyph->fPackedID)); 314 SkASSERT(fCache.find(glyph->fPackedID));
(...skipping 25 matching lines...) Expand all
327 glyph->height(), storage.get(), 340 glyph->height(), storage.get(),
328 &glyph->fAtlasLocation); 341 &glyph->fAtlasLocation);
329 342
330 if (NULL == plot) { 343 if (NULL == plot) {
331 return false; 344 return false;
332 } 345 }
333 346
334 glyph->fPlot = plot; 347 glyph->fPlot = plot;
335 return true; 348 return true;
336 } 349 }
OLDNEW
« no previous file with comments | « src/gpu/GrTextStrike.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698