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