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

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

Issue 640413004: Revert of Fix color emoji. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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/GrBitmapTextContext.cpp ('k') | src/gpu/GrFontScaler.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 "GrDistanceFieldTextContext.h" 8 #include "GrDistanceFieldTextContext.h"
9 #include "GrAtlas.h" 9 #include "GrAtlas.h"
10 #include "GrDrawTarget.h" 10 #include "GrDrawTarget.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 405
406 if (NULL == fStrike) { 406 if (NULL == fStrike) {
407 fStrike = fContext->getFontCache()->getStrike(scaler, true); 407 fStrike = fContext->getFontCache()->getStrike(scaler, true);
408 } 408 }
409 409
410 GrGlyph* glyph = fStrike->getGlyph(packed, scaler); 410 GrGlyph* glyph = fStrike->getGlyph(packed, scaler);
411 if (NULL == glyph || glyph->fBounds.isEmpty()) { 411 if (NULL == glyph || glyph->fBounds.isEmpty()) {
412 return; 412 return;
413 } 413 }
414 414
415 // TODO: support color glyphs
416 if (kA8_GrMaskFormat != glyph->fMaskFormat) {
417 return;
418 }
419
420 SkScalar sx = SkFixedToScalar(vx); 415 SkScalar sx = SkFixedToScalar(vx);
421 SkScalar sy = SkFixedToScalar(vy); 416 SkScalar sy = SkFixedToScalar(vy);
422 /* 417 /*
423 // not valid, need to find a different solution for this 418 // not valid, need to find a different solution for this
424 vx += SkIntToFixed(glyph->fBounds.fLeft); 419 vx += SkIntToFixed(glyph->fBounds.fLeft);
425 vy += SkIntToFixed(glyph->fBounds.fTop); 420 vy += SkIntToFixed(glyph->fBounds.fTop);
426 421
427 // keep them as ints until we've done the clip-test 422 // keep them as ints until we've done the clip-test
428 GrFixed width = glyph->fBounds.width(); 423 GrFixed width = glyph->fBounds.width();
429 GrFixed height = glyph->fBounds.height(); 424 GrFixed height = glyph->fBounds.height();
430 425
431 // check if we clipped out 426 // check if we clipped out
432 if (true || NULL == glyph->fPlot) { 427 if (true || NULL == glyph->fPlot) {
433 int x = vx >> 16; 428 int x = vx >> 16;
434 int y = vy >> 16; 429 int y = vy >> 16;
435 if (fClipRect.quickReject(x, y, x + width, y + height)) { 430 if (fClipRect.quickReject(x, y, x + width, y + height)) {
436 // SkCLZ(3); // so we can set a break-point in the debugger 431 // SkCLZ(3); // so we can set a break-point in the debugger
437 return; 432 return;
438 } 433 }
439 } 434 }
440 */ 435 */
441 if (NULL == glyph->fPlot) { 436 if (NULL == glyph->fPlot) {
442 if (!fStrike->glyphTooLargeForAtlas(glyph)) { 437 if (!fStrike->glyphTooLargeForAtlas(glyph)) {
443 if (fStrike->addGlyphToAtlas(glyph, scaler)) { 438 if (fStrike->addGlyphToAtlas(glyph, scaler)) {
444 goto HAS_ATLAS; 439 goto HAS_ATLAS;
445 } 440 }
446 441
447 // try to clear out an unused plot before we flush 442 // try to clear out an unused plot before we flush
448 if (fContext->getFontCache()->freeUnusedPlot(fStrike, glyph) && 443 if (fContext->getFontCache()->freeUnusedPlot(fStrike) &&
449 fStrike->addGlyphToAtlas(glyph, scaler)) { 444 fStrike->addGlyphToAtlas(glyph, scaler)) {
450 goto HAS_ATLAS; 445 goto HAS_ATLAS;
451 } 446 }
452 447
453 if (c_DumpFontCache) { 448 if (c_DumpFontCache) {
454 #ifdef SK_DEVELOPER 449 #ifdef SK_DEVELOPER
455 fContext->getFontCache()->dump(); 450 fContext->getFontCache()->dump();
456 #endif 451 #endif
457 } 452 }
458 453
459 // before we purge the cache, we must flush any accumulated draws 454 // before we purge the cache, we must flush any accumulated draws
460 this->flush(); 455 this->flush();
461 fContext->flush(); 456 fContext->flush();
462 457
463 // we should have an unused plot now 458 // we should have an unused plot now
464 if (fContext->getFontCache()->freeUnusedPlot(fStrike, glyph) && 459 if (fContext->getFontCache()->freeUnusedPlot(fStrike) &&
465 fStrike->addGlyphToAtlas(glyph, scaler)) { 460 fStrike->addGlyphToAtlas(glyph, scaler)) {
466 goto HAS_ATLAS; 461 goto HAS_ATLAS;
467 } 462 }
468 } 463 }
469 464
470 if (NULL == glyph->fPath) { 465 if (NULL == glyph->fPath) {
471 SkPath* path = SkNEW(SkPath); 466 SkPath* path = SkNEW(SkPath);
472 if (!scaler->getGlyphPath(glyph->glyphID(), path)) { 467 if (!scaler->getGlyphPath(glyph->glyphID(), path)) {
473 // flag the glyph as being dead? 468 // flag the glyph as being dead?
474 delete path; 469 delete path;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 fVertexBounds.setLargestInverted(); 663 fVertexBounds.setLargestInverted();
669 } 664 }
670 } 665 }
671 666
672 inline void GrDistanceFieldTextContext::finish() { 667 inline void GrDistanceFieldTextContext::finish() {
673 this->flush(); 668 this->flush();
674 669
675 GrTextContext::finish(); 670 GrTextContext::finish();
676 } 671 }
677 672
OLDNEW
« no previous file with comments | « src/gpu/GrBitmapTextContext.cpp ('k') | src/gpu/GrFontScaler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698