blob: 8e28bba2de3c224fcd07b77d9615fbfb7b7b5914 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_BOOTANIMATION_H
18#define ANDROID_BOOTANIMATION_H
19
20#include <stdint.h>
21#include <sys/types.h>
22
23#include <utils/threads.h>
24#include <utils/AssetManager.h>
25
Mathias Agopian000479f2010-02-09 17:46:37 -080026#include <surfaceflinger/ISurfaceComposer.h>
27#include <surfaceflinger/SurfaceComposerClient.h>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028
29#include <EGL/egl.h>
30#include <GLES/gl.h>
31
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032class SkBitmap;
33
34namespace android {
35
36class AssetManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080037
38// ---------------------------------------------------------------------------
39
Mathias Agopianbc726112009-09-23 15:44:05 -070040class BootAnimation : public Thread, public IBinder::DeathRecipient
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041{
42public:
Mathias Agopian627e7b52009-05-21 19:21:59 -070043 BootAnimation();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044 virtual ~BootAnimation();
45
Mathias Agopianbc726112009-09-23 15:44:05 -070046 sp<SurfaceComposerClient> session() const;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047
48private:
49 virtual bool threadLoop();
50 virtual status_t readyToRun();
51 virtual void onFirstRef();
Mathias Agopianbc726112009-09-23 15:44:05 -070052 virtual void binderDied(const wp<IBinder>& who);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053
54 struct Texture {
55 GLint w;
56 GLint h;
57 GLuint name;
58 };
59
Mathias Agopiana8826d62009-10-01 03:10:14 -070060 struct Animation {
61 struct Frame {
62 String8 name;
63 FileMap* map;
64 mutable GLuint tid;
65 bool operator < (const Frame& rhs) const {
66 return name < rhs.name;
67 }
68 };
69 struct Part {
70 int count;
71 int pause;
72 String8 path;
73 SortedVector<Frame> frames;
74 };
75 int fps;
76 int width;
77 int height;
78 Vector<Part> parts;
79 };
80
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080081 status_t initTexture(Texture* texture, AssetManager& asset, const char* name);
Mathias Agopiana8826d62009-10-01 03:10:14 -070082 status_t initTexture(void* buffer, size_t len);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 bool android();
Mathias Agopiana8826d62009-10-01 03:10:14 -070084 bool movie();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085
86 sp<SurfaceComposerClient> mSession;
87 AssetManager mAssets;
Mathias Agopianb2cf9542009-03-24 18:34:16 -070088 Texture mAndroid[2];
89 int mWidth;
90 int mHeight;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091 EGLDisplay mDisplay;
92 EGLDisplay mContext;
93 EGLDisplay mSurface;
Mathias Agopian17f638b2009-04-16 20:04:08 -070094 sp<SurfaceControl> mFlingerSurfaceControl;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080095 sp<Surface> mFlingerSurface;
Mathias Agopiana8826d62009-10-01 03:10:14 -070096 bool mAndroidAnimation;
97 ZipFileRO mZip;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080098};
99
100// ---------------------------------------------------------------------------
101
102}; // namespace android
103
104#endif // ANDROID_BOOTANIMATION_H