summaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorIliyan Malchev <malchev@google.com>2009-10-13 11:49:17 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2009-10-13 11:49:17 -0700
commit42870103826dd8aaf94a514075a3e65e6eea0969 (patch)
tree229ce1c512f41d4675d0539119aadac1281643af /res
parentb1c3676b19761e271a26bf669b9db813c14c6073 (diff)
parent0f23e1a3c1fdbe8bdee6ef7af259dd3194232e90 (diff)
downloadandroid_packages_apps_Trebuchet-42870103826dd8aaf94a514075a3e65e6eea0969.tar.gz
android_packages_apps_Trebuchet-42870103826dd8aaf94a514075a3e65e6eea0969.tar.bz2
android_packages_apps_Trebuchet-42870103826dd8aaf94a514075a3e65e6eea0969.zip
am 0f23e1a3: Merge branch \'eclair-plus-aosp\' of ssh://android-git.corp.google.com:29418/platform/packages/apps/Launcher2 into eclair-mr2-plus-aosp
Merge commit '0f23e1a3c1fdbe8bdee6ef7af259dd3194232e90' * commit '0f23e1a3c1fdbe8bdee6ef7af259dd3194232e90': Fix physics bug when the script would go to sleep. The large DT caused the next animation to error. Stop rendering after one frame past last movement.
Diffstat (limited to 'res')
-rw-r--r--res/raw/rollo.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/res/raw/rollo.c b/res/raw/rollo.c
index bae786d46..87fdd2207 100644
--- a/res/raw/rollo.c
+++ b/res/raw/rollo.c
@@ -27,6 +27,16 @@ float g_OldPosPage;
float g_OldPosVelocity;
float g_OldZoom;
+int g_DrawLastFrame;
+int lastFrame(int draw) {
+ // We draw one extra frame to work around the last frame post bug.
+ // We also need to track if we drew the last frame to deal with large DT
+ // in the physics.
+ int ret = g_DrawLastFrame | draw;
+ g_DrawLastFrame = draw;
+ return ret; // should return draw instead.
+}
+
void updateReadback() {
if ((g_OldPosPage != g_PosPage) ||
(g_OldPosVelocity != g_PosVelocity) ||
@@ -309,6 +319,16 @@ main(int launchID)
g_DT = (newTime - g_LastTime) / 1000.f;
g_LastTime = newTime;
+ if (!g_DrawLastFrame) {
+ // If we stopped rendering we cannot use DT.
+ // assume 30fps in this case.
+ g_DT = 0.033f;
+ }
+ if (g_DT > 0.2f) {
+ // physics may break if DT is large.
+ g_DT = 0.2f;
+ }
+
//debugF("zoom", g_Zoom);
if (g_Zoom != state->zoomTarget) {
float dz = (state->zoomTarget - g_Zoom) * g_DT * 5;
@@ -334,7 +354,7 @@ main(int launchID)
if (!g_LastTouchDown) {
g_PosPage = 0;
}
- return 1;//0;
+ return lastFrame(0);
} else if (g_Zoom < 0.85f) {
pfClearColor(0.0f, 0.0f, 0.0f, g_Zoom);
} else {
@@ -356,7 +376,7 @@ main(int launchID)
color(1.0f, 1.0f, 1.0f, 0.99f);
if (iconCount <= 0) {
- return 1;
+ return lastFrame(0);
}
int lastIcon = iconCount-1;
@@ -404,6 +424,6 @@ main(int launchID)
// Bug workaround where the last frame is not always displayed
// So we keep rendering until the bug is fixed.
- return 1;//(g_PosVelocity != 0) || fracf(g_PosPage) || (g_Zoom != state->zoomTarget);
+ return lastFrame((g_PosVelocity != 0) || fracf(g_PosPage) || (g_Zoom != state->zoomTarget));
}