diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-09-20 17:59:49 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-09-20 17:59:49 +0000 |
commit | cc9471c36d3967270f7eb26f8b53ce0f17bc9fbb (patch) | |
tree | cc6ccafbb894e94053d43628295770c9f9193297 /src | |
parent | fc641d09e5a1a9f7fae369ae06a8b96089faf57b (diff) |
Fix premul alpha problems w/matrix convolution filter, and re-enable the bench.
http://codereview.appspot.com/6541043/
git-svn-id: http://skia.googlecode.com/svn/trunk@5610 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/effects/SkMatrixConvolutionImageFilter.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp index 67104f04d9..e5acf563f3 100644 --- a/src/effects/SkMatrixConvolutionImageFilter.cpp +++ b/src/effects/SkMatrixConvolutionImageFilter.cpp @@ -113,14 +113,11 @@ void SkMatrixConvolutionImageFilter::filterPixels(const SkBitmap& src, SkBitmap* sumB += SkScalarMul(SkIntToScalar(SkGetPackedB32(s)), k); } } - int a = SkScalarFloorToInt(SkScalarMul(sumA, fGain) + fBias); - int r = SkScalarFloorToInt(SkScalarMul(sumR, fGain) + fBias); - int g = SkScalarFloorToInt(SkScalarMul(sumG, fGain) + fBias); - int b = SkScalarFloorToInt(SkScalarMul(sumB, fGain) + fBias); - *dptr++ = SkPackARGB32(SkClampMax(a, 255), - SkClampMax(r, 255), - SkClampMax(g, 255), - SkClampMax(b, 255)); + int a = SkClampMax(SkScalarFloorToInt(SkScalarMul(sumA, fGain) + fBias), 255); + int r = SkClampMax(SkScalarFloorToInt(SkScalarMul(sumR, fGain) + fBias), a); + int g = SkClampMax(SkScalarFloorToInt(SkScalarMul(sumG, fGain) + fBias), a); + int b = SkClampMax(SkScalarFloorToInt(SkScalarMul(sumB, fGain) + fBias), a); + *dptr++ = SkPackARGB32(a, r, g, b); } } } |