summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/gallery3d/ui/AnimationTime.java8
-rw-r--r--src/com/android/gallery3d/ui/FadeInTexture.java2
-rw-r--r--src/com/android/gallery3d/ui/GLRootView.java5
-rw-r--r--src/com/android/gallery3d/ui/Paper.java2
-rw-r--r--src/com/android/gallery3d/ui/PositionController.java4
5 files changed, 14 insertions, 7 deletions
diff --git a/src/com/android/gallery3d/ui/AnimationTime.java b/src/com/android/gallery3d/ui/AnimationTime.java
index 793e8b607..64ee27c7b 100644
--- a/src/com/android/gallery3d/ui/AnimationTime.java
+++ b/src/com/android/gallery3d/ui/AnimationTime.java
@@ -18,11 +18,17 @@ package com.android.gallery3d.ui;
import android.os.SystemClock;
+//
+// The animation time should ideally be the vsync time the frame will be
+// displayed, but that is an unknown time in the future. So we use the system
+// time just after eglSwapBuffers (when GLSurfaceView.onDrawFrame is called)
+// as a approximation.
+//
public class AnimationTime {
private static volatile long sTime;
// Sets current time as the animation time.
- public static void setNow() {
+ public static void update() {
sTime = SystemClock.uptimeMillis();
}
diff --git a/src/com/android/gallery3d/ui/FadeInTexture.java b/src/com/android/gallery3d/ui/FadeInTexture.java
index 1c44b5aed..f351e34f3 100644
--- a/src/com/android/gallery3d/ui/FadeInTexture.java
+++ b/src/com/android/gallery3d/ui/FadeInTexture.java
@@ -85,6 +85,6 @@ public class FadeInTexture implements Texture {
}
private long now() {
- return SystemClock.uptimeMillis();
+ return AnimationTime.get();
}
}
diff --git a/src/com/android/gallery3d/ui/GLRootView.java b/src/com/android/gallery3d/ui/GLRootView.java
index 6429d5a0a..62fc4f372 100644
--- a/src/com/android/gallery3d/ui/GLRootView.java
+++ b/src/com/android/gallery3d/ui/GLRootView.java
@@ -104,7 +104,7 @@ public class GLRootView extends GLSurfaceView
setEGLConfigChooser(mEglConfigChooser);
setRenderer(this);
getHolder().setFormat(PixelFormat.RGB_565);
- AnimationTime.setNow();
+ AnimationTime.update();
// Uncomment this to enable gl error check.
//setDebugFlags(DEBUG_CHECK_GL_ERROR);
@@ -256,6 +256,7 @@ public class GLRootView extends GLSurfaceView
@Override
public void onDrawFrame(GL10 gl) {
+ AnimationTime.update();
long t0;
if (DEBUG_PROFILE_SLOW_ONLY) {
Profile.hold();
@@ -305,7 +306,7 @@ public class GLRootView extends GLSurfaceView
gl.glScissor(clip.left, clip.top, clip.width(), clip.height());
}
- AnimationTime.setNow();
+
if (mContentView != null) {
mContentView.render(mCanvas);
}
diff --git a/src/com/android/gallery3d/ui/Paper.java b/src/com/android/gallery3d/ui/Paper.java
index 830698c4a..841908fbf 100644
--- a/src/com/android/gallery3d/ui/Paper.java
+++ b/src/com/android/gallery3d/ui/Paper.java
@@ -184,6 +184,6 @@ class EdgeAnimation {
}
private long now() {
- return SystemClock.uptimeMillis();
+ return AnimationTime.get();
}
}
diff --git a/src/com/android/gallery3d/ui/PositionController.java b/src/com/android/gallery3d/ui/PositionController.java
index 4baa2e0ed..b9efb743e 100644
--- a/src/com/android/gallery3d/ui/PositionController.java
+++ b/src/com/android/gallery3d/ui/PositionController.java
@@ -423,7 +423,7 @@ class PositionController {
mToY = mImageH / 2;
}
- mAnimationStartTime = SystemClock.uptimeMillis();
+ mAnimationStartTime = AnimationTime.get();
if (mAnimationKind != ANIM_KIND_FLING) {
mAnimationDuration = ANIM_TIME[mAnimationKind];
}
@@ -438,7 +438,7 @@ class PositionController {
return;
}
- long now = SystemClock.uptimeMillis();
+ long now = AnimationTime.get();
float progress;
if (mAnimationDuration == 0) {
progress = 1;