diff options
| author | 2021-08-19 01:24:43 +0000 | |
|---|---|---|
| committer | 2021-08-19 01:24:43 +0000 | |
| commit | 4a14527fb84659d0eb9199b6a7ed2e2911399aed (patch) | |
| tree | a7306fa885ef9f0170f2960c159070a7056bc53d /cmds/bootanimation/BootAnimation.cpp | |
| parent | 03a9ea8fa00161f6bda1053eb2d4ad70298e9f6a (diff) | |
| parent | ba48d5a0f9c8501f0f3021b70fc07b48cbb6452f (diff) | |
Merge "Revert "Revert "Revert "Revert "Implement dynamic colors for boot animation.""""" into sc-qpr1-dev am: 813c29b9a5 am: 9d7c1b7163 am: ba48d5a0f9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15600806
Change-Id: I8478388303170a00c288e37274e9560c817d52f6
Diffstat (limited to 'cmds/bootanimation/BootAnimation.cpp')
| -rw-r--r-- | cmds/bootanimation/BootAnimation.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 7c81f0942f78..98f26516dc76 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -728,6 +728,22 @@ void BootAnimation::initShaders() { glVertexAttribPointer(uvLocation, 2, GL_FLOAT, GL_FALSE, 0, quadUVs); glEnableVertexAttribArray(uvLocation); + if (dynamicColoringEnabled) { + glUseProgram(mImageShader); + SLOGI("[BootAnimation] Dynamically coloring boot animation."); + for (int i = 0; i < DYNAMIC_COLOR_COUNT; i++) { + float *startColor = mAnimation->startColors[i]; + float *endColor = mAnimation->endColors[i]; + glUniform4f(glGetUniformLocation(mImageShader, + (U_START_COLOR_PREFIX + std::to_string(i)).c_str()), + startColor[0], startColor[1], startColor[2], 1 /* alpha */); + glUniform4f(glGetUniformLocation(mImageShader, + (U_END_COLOR_PREFIX + std::to_string(i)).c_str()), + endColor[0], endColor[1], endColor[2], 1 /* alpha */); + } + mImageColorProgressLocation = glGetUniformLocation(mImageShader, U_COLOR_PROGRESS); + } + // Initialize text shader. mTextShader = linkShader(vertexShader, textFragmentShader); positionLocation = glGetAttribLocation(mTextShader, A_POSITION); @@ -1163,6 +1179,12 @@ bool BootAnimation::parseAnimationDesc(Animation& animation) { s = ++endl; } + for (int i = 0; i < DYNAMIC_COLOR_COUNT; i++) { + parseColorDecimalString( + android::base::GetProperty("persist.bootanim.color" + std::to_string(i + 1), ""), + animation.endColors[i], animation.startColors[i]); + } + return true; } |