BootAnimation.h revision 083b84cf8880bb7f0d2c2dc1b45c7d610656dbd1
1/* 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 <androidfw/AssetManager.h> 24#include <utils/threads.h> 25 26#include <EGL/egl.h> 27#include <GLES/gl.h> 28 29class SkBitmap; 30 31namespace android { 32 33class Surface; 34class SurfaceComposerClient; 35class SurfaceControl; 36 37// --------------------------------------------------------------------------- 38 39class BootAnimation : public Thread, public IBinder::DeathRecipient 40{ 41public: 42 BootAnimation(); 43 virtual ~BootAnimation(); 44 45 sp<SurfaceComposerClient> session() const; 46 47private: 48 virtual bool threadLoop(); 49 virtual status_t readyToRun(); 50 virtual void onFirstRef(); 51 virtual void binderDied(const wp<IBinder>& who); 52 53 struct Texture { 54 GLint w; 55 GLint h; 56 GLuint name; 57 }; 58 59 struct Animation { 60 struct Frame { 61 String8 name; 62 FileMap* map; 63 mutable GLuint tid; 64 bool operator < (const Frame& rhs) const { 65 return name < rhs.name; 66 } 67 }; 68 struct Part { 69 int count; 70 int pause; 71 String8 path; 72 SortedVector<Frame> frames; 73 bool playUntilComplete; 74 float backgroundColor[3]; 75 }; 76 int fps; 77 int width; 78 int height; 79 Vector<Part> parts; 80 }; 81 82 status_t initTexture(Texture* texture, AssetManager& asset, const char* name); 83 status_t initTexture(const Animation::Frame& frame); 84 bool android(); 85 bool movie(); 86 87 void checkExit(); 88 89 sp<SurfaceComposerClient> mSession; 90 AssetManager mAssets; 91 Texture mAndroid[2]; 92 int mWidth; 93 int mHeight; 94 EGLDisplay mDisplay; 95 EGLDisplay mContext; 96 EGLDisplay mSurface; 97 sp<SurfaceControl> mFlingerSurfaceControl; 98 sp<Surface> mFlingerSurface; 99 ZipFileRO *mZip; 100}; 101 102// --------------------------------------------------------------------------- 103 104}; // namespace android 105 106#endif // ANDROID_BOOTANIMATION_H 107