summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorMathias Agopian <>2009-03-24 22:42:15 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-24 22:42:15 -0700
commit6219dd7d3a685725e1f8e0fad94e6aa64492ca82 (patch)
treecac150639e44ff20afbcf51e497404b39b432b9a /libs
parent44426618172ab6605fd0d1eb1459cd2b3c8069df (diff)
downloadframeworks_native-6219dd7d3a685725e1f8e0fad94e6aa64492ca82.zip
frameworks_native-6219dd7d3a685725e1f8e0fad94e6aa64492ca82.tar.gz
frameworks_native-6219dd7d3a685725e1f8e0fad94e6aa64492ca82.tar.bz2
Automated import from //branches/donutburger/...@142430,142430
Diffstat (limited to 'libs')
-rw-r--r--libs/surfaceflinger/BootAnimation.cpp12
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);