Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- status_t BootAnimation::readyToRun() {
- mAssets.addDefaultAssets();
- DisplayInfo dinfo;
- status_t status = session()->getDisplayInfo(0, &dinfo);
- if (status)
- return -1;
- // create the native surface
- sp<SurfaceControl> control = session()->createSurface(
- getpid(), 0, dinfo.w, dinfo.h, PIXEL_FORMAT_RGB_565);
- session()->openTransaction();
- control->setLayer(0x40000000);
- session()->closeTransaction();
- sp<Surface> s = control->getSurface();
- // initialize opengl and egl
- const EGLint attribs[] = {
- EGL_DEPTH_SIZE, 0,
- EGL_NONE
- };
- EGLint w, h, dummy;
- EGLint numConfigs;
- EGLConfig config;
- EGLSurface surface;
- EGLContext context;
- EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- eglInitialize(display, 0, 0);
- EGLUtils::selectConfigForNativeWindow(display, attribs, s.get(), &config);
- surface = eglCreateWindowSurface(display, config, s.get(), NULL);
- context = eglCreateContext(display, config, NULL, NULL);
- eglQuerySurface(display, surface, EGL_WIDTH, &w);
- eglQuerySurface(display, surface, EGL_HEIGHT, &h);
- if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE)
- return NO_INIT;
- mDisplay = display;
- mContext = context;
- mSurface = surface;
- mWidth = w;
- mHeight = h;
- mFlingerSurfaceControl = control;
- mFlingerSurface = s;
- mAndroidAnimation = false;
- status_t err = mZip.open("/data/local/bootanimation.zip");
- if (err != NO_ERROR) {
- err = mZip.open("/system/media/bootanimation.zip");
- if (err != NO_ERROR) {
- mAndroidAnimation = true;
- }
- }
- return NO_ERROR;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement