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

Side by Side Diff: src/gpu/GrBitmapTextContext.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 | « no previous file | src/gpu/GrDistanceFieldTextContext.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 2013 Google Inc. 2 * Copyright 2013 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 "GrBitmapTextContext.h" 8 #include "GrBitmapTextContext.h"
9 #include "GrAtlas.h" 9 #include "GrAtlas.h"
10 #include "GrDrawTarget.h" 10 #include "GrDrawTarget.h"
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 if (true || NULL == glyph->fPlot) { 447 if (true || NULL == glyph->fPlot) {
448 int x = vx >> 16; 448 int x = vx >> 16;
449 int y = vy >> 16; 449 int y = vy >> 16;
450 if (fClipRect.quickReject(x, y, x + width, y + height)) { 450 if (fClipRect.quickReject(x, y, x + width, y + height)) {
451 // SkCLZ(3); // so we can set a break-point in the debugger 451 // SkCLZ(3); // so we can set a break-point in the debugger
452 return; 452 return;
453 } 453 }
454 } 454 }
455 455
456 if (NULL == glyph->fPlot) { 456 if (NULL == glyph->fPlot) {
457 if (fStrike->addGlyphToAtlas(glyph, scaler)) { 457 if (!fStrike->glyphTooLargeForAtlas(glyph)) {
458 goto HAS_ATLAS; 458 if (fStrike->addGlyphToAtlas(glyph, scaler)) {
459 } 459 goto HAS_ATLAS;
460 }
460 461
461 // try to clear out an unused plot before we flush 462 // try to clear out an unused plot before we flush
462 if (fContext->getFontCache()->freeUnusedPlot(fStrike) && 463 if (fContext->getFontCache()->freeUnusedPlot(fStrike) &&
463 fStrike->addGlyphToAtlas(glyph, scaler)) { 464 fStrike->addGlyphToAtlas(glyph, scaler)) {
464 goto HAS_ATLAS; 465 goto HAS_ATLAS;
465 } 466 }
466 467
467 if (c_DumpFontCache) { 468 if (c_DumpFontCache) {
468 #ifdef SK_DEVELOPER 469 #ifdef SK_DEVELOPER
469 fContext->getFontCache()->dump(); 470 fContext->getFontCache()->dump();
470 #endif 471 #endif
471 } 472 }
472 473
473 // flush any accumulated draws to allow us to free up a plot 474 // flush any accumulated draws to allow us to free up a plot
474 this->flushGlyphs(); 475 this->flushGlyphs();
475 fContext->flush(); 476 fContext->flush();
476 477
477 // we should have an unused plot now 478 // we should have an unused plot now
478 if (fContext->getFontCache()->freeUnusedPlot(fStrike) && 479 if (fContext->getFontCache()->freeUnusedPlot(fStrike) &&
479 fStrike->addGlyphToAtlas(glyph, scaler)) { 480 fStrike->addGlyphToAtlas(glyph, scaler)) {
480 goto HAS_ATLAS; 481 goto HAS_ATLAS;
482 }
481 } 483 }
482 484
483 if (NULL == glyph->fPath) { 485 if (NULL == glyph->fPath) {
484 SkPath* path = SkNEW(SkPath); 486 SkPath* path = SkNEW(SkPath);
485 if (!scaler->getGlyphPath(glyph->glyphID(), path)) { 487 if (!scaler->getGlyphPath(glyph->glyphID(), path)) {
486 // flag the glyph as being dead? 488 // flag the glyph as being dead?
487 delete path; 489 delete path;
488 return; 490 return;
489 } 491 }
490 glyph->fPath = path; 492 glyph->fPath = path;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 } 598 }
597 // color comes after position. 599 // color comes after position.
598 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1); 600 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1);
599 for (int i = 0; i < 4; ++i) { 601 for (int i = 0; i < 4; ++i) {
600 *colors = fPaint.getColor(); 602 *colors = fPaint.getColor();
601 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(colors ) + vertSize); 603 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(colors ) + vertSize);
602 } 604 }
603 } 605 }
604 fCurrVertex += 4; 606 fCurrVertex += 4;
605 } 607 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrDistanceFieldTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698