aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/SkColorMatrixFilter.cpp
diff options
context:
space:
mode:
authorGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-03 22:42:26 +0000
committerGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-03 22:42:26 +0000
commitdf28f077b05bcd7ad4415b7ec29631a221b0f3fa (patch)
treec05e08b0f34687a82aa072cfeccbf2b8973e2723 /src/effects/SkColorMatrixFilter.cpp
parent8cddc8d0ea02b3476fd57668cf9b25ba5b9770d8 (diff)
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
Diffstat (limited to 'src/effects/SkColorMatrixFilter.cpp')
-rw-r--r--src/effects/SkColorMatrixFilter.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp
index 95f4b0bac4..8a4df66a38 100644
--- a/src/effects/SkColorMatrixFilter.cpp
+++ b/src/effects/SkColorMatrixFilter.cpp
@@ -270,13 +270,7 @@ void SkColorMatrixFilter::filterSpan(const SkPMColor src[], int count,
b = pin(result[2], SK_B32_MASK);
a = pin(result[3], SK_A32_MASK);
// re-prepremultiply if needed
- if (255 != a) {
- int scale = SkAlpha255To256(a);
- r = SkAlphaMul(r, scale);
- g = SkAlphaMul(g, scale);
- b = SkAlphaMul(b, scale);
- }
- dst[i] = SkPackARGB32(a, r, g, b);
+ dst[i] = SkPremultiplyARGBInline(a, r, g, b);
}
}