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 "GrDistanceFieldTextContext.h" | 8 #include "GrDistanceFieldTextContext.h" |
9 #include "GrAtlas.h" | 9 #include "GrAtlas.h" |
10 #include "GrBitmapTextContext.h" | 10 #include "GrBitmapTextContext.h" |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 | 651 |
652 // Effects could be stored with one of the cache objects (atlas?) | 652 // Effects could be stored with one of the cache objects (atlas?) |
653 drawState->setGeometryProcessor(fCachedGeometryProcessor.get()); | 653 drawState->setGeometryProcessor(fCachedGeometryProcessor.get()); |
654 | 654 |
655 // Set draw state | 655 // Set draw state |
656 if (fUseLCDText) { | 656 if (fUseLCDText) { |
657 GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredCol
or); | 657 GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredCol
or); |
658 if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() || | 658 if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() || |
659 kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || | 659 kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || |
660 fPaint.numColorStages()) { | 660 fPaint.numColorStages()) { |
661 GrPrintf("LCD Text will not draw correctly.\n"); | 661 SkDebugf("LCD Text will not draw correctly.\n"); |
662 } | 662 } |
663 SkASSERT(!drawState->hasColorVertexAttribute()); | 663 SkASSERT(!drawState->hasColorVertexAttribute()); |
664 // We don't use the GrPaint's color in this case because it's been p
remultiplied by | 664 // We don't use the GrPaint's color in this case because it's been p
remultiplied by |
665 // alpha. Instead we feed in a non-premultiplied color, and multiply
its alpha by | 665 // alpha. Instead we feed in a non-premultiplied color, and multiply
its alpha by |
666 // the mask texture color. The end result is that we get | 666 // the mask texture color. The end result is that we get |
667 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*dstCo
lor | 667 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*dstCo
lor |
668 int a = SkColorGetA(fSkPaint.getColor()); | 668 int a = SkColorGetA(fSkPaint.getColor()); |
669 // paintAlpha | 669 // paintAlpha |
670 drawState->setColor(SkColorSetARGB(a, a, a, a)); | 670 drawState->setColor(SkColorSetARGB(a, a, a, a)); |
671 // paintColor | 671 // paintColor |
(...skipping 19 matching lines...) Expand all Loading... |
691 } | 691 } |
692 } | 692 } |
693 | 693 |
694 inline void GrDistanceFieldTextContext::finish() { | 694 inline void GrDistanceFieldTextContext::finish() { |
695 this->flush(); | 695 this->flush(); |
696 fTotalVertexCount = 0; | 696 fTotalVertexCount = 0; |
697 | 697 |
698 GrTextContext::finish(); | 698 GrTextContext::finish(); |
699 } | 699 } |
700 | 700 |
OLD | NEW |