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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 SkASSERT(fStrike); | 580 SkASSERT(fStrike); |
581 switch (fCurrMaskFormat) { | 581 switch (fCurrMaskFormat) { |
582 // Color bitmap text | 582 // Color bitmap text |
583 case kARGB_GrMaskFormat: | 583 case kARGB_GrMaskFormat: |
584 SkASSERT(!drawState.hasColorVertexAttribute()); | 584 SkASSERT(!drawState.hasColorVertexAttribute()); |
585 drawState.setBlendFunc(fPaint.getSrcBlendCoeff(), fPaint.getDstB
lendCoeff()); | 585 drawState.setBlendFunc(fPaint.getSrcBlendCoeff(), fPaint.getDstB
lendCoeff()); |
586 drawState.setAlpha(fSkPaint.getAlpha()); | 586 drawState.setAlpha(fSkPaint.getAlpha()); |
587 break; | 587 break; |
588 // LCD text | 588 // LCD text |
589 case kA565_GrMaskFormat: { | 589 case kA565_GrMaskFormat: { |
590 if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() || | 590 // TODO: move supportsRGBCoverage check to setupCoverageEffect a
nd only add LCD |
591 kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || | 591 // processor if the xp can support it. For now we will simply as
sume that if |
592 fPaint.numColorStages()) { | 592 // fUseLCDText is true, then we have a known color output. |
| 593 if (!drawState.getXPFactory()->supportsRGBCoverage(0, kRGBA_GrCo
lorComponentFlags)) { |
593 SkDebugf("LCD Text will not draw correctly.\n"); | 594 SkDebugf("LCD Text will not draw correctly.\n"); |
594 } | 595 } |
595 SkASSERT(!drawState.hasColorVertexAttribute()); | 596 SkASSERT(!drawState.hasColorVertexAttribute()); |
596 // We don't use the GrPaint's color in this case because it's be
en premultiplied by | 597 // We don't use the GrPaint's color in this case because it's be
en premultiplied by |
597 // alpha. Instead we feed in a non-premultiplied color, and mult
iply its alpha by | 598 // alpha. Instead we feed in a non-premultiplied color, and mult
iply its alpha by |
598 // the mask texture color. The end result is that we get | 599 // the mask texture color. The end result is that we get |
599 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*d
stColor | 600 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*d
stColor |
600 int a = SkColorGetA(fSkPaint.getColor()); | 601 int a = SkColorGetA(fSkPaint.getColor()); |
601 // paintAlpha | 602 // paintAlpha |
602 drawState.setColor(SkColorSetARGB(a, a, a, a)); | 603 drawState.setColor(SkColorSetARGB(a, a, a, a)); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 } | 638 } |
638 } | 639 } |
639 | 640 |
640 inline void GrBitmapTextContext::finish() { | 641 inline void GrBitmapTextContext::finish() { |
641 this->flush(); | 642 this->flush(); |
642 fTotalVertexCount = 0; | 643 fTotalVertexCount = 0; |
643 | 644 |
644 GrTextContext::finish(); | 645 GrTextContext::finish(); |
645 } | 646 } |
646 | 647 |
OLD | NEW |