Handle premultiplication correctly for ColorMatrixColorFilters
bug:17405627
Previously, the input content to the color matrix computation was left
premultiplied. Since the color matrix could reduce the alpha channel,
the alpha was re-multiplied, but this was incomplete, and incorrect.
Instead, apply the color matrix in unpremultiplied space.
Change-Id: I87b8e03d2e228e6ded81f7bbfea952605d7a095c
diff --git a/libs/hwui/Renderer.h b/libs/hwui/Renderer.h
index 6d4bb4a..3681637 100644
--- a/libs/hwui/Renderer.h
+++ b/libs/hwui/Renderer.h
@@ -70,6 +70,7 @@
// TODO: move to a method on android:Paint
static inline bool paintWillNotDraw(const SkPaint& paint) {
return paint.getAlpha() == 0
+ && !paint.getColorFilter()
&& getXfermode(paint.getXfermode()) != SkXfermode::kClear_Mode;
}
@@ -77,6 +78,7 @@
static inline bool paintWillNotDrawText(const SkPaint& paint) {
return paint.getAlpha() == 0
&& paint.getLooper() == NULL
+ && !paint.getColorFilter()
&& getXfermode(paint.getXfermode()) == SkXfermode::kSrcOver_Mode;
}
// ----------------------------------------------------------------------------