Fix bug in filterSpan4f - read the source, rather than the dest

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2091793003

Review-Url: https://codereview.chromium.org/2091793003
This commit is contained in:
brianosman 2016-06-23 11:33:21 -07:00 committed by Commit bot
parent 9834696ed8
commit ff723af8b6

View File

@ -37,19 +37,20 @@ sk_sp<GrFragmentProcessor> SkColorFilter::asFragmentProcessor(GrContext*) const
} }
#endif #endif
void SkColorFilter::filterSpan4f(const SkPM4f[], int count, SkPM4f span[]) const { void SkColorFilter::filterSpan4f(const SkPM4f src[], int count, SkPM4f result[]) const {
const int N = 128; const int N = 128;
SkPMColor tmp[N]; SkPMColor tmp[N];
while (count > 0) { while (count > 0) {
int n = SkTMin(count, N); int n = SkTMin(count, N);
for (int i = 0; i < n; ++i) { for (int i = 0; i < n; ++i) {
SkNx_cast<uint8_t>(Sk4f::Load(span[i].fVec) * Sk4f(255) + Sk4f(0.5f)).store(&tmp[i]); SkNx_cast<uint8_t>(Sk4f::Load(src[i].fVec) * Sk4f(255) + Sk4f(0.5f)).store(&tmp[i]);
} }
this->filterSpan(tmp, n, tmp); this->filterSpan(tmp, n, tmp);
for (int i = 0; i < n; ++i) { for (int i = 0; i < n; ++i) {
span[i] = SkPM4f::FromPMColor(tmp[i]); result[i] = SkPM4f::FromPMColor(tmp[i]);
} }
span += n; src += n;
result += n;
count -= n; count -= n;
} }
} }