Index: src/core/SkDraw.cpp |
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp |
index a74e3c0f798123845c718fb717a30bba6ca9e4f9..9347efe475b4c9ade919e40a0864f1a5ce1e8867 100644 |
--- a/src/core/SkDraw.cpp |
+++ b/src/core/SkDraw.cpp |
@@ -2432,6 +2432,8 @@ size_t SkTriColorShader::contextSize() const { |
return sizeof(TriColorShaderContext); |
} |
void SkTriColorShader::TriColorShaderContext::shadeSpan(int x, int y, SkPMColor dstC[], int count) { |
+ const int alphaScale = Sk255To256(this->getPaintAlpha()); |
+ |
SkPoint src; |
for (int i = 0; i < count; i++) { |
@@ -2450,9 +2452,15 @@ void SkTriColorShader::TriColorShaderContext::shadeSpan(int x, int y, SkPMColor |
scale0 = 0; |
} |
+ if (256 != alphaScale) { |
+ scale0 = SkAlphaMul(scale0, alphaScale); |
+ scale1 = SkAlphaMul(scale1, alphaScale); |
+ scale2 = SkAlphaMul(scale2, alphaScale); |
+ } |
+ |
dstC[i] = SkAlphaMulQ(fColors[0], scale0) + |
- SkAlphaMulQ(fColors[1], scale1) + |
- SkAlphaMulQ(fColors[2], scale2); |
+ SkAlphaMulQ(fColors[1], scale1) + |
+ SkAlphaMulQ(fColors[2], scale2); |
} |
} |