summaryrefslogtreecommitdiff
path: root/cmds/bootanimation/BootAnimation.h
diff options
context:
space:
mode:
author Yegor Malyshev <emalyshev@google.com> 2020-10-20 20:31:09 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2020-10-20 20:31:09 +0000
commit660268ab4bb901f9ad288c5ec4f4809af7dc5552 (patch)
treeea09c1690197e5a64e6418f09600e96528653a6e /cmds/bootanimation/BootAnimation.h
parent4bd554930266bc6c55d4d66ab0ad5fb5995ee294 (diff)
parent858986161e5a62b19a9ef6db55a05854e86c7a0f (diff)
Merge "Support animation parts fading out" am: 21819ef3b6 am: 648a4c2ea4 am: 858986161e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1466262 Change-Id: I12887abcae65f27d5a8c8b19acbbf63ea4833ff0
Diffstat (limited to 'cmds/bootanimation/BootAnimation.h')
-rw-r--r--cmds/bootanimation/BootAnimation.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmds/bootanimation/BootAnimation.h b/cmds/bootanimation/BootAnimation.h
index 6ba7fd450fbb..aee385387f57 100644
--- a/cmds/bootanimation/BootAnimation.h
+++ b/cmds/bootanimation/BootAnimation.h
@@ -19,6 +19,7 @@
#include <vector>
#include <queue>
+#include <climits>
#include <stdint.h>
#include <sys/types.h>
@@ -45,6 +46,8 @@ class SurfaceControl;
class BootAnimation : public Thread, public IBinder::DeathRecipient
{
public:
+ static constexpr int MAX_FADED_FRAMES_COUNT = std::numeric_limits<int>::max();
+
struct Texture {
GLint w;
GLint h;
@@ -84,10 +87,15 @@ public:
String8 trimData;
SortedVector<Frame> frames;
bool playUntilComplete;
+ int framesToFadeCount;
float backgroundColor[3];
uint8_t* audioData;
int audioLength;
Animation* animation;
+
+ bool hasFadingPhase() const {
+ return !playUntilComplete && framesToFadeCount > 0;
+ }
};
int fps;
int width;
@@ -160,6 +168,8 @@ private:
bool movie();
void drawText(const char* str, const Font& font, bool bold, int* x, int* y);
void drawClock(const Font& font, const int xPos, const int yPos);
+ void fadeFrame(int frameLeft, int frameBottom, int frameWidth, int frameHeight,
+ const Animation::Part& part, int fadedFramesCount);
bool validClock(const Animation::Part& part);
Animation* loadAnimation(const String8&);
bool playAnimation(const Animation&);
@@ -172,7 +182,9 @@ private:
EGLConfig getEglConfig(const EGLDisplay&);
ui::Size limitSurfaceSize(int width, int height) const;
void resizeSurface(int newWidth, int newHeight);
+ void projectSceneToWindow();
+ bool shouldStopPlayingPart(const Animation::Part& part, int fadedFramesCount);
void checkExit();
void handleViewport(nsecs_t timestep);