Merge "Try to load colors more frequently" into tm-dev
This commit is contained in:
@@ -1459,6 +1459,8 @@ bool BootAnimation::playAnimation(const Animation& animation) {
|
|||||||
|
|
||||||
int fadedFramesCount = 0;
|
int fadedFramesCount = 0;
|
||||||
int lastDisplayedProgress = 0;
|
int lastDisplayedProgress = 0;
|
||||||
|
int colorTransitionStart = animation.colorTransitionStart;
|
||||||
|
int colorTransitionEnd = animation.colorTransitionEnd;
|
||||||
for (size_t i=0 ; i<pcount ; i++) {
|
for (size_t i=0 ; i<pcount ; i++) {
|
||||||
const Animation::Part& part(animation.parts[i]);
|
const Animation::Part& part(animation.parts[i]);
|
||||||
const size_t fcount = part.frames.size();
|
const size_t fcount = part.frames.size();
|
||||||
@@ -1471,15 +1473,27 @@ bool BootAnimation::playAnimation(const Animation& animation) {
|
|||||||
continue; //to next part
|
continue; //to next part
|
||||||
}
|
}
|
||||||
|
|
||||||
if (animation.dynamicColoringEnabled && part.useDynamicColoring && !mDynamicColorsApplied) {
|
|
||||||
SLOGD("Trying to load dynamic color sysprops.");
|
|
||||||
initDynamicColors();
|
|
||||||
}
|
|
||||||
|
|
||||||
// process the part not only while the count allows but also if already fading
|
// process the part not only while the count allows but also if already fading
|
||||||
for (int r=0 ; !part.count || r<part.count || fadedFramesCount > 0 ; r++) {
|
for (int r=0 ; !part.count || r<part.count || fadedFramesCount > 0 ; r++) {
|
||||||
if (shouldStopPlayingPart(part, fadedFramesCount, lastDisplayedProgress)) break;
|
if (shouldStopPlayingPart(part, fadedFramesCount, lastDisplayedProgress)) break;
|
||||||
|
|
||||||
|
// It's possible that the sysprops were not loaded yet at this boot phase.
|
||||||
|
// If that's the case, then we should keep trying until they are available.
|
||||||
|
if (animation.dynamicColoringEnabled && !mDynamicColorsApplied
|
||||||
|
&& (part.useDynamicColoring || part.postDynamicColoring)) {
|
||||||
|
SLOGD("Trying to load dynamic color sysprops.");
|
||||||
|
initDynamicColors();
|
||||||
|
if (mDynamicColorsApplied) {
|
||||||
|
// Sysprops were loaded. Next step is to adjust the animation if we loaded
|
||||||
|
// the colors after the animation should have started.
|
||||||
|
const int transitionLength = colorTransitionEnd - colorTransitionStart;
|
||||||
|
if (part.postDynamicColoring) {
|
||||||
|
colorTransitionStart = 0;
|
||||||
|
colorTransitionEnd = fmin(transitionLength, fcount - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mCallbacks->playPart(i, part, r);
|
mCallbacks->playPart(i, part, r);
|
||||||
|
|
||||||
glClearColor(
|
glClearColor(
|
||||||
@@ -1509,9 +1523,8 @@ bool BootAnimation::playAnimation(const Animation& animation) {
|
|||||||
// - 1 for parts that come after.
|
// - 1 for parts that come after.
|
||||||
float colorProgress = part.useDynamicColoring
|
float colorProgress = part.useDynamicColoring
|
||||||
? fmin(fmax(
|
? fmin(fmax(
|
||||||
((float)j - animation.colorTransitionStart) /
|
((float)j - colorTransitionStart) /
|
||||||
fmax(animation.colorTransitionEnd -
|
fmax(colorTransitionEnd - colorTransitionStart, 1.0f), 0.0f), 1.0f)
|
||||||
animation.colorTransitionStart, 1.0f), 0.0f), 1.0f)
|
|
||||||
: (part.postDynamicColoring ? 1 : 0);
|
: (part.postDynamicColoring ? 1 : 0);
|
||||||
|
|
||||||
processDisplayEvents();
|
processDisplayEvents();
|
||||||
|
|||||||
Reference in New Issue
Block a user