Improve the quality of color matrix filters by using SkPremultiplyARGBInline.

This is closer (but not exactly the same as) WebKit's implementation.

Review URL:  http://codereview.appspot.com/5504117/



git-svn-id: http://skia.googlecode.com/svn/trunk@2955 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
senorblanco@chromium.org 2012-01-03 22:42:26 +00:00
parent 8cddc8d0ea
commit df28f077b0

View File

@ -270,13 +270,7 @@ void SkColorMatrixFilter::filterSpan(const SkPMColor src[], int count,
b = pin(result[2], SK_B32_MASK); b = pin(result[2], SK_B32_MASK);
a = pin(result[3], SK_A32_MASK); a = pin(result[3], SK_A32_MASK);
// re-prepremultiply if needed // re-prepremultiply if needed
if (255 != a) { dst[i] = SkPremultiplyARGBInline(a, r, g, b);
int scale = SkAlpha255To256(a);
r = SkAlphaMul(r, scale);
g = SkAlphaMul(g, scale);
b = SkAlphaMul(b, scale);
}
dst[i] = SkPackARGB32(a, r, g, b);
} }
} }