summaryrefslogtreecommitdiff
path: root/libs/hwui/GradientCache.cpp
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2017-02-07 19:26:57 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2017-02-07 19:27:02 +0000
commit3f57d7f7eb83ffd0e4d91f677a353fa6b0bc8332 (patch)
tree00a1726e4b7308decb5a954021064579cb91b2c9 /libs/hwui/GradientCache.cpp
parent1e2758256a391be23c537725f0a7785e4fb5b7d0 (diff)
parent9fe7e16399aa9739b63ce9add1d04fd8ef00678f (diff)
Merge "Gradients are now an absurd Chimera"
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);