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 SkASSERT(drawState.hasXPFactory()); |
591 kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || | 591 if (!drawState.getXPFactory()->supportsLCDText(drawState)) { |
592 fPaint.numColorStages()) { | |
593 SkDebugf("LCD Text will not draw correctly.\n"); | 592 SkDebugf("LCD Text will not draw correctly.\n"); |
594 } | 593 } |
595 SkASSERT(!drawState.hasColorVertexAttribute()); | 594 SkASSERT(!drawState.hasColorVertexAttribute()); |
596 // We don't use the GrPaint's color in this case because it's be
en premultiplied by | 595 // 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 | 596 // 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 | 597 // the mask texture color. The end result is that we get |
599 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*d
stColor | 598 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*d
stColor |
600 int a = SkColorGetA(fSkPaint.getColor()); | 599 int a = SkColorGetA(fSkPaint.getColor()); |
601 // paintAlpha | 600 // paintAlpha |
602 drawState.setColor(SkColorSetARGB(a, a, a, a)); | 601 drawState.setColor(SkColorSetARGB(a, a, a, a)); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 } | 636 } |
638 } | 637 } |
639 | 638 |
640 inline void GrBitmapTextContext::finish() { | 639 inline void GrBitmapTextContext::finish() { |
641 this->flush(); | 640 this->flush(); |
642 fTotalVertexCount = 0; | 641 fTotalVertexCount = 0; |
643 | 642 |
644 GrTextContext::finish(); | 643 GrTextContext::finish(); |
645 } | 644 } |
646 | 645 |
OLD | NEW |