Chromium Code Reviews| Index: src/core/SkDraw.cpp |
| diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp |
| index a74e3c0f798123845c718fb717a30bba6ca9e4f9..305cdd389f9a5ec0ed95f0c0efb0b766e5d07f25 100644 |
| --- a/src/core/SkDraw.cpp |
| +++ b/src/core/SkDraw.cpp |
| @@ -2432,6 +2432,9 @@ size_t SkTriColorShader::contextSize() const { |
| return sizeof(TriColorShaderContext); |
| } |
| void SkTriColorShader::TriColorShaderContext::shadeSpan(int x, int y, SkPMColor dstC[], int count) { |
| + const unsigned alpha = this->getPaintAlpha(); |
| + const int alphaScale = alpha + (alpha >> 7); |
|
scroggo
2014/05/05 21:15:02
From the comments in SkColorPriv, it looks like th
reed1
2014/05/05 21:25:15
Done.
|
| + |
| SkPoint src; |
| for (int i = 0; i < count; i++) { |
| @@ -2450,9 +2453,15 @@ void SkTriColorShader::TriColorShaderContext::shadeSpan(int x, int y, SkPMColor |
| scale0 = 0; |
| } |
| + if (256 != alphaScale) { |
| + scale0 = (scale0 * alphaScale) >> 8; |
|
scroggo
2014/05/05 21:15:02
Why not use SkAlphaMul?
reed1
2014/05/05 21:25:15
Done.
|
| + scale1 = (scale1 * alphaScale) >> 8; |
| + scale2 = (scale2 * alphaScale) >> 8; |
| + } |
| + |
| dstC[i] = SkAlphaMulQ(fColors[0], scale0) + |
| - SkAlphaMulQ(fColors[1], scale1) + |
| - SkAlphaMulQ(fColors[2], scale2); |
| + SkAlphaMulQ(fColors[1], scale1) + |
| + SkAlphaMulQ(fColors[2], scale2); |
| } |
| } |