diff options
author | John Reck <jreck@google.com> | 2012-10-15 16:40:45 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-10-15 16:40:45 -0700 |
commit | 5431fa9123df65fc476a3666134c431a79349d7d (patch) | |
tree | b64bba7ef4fbc164198a517a5c8d3c2e74662413 /src/com | |
parent | 20d1fd5174e05f31032956bea6b5e3fe559b5747 (diff) | |
parent | 6d3d603b15ec260b70223460fd92db31394e112e (diff) | |
download | android_packages_apps_Snap-5431fa9123df65fc476a3666134c431a79349d7d.tar.gz android_packages_apps_Snap-5431fa9123df65fc476a3666134c431a79349d7d.tar.bz2 android_packages_apps_Snap-5431fa9123df65fc476a3666134c431a79349d7d.zip |
am b1a28418: Fix SRI Pano orientation
* commit 'b1a28418848ce0adeb8a845a78e246b01913d176':
Fix SRI Pano orientation
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/gallery3d/ui/GLRoot.java | 3 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/PhotoView.java | 17 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/com/android/gallery3d/ui/GLRoot.java b/src/com/android/gallery3d/ui/GLRoot.java index 1651b4361..13b610b23 100644 --- a/src/com/android/gallery3d/ui/GLRoot.java +++ b/src/com/android/gallery3d/ui/GLRoot.java @@ -16,6 +16,7 @@ package com.android.gallery3d.ui; +import android.content.Context; import android.graphics.Matrix; import com.android.gallery3d.anim.CanvasAnimation; @@ -45,4 +46,6 @@ public interface GLRoot { public void freeze(); public void unfreeze(); public void setLightsOutMode(boolean enabled); + + public Context getContext(); } diff --git a/src/com/android/gallery3d/ui/PhotoView.java b/src/com/android/gallery3d/ui/PhotoView.java index 5978159e4..c6bf535db 100644 --- a/src/com/android/gallery3d/ui/PhotoView.java +++ b/src/com/android/gallery3d/ui/PhotoView.java @@ -17,6 +17,7 @@ package com.android.gallery3d.ui; import android.content.Context; +import android.content.res.Configuration; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Rect; @@ -546,10 +547,20 @@ public class PhotoView extends GLView { } private int getPanoramaRotation() { - // Panorama only support rotations of 0 and 90, so if it is greater - // than that flip the output surface texture to compensate - if (mDisplayRotation > 180) + // This function is magic + // The issue here is that Pano makes bad assumptions about rotation and + // orientation. The first is it assumes only two rotations are possible, + // 0 and 90. Thus, if display rotation is >= 180, we invert the output. + // The second is that it assumes landscape is a 90 rotation from portrait, + // however on landscape devices this is not true. Thus, if we are in portrait + // on a landscape device, we need to invert the output + int orientation = getGLRoot().getContext().getResources().getConfiguration().orientation; + boolean invertPortrait = (orientation == Configuration.ORIENTATION_PORTRAIT + && (mDisplayRotation == 90 || mDisplayRotation == 270)); + boolean invert = (mDisplayRotation >= 180); + if (invert != invertPortrait) { return (mCompensation + 180) % 360; + } return mCompensation; } |