summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChih-Chung Chang <chihchung@google.com>2012-04-16 16:29:13 +0800
committerChih-Chung Chang <chihchung@google.com>2012-04-16 16:29:13 +0800
commit0fd46993facd2d2ac80eab64e4f0f8c8e79350dc (patch)
tree7ea6e386a4eefb9fd0f37381bd64d12c452ecfba /src
parenta754c6b508bb3c32312c4983d5371b8173f106fd (diff)
downloadandroid_packages_apps_Snap-0fd46993facd2d2ac80eab64e4f0f8c8e79350dc.tar.gz
android_packages_apps_Snap-0fd46993facd2d2ac80eab64e4f0f8c8e79350dc.tar.bz2
android_packages_apps_Snap-0fd46993facd2d2ac80eab64e4f0f8c8e79350dc.zip
Define max height/width for each picture in filmstrip mode.
Change-Id: I844a32f95237724a60a64afe5f746798886dcc2c
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/ui/PositionController.java26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/com/android/gallery3d/ui/PositionController.java b/src/com/android/gallery3d/ui/PositionController.java
index 0afcad71a..3774cce1c 100644
--- a/src/com/android/gallery3d/ui/PositionController.java
+++ b/src/com/android/gallery3d/ui/PositionController.java
@@ -72,10 +72,12 @@ class PositionController {
// Film Mode v.s. Page Mode: in film mode we show smaller pictures.
private boolean mFilmMode = false;
- private static final float FILM_MODE_SCALE_FACTOR = 0.7f;
- // The scaling factor in current mode.
- private float mScaleFactor = mFilmMode ? FILM_MODE_SCALE_FACTOR : 1.0f;
+ // These are the limits for width / height of the picture in film mode.
+ private static final float FILM_MODE_PORTRAIT_HEIGHT = 0.48f;
+ private static final float FILM_MODE_PORTRAIT_WIDTH = 0.7f;
+ private static final float FILM_MODE_LANDSCAPE_HEIGHT = 0.7f;
+ private static final float FILM_MODE_LANDSCAPE_WIDTH = 0.7f;
// In addition to the focused box (index == 0). We also keep information
// about this many boxes on each side.
@@ -236,7 +238,6 @@ class PositionController {
public void setFilmMode(boolean enabled) {
if (enabled == mFilmMode) return;
mFilmMode = enabled;
- mScaleFactor = enabled ? FILM_MODE_SCALE_FACTOR : 1.0f;
updateScaleAndGapLimit();
stopAnimation();
@@ -866,8 +867,21 @@ class PositionController {
////////////////////////////////////////////////////////////////////////////
public float getMinimalScale(int imageW, int imageH) {
- float s = Math.min(mScaleFactor * mViewW / imageW,
- mScaleFactor * mViewH / imageH);
+ float wFactor = 1.0f;
+ float hFactor = 1.0f;
+
+ if (mFilmMode) {
+ if (mViewH > mViewW) { // portrait
+ wFactor = FILM_MODE_PORTRAIT_WIDTH;
+ hFactor = FILM_MODE_PORTRAIT_HEIGHT;
+ } else { // landscape
+ wFactor = FILM_MODE_LANDSCAPE_WIDTH;
+ hFactor = FILM_MODE_LANDSCAPE_HEIGHT;
+ }
+ }
+
+ float s = Math.min(wFactor * mViewW / imageW,
+ hFactor * mViewH / imageH);
return Math.min(SCALE_LIMIT, s);
}