fix tricolor shader

1. map pixel-centers through inverse (correctness)
2. forward-difference srcXY in loop (perf)

Lots of minor (but correct) changes in GMs

Bug: skia:6578
Change-Id: I2ad2ef939f58373d33212d4056c7d2f63eaafe0e
Reviewed-on: https://skia-review.googlesource.com/15153
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
This commit is contained in:
Mike Reed 2017-05-02 17:01:08 -04:00 committed by Skia Commit-Bot
parent 343fe49b82
commit ad15264f9a

View File

@ -1802,10 +1802,8 @@ void SkTriColorShader::TriColorShaderContext::shadeSpan(int x, int y, SkPMColor
SkPoint src;
fDstToUnit.mapXY(SkIntToScalar(x) + 0.5, SkIntToScalar(y) + 0.5, &src);
for (int i = 0; i < count; i++) {
fDstToUnit.mapXY(SkIntToScalar(x), SkIntToScalar(y), &src);
x += 1;
int scale1 = ScalarTo256(src.fX);
int scale2 = ScalarTo256(src.fY);
int scale0 = 256 - scale1 - scale2;
@ -1827,6 +1825,9 @@ void SkTriColorShader::TriColorShaderContext::shadeSpan(int x, int y, SkPMColor
dstC[i] = SkAlphaMulQ(fColors[0], scale0) +
SkAlphaMulQ(fColors[1], scale1) +
SkAlphaMulQ(fColors[2], scale2);
src.fX += fDstToUnit.getScaleX();
src.fY += fDstToUnit.getSkewY();
}
}