Index: src/gpu/GrDistanceFieldTextContext.cpp |
diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp |
index 1f4070f4f5bef4ad43b5fd74cb6b2b5846df417b..55b2c623123642d9e833e48fe961a84fe90c3b73 100755 |
--- a/src/gpu/GrDistanceFieldTextContext.cpp |
+++ b/src/gpu/GrDistanceFieldTextContext.cpp |
@@ -405,7 +405,15 @@ void GrDistanceFieldTextContext::setupCoverageEffect(const SkColor& filteredColo |
flags != fEffectFlags) { |
if (fUseLCDText) { |
GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredColor); |
- fCachedGeometryProcessor.reset(GrDistanceFieldLCDTextureEffect::Create(fCurrTexture, |
+ |
+ // We don't use the GrPaint's color in this case because it's been premultiplied by |
+ // alpha. Instead we feed in a non-premultiplied color, and multiply its alpha by |
+ // the mask texture color. The end result is that we get |
+ // mask*paintAlpha*paintColor + (1-mask*paintAlpha)*dstColor |
+ int a = GrColorUnpackA(fSkPaint.getColor()); |
+ GrColor color = GrColorPackRGBA(a, a, a, a); |
+ fCachedGeometryProcessor.reset(GrDistanceFieldLCDTextureEffect::Create(color, |
+ fCurrTexture, |
params, |
fGammaTexture, |
gammaParams, |
@@ -413,18 +421,22 @@ void GrDistanceFieldTextContext::setupCoverageEffect(const SkColor& filteredColo |
flags)); |
} else { |
flags |= kColorAttr_DistanceFieldEffectFlag; |
+ GrColor color = fSkPaint.getColor(); |
#ifdef SK_GAMMA_APPLY_TO_A8 |
U8CPU lum = SkColorSpaceLuminance::computeLuminance(fDeviceProperties.gamma(), |
filteredColor); |
- fCachedGeometryProcessor.reset(GrDistanceFieldTextureEffect::Create(fCurrTexture, |
+ fCachedGeometryProcessor.reset(GrDistanceFieldTextureEffect::Create(color, |
+ fCurrTexture, |
params, |
fGammaTexture, |
gammaParams, |
lum/255.f, |
flags)); |
#else |
- fCachedGeometryProcessor.reset(GrDistanceFieldNoGammaTextureEffect::Create(fCurrTexture, |
- params, flags)); |
+ fCachedGeometryProcessor.reset(GrDistanceFieldNoGammaTextureEffect::Create(color, |
+ fCurrTexture, |
+ params, |
+ flags)); |
#endif |
} |
fEffectTextureUniqueID = textureUniqueID; |