| 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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 filteredColor = fSkPaint.getColor(); | 624 filteredColor = fSkPaint.getColor(); |
| 625 } | 625 } |
| 626 this->setupCoverageEffect(filteredColor); | 626 this->setupCoverageEffect(filteredColor); |
| 627 | 627 |
| 628 // Effects could be stored with one of the cache objects (atlas?) | 628 // Effects could be stored with one of the cache objects (atlas?) |
| 629 drawState.setGeometryProcessor(fCachedGeometryProcessor.get()); | 629 drawState.setGeometryProcessor(fCachedGeometryProcessor.get()); |
| 630 | 630 |
| 631 // Set draw state | 631 // Set draw state |
| 632 if (fUseLCDText) { | 632 if (fUseLCDText) { |
| 633 GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredCol
or); | 633 GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredCol
or); |
| 634 if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() || | 634 |
| 635 kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || | 635 // TODO: move supportsRGBCoverage check to setupCoverageEffect and o
nly add LCD |
| 636 fPaint.numColorStages()) { | 636 // processor if the xp can support it. For now we will simply assume
that if |
| 637 // fUseLCDText is true, then we have a known color output. |
| 638 if (!drawState.getXPFactory()->supportsRGBCoverage(0, kRGBA_GrColorC
omponentFlags)) { |
| 637 SkDebugf("LCD Text will not draw correctly.\n"); | 639 SkDebugf("LCD Text will not draw correctly.\n"); |
| 638 } | 640 } |
| 639 SkASSERT(!drawState.hasColorVertexAttribute()); | 641 SkASSERT(!drawState.hasColorVertexAttribute()); |
| 640 // We don't use the GrPaint's color in this case because it's been p
remultiplied by | 642 // We don't use the GrPaint's color in this case because it's been p
remultiplied by |
| 641 // alpha. Instead we feed in a non-premultiplied color, and multiply
its alpha by | 643 // alpha. Instead we feed in a non-premultiplied color, and multiply
its alpha by |
| 642 // the mask texture color. The end result is that we get | 644 // the mask texture color. The end result is that we get |
| 643 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*dstCo
lor | 645 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*dstCo
lor |
| 644 int a = SkColorGetA(fSkPaint.getColor()); | 646 int a = SkColorGetA(fSkPaint.getColor()); |
| 645 // paintAlpha | 647 // paintAlpha |
| 646 drawState.setColor(SkColorSetARGB(a, a, a, a)); | 648 drawState.setColor(SkColorSetARGB(a, a, a, a)); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 673 } | 675 } |
| 674 } | 676 } |
| 675 | 677 |
| 676 inline void GrDistanceFieldTextContext::finish() { | 678 inline void GrDistanceFieldTextContext::finish() { |
| 677 this->flush(); | 679 this->flush(); |
| 678 fTotalVertexCount = 0; | 680 fTotalVertexCount = 0; |
| 679 | 681 |
| 680 GrTextContext::finish(); | 682 GrTextContext::finish(); |
| 681 } | 683 } |
| 682 | 684 |
| OLD | NEW |