| 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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 filteredColor = fSkPaint.getColor(); | 653 filteredColor = fSkPaint.getColor(); |
| 654 } | 654 } |
| 655 this->setupCoverageEffect(filteredColor); | 655 this->setupCoverageEffect(filteredColor); |
| 656 | 656 |
| 657 // Effects could be stored with one of the cache objects (atlas?) | 657 // Effects could be stored with one of the cache objects (atlas?) |
| 658 drawState.setGeometryProcessor(fCachedGeometryProcessor.get()); | 658 drawState.setGeometryProcessor(fCachedGeometryProcessor.get()); |
| 659 | 659 |
| 660 // Set draw state | 660 // Set draw state |
| 661 if (fUseLCDText) { | 661 if (fUseLCDText) { |
| 662 GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredCol
or); | 662 GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredCol
or); |
| 663 if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() || | 663 if (!drawState.getXPFactory()->supportsRGBCoverage(drawState)) { |
| 664 kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || | |
| 665 fPaint.numColorStages()) { | |
| 666 SkDebugf("LCD Text will not draw correctly.\n"); | 664 SkDebugf("LCD Text will not draw correctly.\n"); |
| 667 } | 665 } |
| 668 SkASSERT(!drawState.hasColorVertexAttribute()); | 666 SkASSERT(!drawState.hasColorVertexAttribute()); |
| 669 // We don't use the GrPaint's color in this case because it's been p
remultiplied by | 667 // We don't use the GrPaint's color in this case because it's been p
remultiplied by |
| 670 // alpha. Instead we feed in a non-premultiplied color, and multiply
its alpha by | 668 // alpha. Instead we feed in a non-premultiplied color, and multiply
its alpha by |
| 671 // the mask texture color. The end result is that we get | 669 // the mask texture color. The end result is that we get |
| 672 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*dstCo
lor | 670 // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*dstCo
lor |
| 673 int a = SkColorGetA(fSkPaint.getColor()); | 671 int a = SkColorGetA(fSkPaint.getColor()); |
| 674 // paintAlpha | 672 // paintAlpha |
| 675 drawState.setColor(SkColorSetARGB(a, a, a, a)); | 673 drawState.setColor(SkColorSetARGB(a, a, a, a)); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 702 } | 700 } |
| 703 } | 701 } |
| 704 | 702 |
| 705 inline void GrDistanceFieldTextContext::finish() { | 703 inline void GrDistanceFieldTextContext::finish() { |
| 706 this->flush(); | 704 this->flush(); |
| 707 fTotalVertexCount = 0; | 705 fTotalVertexCount = 0; |
| 708 | 706 |
| 709 GrTextContext::finish(); | 707 GrTextContext::finish(); |
| 710 } | 708 } |
| 711 | 709 |
| OLD | NEW |