Loading src/com/android/gallery3d/ui/TiledScreenNail.java +4 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,10 @@ public class TiledScreenNail implements ScreenNail { } public boolean isAnimating() { // The TiledTexture may not be uploaded completely yet. // In that case, we count it as animating state and we will draw // the placeholder in TileImageView. if (mTexture == null || !mTexture.isReady()) return true; if (mAnimationStartTime < 0) return false; if (AnimationTime.get() - mAnimationStartTime >= DURATION) { mAnimationStartTime = ANIMATION_DONE; Loading src/com/android/gallery3d/ui/TiledTexture.java +9 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.graphics.Paint; import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuffXfermode; import android.graphics.RectF; import android.os.SystemClock; import com.android.gallery3d.ui.GLRoot.OnGLIdleListener; Loading @@ -40,6 +41,10 @@ public class TiledTexture implements Texture { private static final int TILE_SIZE = CONTENT_SIZE + 2 * BORDER_SIZE; private static final int INIT_CAPACITY = 8; // We are targeting at 60fps, so we have 16ms for each frame. // In this 16ms, we use about 4~8 ms to upload tiles. private static final long UPLOAD_TILE_LIMIT = 4; // ms private static Tile sFreeTileHead = null; private static final Object sFreeTileLock = new Object(); Loading Loading @@ -79,17 +84,19 @@ public class TiledTexture implements Texture { mGlRoot.addOnGLIdleListener(this); } @Override public boolean onGLIdle(GLCanvas canvas, boolean renderRequested) { ArrayDeque<TiledTexture> deque = mTextures; synchronized (this) { if (!deque.isEmpty()) { long now = SystemClock.uptimeMillis(); long dueTime = now + UPLOAD_TILE_LIMIT; while(now < dueTime && !deque.isEmpty()) { TiledTexture t = deque.peekFirst(); if (t.uploadNextTile(canvas)) { deque.removeFirst(); mGlRoot.requestRender(); } now = SystemClock.uptimeMillis(); } mIsQueued = !mTextures.isEmpty(); Loading Loading
src/com/android/gallery3d/ui/TiledScreenNail.java +4 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,10 @@ public class TiledScreenNail implements ScreenNail { } public boolean isAnimating() { // The TiledTexture may not be uploaded completely yet. // In that case, we count it as animating state and we will draw // the placeholder in TileImageView. if (mTexture == null || !mTexture.isReady()) return true; if (mAnimationStartTime < 0) return false; if (AnimationTime.get() - mAnimationStartTime >= DURATION) { mAnimationStartTime = ANIMATION_DONE; Loading
src/com/android/gallery3d/ui/TiledTexture.java +9 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.graphics.Paint; import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuffXfermode; import android.graphics.RectF; import android.os.SystemClock; import com.android.gallery3d.ui.GLRoot.OnGLIdleListener; Loading @@ -40,6 +41,10 @@ public class TiledTexture implements Texture { private static final int TILE_SIZE = CONTENT_SIZE + 2 * BORDER_SIZE; private static final int INIT_CAPACITY = 8; // We are targeting at 60fps, so we have 16ms for each frame. // In this 16ms, we use about 4~8 ms to upload tiles. private static final long UPLOAD_TILE_LIMIT = 4; // ms private static Tile sFreeTileHead = null; private static final Object sFreeTileLock = new Object(); Loading Loading @@ -79,17 +84,19 @@ public class TiledTexture implements Texture { mGlRoot.addOnGLIdleListener(this); } @Override public boolean onGLIdle(GLCanvas canvas, boolean renderRequested) { ArrayDeque<TiledTexture> deque = mTextures; synchronized (this) { if (!deque.isEmpty()) { long now = SystemClock.uptimeMillis(); long dueTime = now + UPLOAD_TILE_LIMIT; while(now < dueTime && !deque.isEmpty()) { TiledTexture t = deque.peekFirst(); if (t.uploadNextTile(canvas)) { deque.removeFirst(); mGlRoot.requestRender(); } now = SystemClock.uptimeMillis(); } mIsQueued = !mTextures.isEmpty(); Loading