summaryrefslogtreecommitdiff
path: root/cmds/bootanimation/BootAnimation.h
diff options
context:
space:
mode:
authorDamien Bargiacchi <drb@google.com>2016-08-29 04:11:19 -0700
committerDamien Bargiacchi <drb@google.com>2016-09-05 04:51:45 -0700
commit0e3d2ab6d2988a1ae70d13d6d77a0f8109eb66e1 (patch)
tree48dad4babbef6b742c0932b958ea4274aa63e446 /cmds/bootanimation/BootAnimation.h
parent9925ae6e3875f2d88c82f6de4c2aeebfe983d152 (diff)
Allow custom fonts in the boot animaiton zip file
Change the font format to be a 16x6 grid of characters Bug: 29580875 Change-Id: Ia468307cb9770436e8ae865c91acda23a71bde05
Diffstat (limited to 'cmds/bootanimation/BootAnimation.h')
-rw-r--r--cmds/bootanimation/BootAnimation.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/cmds/bootanimation/BootAnimation.h b/cmds/bootanimation/BootAnimation.h
index fd497a362fc7..42759f1acf0d 100644
--- a/cmds/bootanimation/BootAnimation.h
+++ b/cmds/bootanimation/BootAnimation.h
@@ -74,6 +74,13 @@ private:
GLuint name;
};
+ struct Font {
+ FileMap* map;
+ Texture texture;
+ int char_width;
+ int char_height;
+ };
+
struct Animation {
struct Frame {
String8 name;
@@ -90,8 +97,12 @@ private:
struct Part {
int count; // The number of times this part should repeat, 0 for infinite
int pause; // The number of frames to pause for at the end of this part
- int clockPosY; // The y position of the clock, in pixels, from the bottom of the
- // display (the clock is centred horizontally). -1 to disable the clock
+ int clockPosX; // The x position of the clock, in pixels. Positive values offset from
+ // the left of the screen, negative values offset from the right.
+ int clockPosY; // The y position of the clock, in pixels. Positive values offset from
+ // the bottom of the screen, negative values offset from the top.
+ // If either of the above are INT_MIN the clock is disabled, if INT_MAX
+ // the clock is centred on that axis.
String8 path;
String8 trimData;
SortedVector<Frame> frames;
@@ -108,13 +119,17 @@ private:
String8 audioConf;
String8 fileName;
ZipFileRO* zip;
+ Font clockFont;
};
status_t initTexture(Texture* texture, AssetManager& asset, const char* name);
- status_t initTexture(const Animation::Frame& frame);
+ status_t initTexture(FileMap* map, int* width, int* height);
+ status_t initFont(Font* font, const char* fallback);
bool android();
bool movie();
- void drawTime(const Texture& clockTex, const int yPos);
+ 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);
+ bool validClock(const Animation::Part& part);
Animation* loadAnimation(const String8&);
bool playAnimation(const Animation&);
void releaseAnimation(Animation*) const;
@@ -127,7 +142,6 @@ private:
sp<SurfaceComposerClient> mSession;
AssetManager mAssets;
Texture mAndroid[2];
- Texture mClock;
int mWidth;
int mHeight;
bool mUseNpotTextures = false;