summaryrefslogtreecommitdiff
path: root/libs/hwui/ProgramCache.cpp
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2017-04-04 19:06:28 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2017-04-04 19:06:32 +0000
commitf9340ca491f1e5bd7ba2d937c8e7d1c42a4edb6f (patch)
tree135f4591869169e73ce9d94582831a697cea82da /libs/hwui/ProgramCache.cpp
parent8f6b9d80587ffec6899fe45bd3a6930eac3b65d5 (diff)
parent669b15a93548b82135c73196665bcb7f03d87795 (diff)
Merge "Fix HWUI/Skia Gradients to premultiply the colors prior to interpolation" into oc-dev
Diffstat (limited to 'libs/hwui/ProgramCache.cpp')
-rw-r--r--libs/hwui/ProgramCache.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp
index 1f78e09b5a58..d0f0949d5e78 100644
--- a/libs/hwui/ProgramCache.cpp
+++ b/libs/hwui/ProgramCache.cpp
@@ -295,10 +295,6 @@ const char* gFS_GradientPreamble[2] = {
vec4 dither(const vec4 color) {
return color + (triangleNoise(gl_FragCoord.xy * screenSize.xy) / 255.0);
}
- vec4 gradientMix(const vec4 a, const vec4 b, float v) {
- vec4 c = mix(a, b, v);
- return vec4(c.rgb * c.a, c.a);
- }
)__SHADER__",
// sRGB framebuffer
R"__SHADER__(
@@ -306,10 +302,6 @@ const char* gFS_GradientPreamble[2] = {
vec3 dithered = sqrt(color.rgb) + (triangleNoise(gl_FragCoord.xy * screenSize.xy) / 255.0);
return vec4(dithered * dithered, color.a);
}
- vec4 gradientMixMix(const vec4 a, const vec4 b, float v) {
- vec4 c = mix(a, b, v);
- return vec4(c.rgb * c.a, c.a);
- }
)__SHADER__",
};
@@ -364,19 +356,19 @@ const char* gFS_Main_FetchGradient[6] = {
// Linear
" vec4 gradientColor = texture2D(gradientSampler, linear);\n",
- " vec4 gradientColor = gradientMix(startColor, endColor, clamp(linear, 0.0, 1.0));\n",
+ " vec4 gradientColor = mix(startColor, endColor, clamp(linear, 0.0, 1.0));\n",
// Circular
" vec4 gradientColor = texture2D(gradientSampler, vec2(length(circular), 0.5));\n",
- " vec4 gradientColor = gradientMix(startColor, endColor, clamp(length(circular), 0.0, 1.0));\n",
+ " vec4 gradientColor = mix(startColor, endColor, clamp(length(circular), 0.0, 1.0));\n",
// Sweep
" highp float index = atan(sweep.y, sweep.x) * 0.15915494309; // inv(2 * PI)\n"
" vec4 gradientColor = texture2D(gradientSampler, vec2(index - floor(index), 0.5));\n",
" highp float index = atan(sweep.y, sweep.x) * 0.15915494309; // inv(2 * PI)\n"
- " vec4 gradientColor = gradientMix(startColor, endColor, clamp(index - floor(index), 0.0, 1.0));\n"
+ " vec4 gradientColor = mix(startColor, endColor, clamp(index - floor(index), 0.0, 1.0));\n"
};
const char* gFS_Main_FetchBitmap =
" vec4 bitmapColor = colorConvert(texture2D(bitmapSampler, outBitmapTexCoords));\n";