summaryrefslogtreecommitdiff
path: root/cmds/bootanimation/BootAnimation.cpp
diff options
context:
space:
mode:
author Andrew Zeng <zenga@google.com> 2022-11-09 21:38:12 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-11-09 21:38:12 +0000
commitb1b275b0327aeed858b9de551cd26c285bbaadf3 (patch)
tree59249214f05c7f86c99935ec40c933a1eda864c0 /cmds/bootanimation/BootAnimation.cpp
parentdc6b532f7dc53cee7d4221f242fb3af819cd1380 (diff)
parentf9f5822d8d391e9a4e053f89ef7b7944b26351bb (diff)
Merge "Fix boot animation alpha multiplication computations" into tm-qpr-dev
Diffstat (limited to 'cmds/bootanimation/BootAnimation.cpp')
-rw-r--r--cmds/bootanimation/BootAnimation.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index 50c8e933d25f..3f6046f01f11 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -132,14 +132,14 @@ static const char IMAGE_FRAG_DYNAMIC_COLORING_SHADER_SOURCE[] = R"(
uniform sampler2D uTexture;
uniform float uFade;
uniform float uColorProgress;
- uniform vec4 uStartColor0;
- uniform vec4 uStartColor1;
- uniform vec4 uStartColor2;
- uniform vec4 uStartColor3;
- uniform vec4 uEndColor0;
- uniform vec4 uEndColor1;
- uniform vec4 uEndColor2;
- uniform vec4 uEndColor3;
+ uniform vec3 uStartColor0;
+ uniform vec3 uStartColor1;
+ uniform vec3 uStartColor2;
+ uniform vec3 uStartColor3;
+ uniform vec3 uEndColor0;
+ uniform vec3 uEndColor1;
+ uniform vec3 uEndColor2;
+ uniform vec3 uEndColor3;
varying highp vec2 vUv;
void main() {
vec4 mask = texture2D(uTexture, vUv);
@@ -152,12 +152,12 @@ static const char IMAGE_FRAG_DYNAMIC_COLORING_SHADER_SOURCE[] = R"(
* step(cWhiteMaskThreshold, g)
* step(cWhiteMaskThreshold, b)
* step(cWhiteMaskThreshold, a);
- vec4 color = r * mix(uStartColor0, uEndColor0, uColorProgress)
+ vec3 color = r * mix(uStartColor0, uEndColor0, uColorProgress)
+ g * mix(uStartColor1, uEndColor1, uColorProgress)
+ b * mix(uStartColor2, uEndColor2, uColorProgress)
+ a * mix(uStartColor3, uEndColor3, uColorProgress);
- color = mix(color, vec4(vec3((r + g + b + a) * 0.25), 1.0), useWhiteMask);
- gl_FragColor = vec4(color.x, color.y, color.z, (1.0 - uFade)) * color.a;
+ color = mix(color, vec3((r + g + b + a) * 0.25), useWhiteMask);
+ gl_FragColor = vec4(color.x, color.y, color.z, (1.0 - uFade));
})";
static const char IMAGE_FRAG_SHADER_SOURCE[] = R"(
precision mediump float;
@@ -1440,12 +1440,12 @@ void BootAnimation::initDynamicColors() {
for (int i = 0; i < DYNAMIC_COLOR_COUNT; i++) {
float *startColor = mAnimation->startColors[i];
float *endColor = mAnimation->endColors[i];
- glUniform4f(glGetUniformLocation(mImageShader,
+ glUniform3f(glGetUniformLocation(mImageShader,
(U_START_COLOR_PREFIX + std::to_string(i)).c_str()),
- startColor[0], startColor[1], startColor[2], 1 /* alpha */);
- glUniform4f(glGetUniformLocation(mImageShader,
+ startColor[0], startColor[1], startColor[2]);
+ glUniform3f(glGetUniformLocation(mImageShader,
(U_END_COLOR_PREFIX + std::to_string(i)).c_str()),
- endColor[0], endColor[1], endColor[2], 1 /* alpha */);
+ endColor[0], endColor[1], endColor[2]);
}
mImageColorProgressLocation = glGetUniformLocation(mImageShader, U_COLOR_PROGRESS);
}