OSDN Git Service

Fix SRI orientation on manta
authorDoris Liu <tianliu@google.com>
Sat, 19 Oct 2013 00:15:30 +0000 (17:15 -0700)
committerThe Android Automerger <android-build@google.com>
Sun, 20 Oct 2013 19:33:04 +0000 (12:33 -0700)
Bug: 11292213
Change-Id: I7977de4c5bb906eec5431e706e28118837a682e7

src/com/android/camera/WideAnglePanoramaController.java
src/com/android/camera/WideAnglePanoramaModule.java
src/com/android/camera/WideAnglePanoramaUI.java

index 6ac7c51..d711c09 100644 (file)
@@ -30,4 +30,6 @@ public interface WideAnglePanoramaController {
     public void onShutterButtonClick();
 
     public void onPreviewUILayoutChange(int l, int t, int r, int b);
+
+    public int getCameraOrientation();
 }
index aa66bdc..a08aa66 100644 (file)
@@ -647,6 +647,13 @@ public class WideAnglePanoramaModule
         return orientation;
     }
 
+    /** The orientation of the camera image. The value is the angle that the camera
+     *  image needs to be rotated clockwise so it shows correctly on the display
+     *  in its natural orientation. It should be 0, 90, 180, or 270.*/
+    public int getCameraOrientation() {
+        return mCameraOrientation;
+    }
+
     public void saveHighResMosaic() {
         runBackgroundThread(new Thread() {
             @Override
index da49638..2a47d23 100644 (file)
@@ -431,8 +431,13 @@ public class WideAnglePanoramaUI implements
     }
 
     public void flipPreviewIfNeeded() {
-        if (CameraUtil.getDisplayRotation(mActivity) >= 180) {
-            // In either reverse landscape or reverse portrait
+        // Rotation needed to display image correctly clockwise
+        int cameraOrientation = mController.getCameraOrientation();
+        // Display rotated counter-clockwise
+        int displayRotation = CameraUtil.getDisplayRotation(mActivity);
+        // Rotation needed to display image correctly on current display
+        int rotation = (cameraOrientation - displayRotation + 360) % 360;
+        if (rotation >= 180) {
             mTextureView.setRotation(180);
         } else {
             mTextureView.setRotation(0);