| 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 "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 SkASSERT(!drawState->hasColorVertexAttribute()); | 565 SkASSERT(!drawState->hasColorVertexAttribute()); |
| 566 drawState->setBlendFunc(fPaint.getSrcBlendCoeff(), fPaint.getDst
BlendCoeff()); | 566 drawState->setBlendFunc(fPaint.getSrcBlendCoeff(), fPaint.getDst
BlendCoeff()); |
| 567 drawState->setAlpha(fSkPaint.getAlpha()); | 567 drawState->setAlpha(fSkPaint.getAlpha()); |
| 568 break; | 568 break; |
| 569 // LCD text | 569 // LCD text |
| 570 case kA888_GrMaskFormat: | 570 case kA888_GrMaskFormat: |
| 571 case kA565_GrMaskFormat: { | 571 case kA565_GrMaskFormat: { |
| 572 if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() || | 572 if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() || |
| 573 kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || | 573 kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || |
| 574 fPaint.numColorStages()) { | 574 fPaint.numColorStages()) { |
| 575 GrPrintf("LCD Text will not draw correctly.\n"); | 575 SkDebugf("LCD Text will not draw correctly.\n"); |
| 576 } | 576 } |
| 577 SkASSERT(!drawState->hasColorVertexAttribute()); | 577 SkASSERT(!drawState->hasColorVertexAttribute()); |
| 578 // We don't use the GrPaint's color in this case because it's be
en premultiplied by | 578 // We don't use the GrPaint's color in this case because it's be
en premultiplied by |
| 579 // alpha. Instead we feed in a non-premultiplied color, and mult
iply its alpha by | 579 // alpha. Instead we feed in a non-premultiplied color, and mult
iply its alpha by |
| 580 // the mask texture color. The end result is that we get | 580 // the mask texture color. The end result is that we get |
| 581 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*d
stColor | 581 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*d
stColor |
| 582 int a = SkColorGetA(fSkPaint.getColor()); | 582 int a = SkColorGetA(fSkPaint.getColor()); |
| 583 // paintAlpha | 583 // paintAlpha |
| 584 drawState->setColor(SkColorSetARGB(a, a, a, a)); | 584 drawState->setColor(SkColorSetARGB(a, a, a, a)); |
| 585 // paintColor | 585 // paintColor |
| (...skipping 28 matching lines...) Expand all Loading... |
| 614 } | 614 } |
| 615 } | 615 } |
| 616 | 616 |
| 617 inline void GrBitmapTextContext::finish() { | 617 inline void GrBitmapTextContext::finish() { |
| 618 this->flush(); | 618 this->flush(); |
| 619 fTotalVertexCount = 0; | 619 fTotalVertexCount = 0; |
| 620 | 620 |
| 621 GrTextContext::finish(); | 621 GrTextContext::finish(); |
| 622 } | 622 } |
| 623 | 623 |
| OLD | NEW |