BootAnimation.h revision 8335f1ccccedb6655d96d9d5b697a7f0938235dd
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 }; 74 int fps; 75 int width; 76 int height; 77 Vector<Part> parts; 78 }; 79 80 status_t initTexture(Texture* texture, AssetManager& asset, const char* name); 81 status_t initTexture(void* buffer, size_t len); 82 bool android(); 83 bool movie(); 84 85 sp<SurfaceComposerClient> mSession; 86 AssetManager mAssets; 87 Texture mAndroid[2]; 88 int mWidth; 89 int mHeight; 90 EGLDisplay mDisplay; 91 EGLDisplay mContext; 92 EGLDisplay mSurface; 93 sp<SurfaceControl> mFlingerSurfaceControl; 94 sp<Surface> mFlingerSurface; 95 bool mAndroidAnimation; 96 ZipFileRO mZip; 97}; 98 99// --------------------------------------------------------------------------- 100 101}; // namespace android 102 103#endif // ANDROID_BOOTANIMATION_H 104