summaryrefslogtreecommitdiff
path: root/libs/hwui/GradientCache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/GradientCache.cpp')
-rw-r--r--libs/hwui/GradientCache.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libs/hwui/GradientCache.cpp b/libs/hwui/GradientCache.cpp
index 1dad58fd64b9..71bee93fc4c7 100644
--- a/libs/hwui/GradientCache.cpp
+++ b/libs/hwui/GradientCache.cpp
@@ -205,6 +205,10 @@ void GradientCache::mixFloats(const FloatColor& start, const FloatColor& end,
*d++ = a * (start.g * oppAmount + end.g * amount);
*d++ = a * (start.b * oppAmount + end.b * amount);
#else
+ // What we're doing to the alpha channel here is technically incorrect
+ // but reproduces Android's old behavior when the alpha was pre-multiplied
+ // with gamma-encoded colors
+ a = EOCF_sRGB(a);
*d++ = a * OECF_sRGB(start.r * oppAmount + end.r * amount);
*d++ = a * OECF_sRGB(start.g * oppAmount + end.g * amount);
*d++ = a * OECF_sRGB(start.b * oppAmount + end.b * amount);