OLD | NEW |
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 "GrDefaultGeoProcFactory.h" | 10 #include "GrDefaultGeoProcFactory.h" |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 SkASSERT(fStrike); | 554 SkASSERT(fStrike); |
555 switch (fCurrMaskFormat) { | 555 switch (fCurrMaskFormat) { |
556 // Color bitmap text | 556 // Color bitmap text |
557 case kARGB_GrMaskFormat: | 557 case kARGB_GrMaskFormat: |
558 SkASSERT(!drawState.hasColorVertexAttribute()); | 558 SkASSERT(!drawState.hasColorVertexAttribute()); |
559 drawState.setBlendFunc(fPaint.getSrcBlendCoeff(), fPaint.getDstB
lendCoeff()); | 559 drawState.setBlendFunc(fPaint.getSrcBlendCoeff(), fPaint.getDstB
lendCoeff()); |
560 drawState.setAlpha(fSkPaint.getAlpha()); | 560 drawState.setAlpha(fSkPaint.getAlpha()); |
561 break; | 561 break; |
562 // LCD text | 562 // LCD text |
563 case kA565_GrMaskFormat: { | 563 case kA565_GrMaskFormat: { |
564 if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() || | 564 // TODO: move supportsRGBCoverage check to setupCoverageEffect a
nd only add LCD |
565 kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || | 565 // processor if the xp can support it. For now we will simply as
sume that if |
566 fPaint.numColorStages()) { | 566 // fUseLCDText is true, then we have a known color output. |
| 567 if (!drawState.getXPFactory()->supportsRGBCoverage(0, kRGBA_GrCo
lorComponentFlags)) { |
567 SkDebugf("LCD Text will not draw correctly.\n"); | 568 SkDebugf("LCD Text will not draw correctly.\n"); |
568 } | 569 } |
569 SkASSERT(!drawState.hasColorVertexAttribute()); | 570 SkASSERT(!drawState.hasColorVertexAttribute()); |
570 // We don't use the GrPaint's color in this case because it's be
en premultiplied by | 571 // We don't use the GrPaint's color in this case because it's be
en premultiplied by |
571 // alpha. Instead we feed in a non-premultiplied color, and mult
iply its alpha by | 572 // alpha. Instead we feed in a non-premultiplied color, and mult
iply its alpha by |
572 // the mask texture color. The end result is that we get | 573 // the mask texture color. The end result is that we get |
573 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*d
stColor | 574 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*d
stColor |
574 int a = SkColorGetA(fSkPaint.getColor()); | 575 int a = SkColorGetA(fSkPaint.getColor()); |
575 // paintAlpha | 576 // paintAlpha |
576 drawState.setColor(SkColorSetARGB(a, a, a, a)); | 577 drawState.setColor(SkColorSetARGB(a, a, a, a)); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 } | 612 } |
612 } | 613 } |
613 | 614 |
614 inline void GrBitmapTextContext::finish() { | 615 inline void GrBitmapTextContext::finish() { |
615 this->flush(); | 616 this->flush(); |
616 fTotalVertexCount = 0; | 617 fTotalVertexCount = 0; |
617 | 618 |
618 GrTextContext::finish(); | 619 GrTextContext::finish(); |
619 } | 620 } |
620 | 621 |
OLD | NEW |