diff options
author | Mathias Agopian <> | 2009-03-24 19:41:37 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-24 19:41:37 -0700 |
commit | ec4faffff3759f4cf2129d8793dce1a4a8f71a4a (patch) | |
tree | 1024654a1e25d047001746d90e2bddb31d9ba912 /libs | |
parent | 9d4de636236f7e9a09bd73bd16378c287c82b017 (diff) | |
download | frameworks_base-ec4faffff3759f4cf2129d8793dce1a4a8f71a4a.zip frameworks_base-ec4faffff3759f4cf2129d8793dce1a4a8f71a4a.tar.gz frameworks_base-ec4faffff3759f4cf2129d8793dce1a4a8f71a4a.tar.bz2 |
Automated import from //branches/cupcake/...@142427,142427
Diffstat (limited to 'libs')
-rw-r--r-- | libs/surfaceflinger/BootAnimation.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libs/surfaceflinger/BootAnimation.cpp b/libs/surfaceflinger/BootAnimation.cpp index 03edbf3..db40385 100644 --- a/libs/surfaceflinger/BootAnimation.cpp +++ b/libs/surfaceflinger/BootAnimation.cpp @@ -164,9 +164,7 @@ status_t BootAnimation::readyToRun() { // initialize GL glShadeModel(GL_FLAT); - glEnable(GL_DITHER); glEnable(GL_TEXTURE_2D); - glEnable(GL_SCISSOR_TEST); glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); return NO_ERROR; @@ -196,8 +194,6 @@ bool BootAnimation::android() { glClear(GL_COLOR_BUFFER_BIT); eglSwapBuffers(mDisplay, mSurface); - // wait ~1s - const GLint xc = (mWidth - mAndroid[0].w) / 2; const GLint yc = (mHeight - mAndroid[0].h) / 2; const Rect updateRect(xc, yc, xc + mAndroid[0].w, yc + mAndroid[0].h); @@ -216,7 +212,8 @@ bool BootAnimation::android() { const nsecs_t startTime = systemTime(); do { - double time = systemTime() - startTime; + nsecs_t now = systemTime(); + double time = now - startTime; float t = 4.0f * float(time / us2ns(16667)) / mAndroid[1].w; GLint offset = (1 - (t - floorf(t))) * mAndroid[1].w; GLint x = xc - offset; @@ -231,6 +228,11 @@ bool BootAnimation::android() { glDrawTexiOES(xc, yc, 0, mAndroid[0].w, mAndroid[0].h); eglSwapBuffers(mDisplay, mSurface); + + // 12fps: don't animate too fast to preserve CPU + const nsecs_t sleepTime = 83333 - ns2us(systemTime() - now); + if (sleepTime > 0) + usleep(sleepTime); } while (!exitPending()); glDeleteTextures(1, &mAndroid[0].name); |