summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/WideAnglePanoramaModule.java
diff options
context:
space:
mode:
authorAlok Kediya <kediya@codeaurora.org>2013-10-02 17:35:59 +0530
committerLinux Build Service Account <lnxbuild@localhost>2013-10-31 19:39:09 -0600
commit1dd268e423678952508b042612407c88b9adf991 (patch)
tree9b5a60226b6b67b3a1f7d1b2a632cd079ce4b5f4 /src/com/android/camera/WideAnglePanoramaModule.java
parent4902254a1e97c6ed2e4d9721ff11f4f2225acb46 (diff)
downloadandroid_packages_apps_Snap-1dd268e423678952508b042612407c88b9adf991.tar.gz
android_packages_apps_Snap-1dd268e423678952508b042612407c88b9adf991.tar.bz2
android_packages_apps_Snap-1dd268e423678952508b042612407c88b9adf991.zip
Camera: Fix panorama preview/snapshot rotation issue
Remove earlier hardcode and use unified solution to solve Panorama preview and snapshot rotation issue by using sensor mount angle and angle compensation in panorama postprocessing. (cherrypicked from commit a585a576a3259477a460e367fe4af69a448a2d25 ) Change-Id: Ie7130a0670174d5957b871b76b05a0bfdd9d4d27 (cherry picked from commit 21a26f3ffe023ee550a51a547e46c75c3dd914a6) (cherry picked from commit 50aebc4f3fbdf6f07a4b87cc87eef7e30257a05b) (cherry picked from commit e5fb76066ab7b5d1f82beb16a3fb8c4e5c031671)
Diffstat (limited to 'src/com/android/camera/WideAnglePanoramaModule.java')
-rw-r--r--src/com/android/camera/WideAnglePanoramaModule.java19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java
index 0fa28c263..ad0b8a262 100644
--- a/src/com/android/camera/WideAnglePanoramaModule.java
+++ b/src/com/android/camera/WideAnglePanoramaModule.java
@@ -129,6 +129,7 @@ public class WideAnglePanoramaModule
private int mDeviceOrientation;
private int mDeviceOrientationAtCapture;
private int mCameraOrientation;
+ private int mPanoAngle;
private int mOrientationCompensation;
private SoundClips.Player mSoundPlayer;
@@ -637,17 +638,12 @@ public class WideAnglePanoramaModule
// device orientation at capture and the camera orientation respective to
// the natural orientation of the device.
int orientation;
- int cameraOrientation = mCameraOrientation;
- if(mDeviceOrientationAtCapture == 270 || mDeviceOrientationAtCapture == 90) {
- if(mCameraOrientation == 0)
- cameraOrientation = 180;
- }
if (mUsingFrontCamera) {
// mCameraOrientation is negative with respect to the front facing camera.
// See document of android.hardware.Camera.Parameters.setRotation.
- orientation = (mDeviceOrientationAtCapture - cameraOrientation + 360) % 360;
+ orientation = (mDeviceOrientationAtCapture - mCameraOrientation - mPanoAngle + 360) % 360;
} else {
- orientation = (mDeviceOrientationAtCapture + cameraOrientation) % 360;
+ orientation = (mDeviceOrientationAtCapture + mCameraOrientation - mPanoAngle) % 360;
}
return orientation;
}
@@ -976,10 +972,11 @@ public class WideAnglePanoramaModule
// Set the display orientation to 0, so that the underlying mosaic
// library can always get undistorted mCameraPreviewWidth x mCameraPreviewHeight
// image data from SurfaceTexture.
- if (mCameraOrientation == 0)
- mCameraDevice.setDisplayOrientation(270);
- else
- mCameraDevice.setDisplayOrientation(0);
+ // as Panoroma will add 90 degree rotation compensation during
+ // postprocessing, we need to consider both camera mount angle and
+ // this compensation angle
+ mPanoAngle = (mCameraOrientation - 90 + 360) % 360;
+ mCameraDevice.setDisplayOrientation(mPanoAngle);
if (mCameraTexture != null)
mCameraTexture.setOnFrameAvailableListener(this);