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

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

Issue 177463003: New approach for GPU font atlas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove unnecessary reference to GrAtlasMgr Created 6 years, 9 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/GrAtlas.cpp ('k') | 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 if (true || NULL == glyph->fPlot) { 511 if (true || NULL == glyph->fPlot) {
512 int x = vx >> 16; 512 int x = vx >> 16;
513 int y = vy >> 16; 513 int y = vy >> 16;
514 if (fClipRect.quickReject(x, y, x + width, y + height)) { 514 if (fClipRect.quickReject(x, y, x + width, y + height)) {
515 // SkCLZ(3); // so we can set a break-point in the debugger 515 // SkCLZ(3); // so we can set a break-point in the debugger
516 return; 516 return;
517 } 517 }
518 } 518 }
519 519
520 if (NULL == glyph->fPlot) { 520 if (NULL == glyph->fPlot) {
521 if (fStrike->getGlyphAtlas(glyph, scaler)) { 521 if (fStrike->addGlyphToAtlas(glyph, scaler)) {
522 goto HAS_ATLAS; 522 goto HAS_ATLAS;
523 } 523 }
524 524
525 // try to clear out an unused plot before we flush 525 // try to clear out an unused plot before we flush
526 fContext->getFontCache()->freePlotExceptFor(fStrike); 526 if (fContext->getFontCache()->freeUnusedPlot(fStrike) &&
527 if (fStrike->getGlyphAtlas(glyph, scaler)) { 527 fStrike->addGlyphToAtlas(glyph, scaler)) {
528 goto HAS_ATLAS; 528 goto HAS_ATLAS;
529 } 529 }
530 530
531 if (c_DumpFontCache) { 531 if (c_DumpFontCache) {
532 #ifdef SK_DEVELOPER 532 #ifdef SK_DEVELOPER
533 fContext->getFontCache()->dump(); 533 fContext->getFontCache()->dump();
534 #endif 534 #endif
535 } 535 }
536 536
537 // before we purge the cache, we must flush any accumulated draws 537 // flush any accumulated draws to allow us to free up a plot
538 this->flushGlyphs(); 538 this->flushGlyphs();
539 fContext->flush(); 539 fContext->flush();
540 540
541 // try to purge 541 // we should have an unused plot now
542 fContext->getFontCache()->purgeExceptFor(fStrike); 542 if (fContext->getFontCache()->freeUnusedPlot(fStrike) &&
543 // need to use new flush count here 543 fStrike->addGlyphToAtlas(glyph, scaler)) {
544 if (fStrike->getGlyphAtlas(glyph, scaler)) {
545 goto HAS_ATLAS; 544 goto HAS_ATLAS;
546 } 545 }
547 546
548 if (NULL == glyph->fPath) { 547 if (NULL == glyph->fPath) {
549 SkPath* path = SkNEW(SkPath); 548 SkPath* path = SkNEW(SkPath);
550 if (!scaler->getGlyphPath(glyph->glyphID(), path)) { 549 if (!scaler->getGlyphPath(glyph->glyphID(), path)) {
551 // flag the glyph as being dead? 550 // flag the glyph as being dead?
552 delete path; 551 delete path;
553 return; 552 return;
554 } 553 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 628
630 fVertices[2*fCurrVertex].setRectFan(r.fLeft, r.fTop, r.fRight, r.fBottom, 629 fVertices[2*fCurrVertex].setRectFan(r.fLeft, r.fTop, r.fRight, r.fBottom,
631 2 * sizeof(SkPoint)); 630 2 * sizeof(SkPoint));
632 fVertices[2*fCurrVertex+1].setRectFan(SkFixedToFloat(texture->normalizeFixed X(tx)), 631 fVertices[2*fCurrVertex+1].setRectFan(SkFixedToFloat(texture->normalizeFixed X(tx)),
633 SkFixedToFloat(texture->normalizeFixed Y(ty)), 632 SkFixedToFloat(texture->normalizeFixed Y(ty)),
634 SkFixedToFloat(texture->normalizeFixed X(tx + width)), 633 SkFixedToFloat(texture->normalizeFixed X(tx + width)),
635 SkFixedToFloat(texture->normalizeFixed Y(ty + height)), 634 SkFixedToFloat(texture->normalizeFixed Y(ty + height)),
636 2 * sizeof(SkPoint)); 635 2 * sizeof(SkPoint));
637 fCurrVertex += 4; 636 fCurrVertex += 4;
638 } 637 }
OLDNEW
« no previous file with comments | « src/gpu/GrAtlas.cpp ('k') | src/gpu/GrDistanceFieldTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698