Advertisement
Guest User

BootAnimation.cpp CM7

a guest
Dec 8th, 2011
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.73 KB | None | 0 0
  1. status_t BootAnimation::readyToRun() {
  2.     mAssets.addDefaultAssets();
  3.  
  4.     DisplayInfo dinfo;
  5.     status_t status = session()->getDisplayInfo(0, &dinfo);
  6.     if (status)
  7.         return -1;
  8.  
  9.     // create the native surface
  10.     sp<SurfaceControl> control = session()->createSurface(
  11.             getpid(), 0, dinfo.w, dinfo.h, PIXEL_FORMAT_RGB_565);
  12.     session()->openTransaction();
  13.     control->setLayer(0x40000000);
  14.     session()->closeTransaction();
  15.  
  16.     sp<Surface> s = control->getSurface();
  17.  
  18.     // initialize opengl and egl
  19.     const EGLint attribs[] = {
  20.             EGL_DEPTH_SIZE, 0,
  21.             EGL_NONE
  22.     };
  23.     EGLint w, h, dummy;
  24.     EGLint numConfigs;
  25.     EGLConfig config;
  26.     EGLSurface surface;
  27.     EGLContext context;
  28.  
  29.     EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
  30.  
  31.     eglInitialize(display, 0, 0);
  32.     EGLUtils::selectConfigForNativeWindow(display, attribs, s.get(), &config);
  33.     surface = eglCreateWindowSurface(display, config, s.get(), NULL);
  34.     context = eglCreateContext(display, config, NULL, NULL);
  35.     eglQuerySurface(display, surface, EGL_WIDTH, &w);
  36.     eglQuerySurface(display, surface, EGL_HEIGHT, &h);
  37.  
  38.     if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE)
  39.         return NO_INIT;
  40.  
  41.     mDisplay = display;
  42.     mContext = context;
  43.     mSurface = surface;
  44.     mWidth = w;
  45.     mHeight = h;
  46.     mFlingerSurfaceControl = control;
  47.     mFlingerSurface = s;
  48.  
  49.     mAndroidAnimation = false;
  50.     status_t err = mZip.open("/data/local/bootanimation.zip");
  51.     if (err != NO_ERROR) {
  52.         err = mZip.open("/system/media/bootanimation.zip");
  53.         if (err != NO_ERROR) {
  54.             mAndroidAnimation = true;
  55.         }
  56.     }
  57.  
  58.     return NO_ERROR;
  59. }
  60.  
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement