diff options
author | jinwu <jinwu@codeaurora.org> | 2017-08-21 12:04:50 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-09-07 22:27:09 -0700 |
commit | e58773aa2ea15fd5a489cd545447439186bc6402 (patch) | |
tree | ce208f60f60d521553e08f6deee77fdd8ea11010 /src/com/android/gallery3d/ui | |
parent | 5487ffbcc8ae341d027141673100659d8313f9e4 (diff) | |
download | android_packages_apps_Gallery2-e58773aa2ea15fd5a489cd545447439186bc6402.tar.gz android_packages_apps_Gallery2-e58773aa2ea15fd5a489cd545447439186bc6402.tar.bz2 android_packages_apps_Gallery2-e58773aa2ea15fd5a489cd545447439186bc6402.zip |
Speeding up decoding image
1. Enlarge the image cache of Thumbnail when scale is too small.
2. Make image about 1.5 bigger than original after double tap.
Change-Id: I59288a6517dc3a3ce7394a473142d25c5fe02013
CRs-Fixed: 2094870
Diffstat (limited to 'src/com/android/gallery3d/ui')
-rwxr-xr-x | src/com/android/gallery3d/ui/PhotoView.java | 13 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/TileImageView.java | 7 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/TiledScreenNail.java | 2 |
3 files changed, 14 insertions, 8 deletions
diff --git a/src/com/android/gallery3d/ui/PhotoView.java b/src/com/android/gallery3d/ui/PhotoView.java index 68ce55f91..c6d729159 100755 --- a/src/com/android/gallery3d/ui/PhotoView.java +++ b/src/com/android/gallery3d/ui/PhotoView.java @@ -18,7 +18,6 @@ package com.android.gallery3d.ui; import android.content.Context; import android.content.res.Configuration; -//import android.drm.DrmHelper; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Rect; @@ -1054,8 +1053,16 @@ public class PhotoView extends GLView { // onDoubleTap happened on the second ACTION_DOWN. // We need to ignore the next UP event. mIgnoreUpEvent = true; - if (scale <= .75f || controller.isAtMinimalScale()) { - controller.zoomIn(x, y, Math.max(1.0f, scale * 1.5f)); + Log.d(TAG, "onDoubleTap scale=" + scale); + if (scale <= .15f) { + //mPictures.get(0).setScreenNail(mBigSNail); + controller.zoomIn(x, y, Math.max(0.2f, scale * 1.5f)); + } else if (scale <= .45f) { + controller.zoomIn(x, y, Math.max(0.6f, scale * 1.5f)); + } else if (scale <= .75f) { + controller.zoomIn(x, y, Math.max(1f, scale * 1.5f)); + } else if (controller.isAtMinimalScale()) { + controller.zoomIn(x, y, scale * 1.5f); } else { controller.resetToFullView(); } diff --git a/src/com/android/gallery3d/ui/TileImageView.java b/src/com/android/gallery3d/ui/TileImageView.java index f07353ed2..dd4b406fd 100644 --- a/src/com/android/gallery3d/ui/TileImageView.java +++ b/src/com/android/gallery3d/ui/TileImageView.java @@ -154,9 +154,10 @@ public class TileImageView extends GLView { mTileDecoder = mThreadPool.submit(new TileDecoder()); if (sTileSize == 0) { if (isHighResolution(context.getAndroidContext())) { - sTileSize = 512 ; + // Need to tuning + sTileSize = 2048; } else { - sTileSize = 256; + sTileSize = 1024; } } } @@ -184,7 +185,6 @@ public class TileImageView extends GLView { mLevelCount = mModel.getLevelCount(); } layoutTiles(mCenterX, mCenterY, mScale, mRotation); - invalidate(); } @Override @@ -358,7 +358,6 @@ public class TileImageView extends GLView { mScale = scale; mRotation = rotation; layoutTiles(centerX, centerY, scale, rotation); - invalidate(); return true; } diff --git a/src/com/android/gallery3d/ui/TiledScreenNail.java b/src/com/android/gallery3d/ui/TiledScreenNail.java index 0ade9389c..9b24eabea 100644 --- a/src/com/android/gallery3d/ui/TiledScreenNail.java +++ b/src/com/android/gallery3d/ui/TiledScreenNail.java @@ -213,6 +213,6 @@ public class TiledScreenNail implements ScreenNail { } public static void setMaxSide(int size) { - sMaxSide = size; + sMaxSide = Math.max(size, sMaxSide); } } |