diff options
author | Alok Kediya <kediya@codeaurora.org> | 2013-10-02 16:59:14 +0530 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2013-10-31 19:39:06 -0600 |
commit | 4902254a1e97c6ed2e4d9721ff11f4f2225acb46 (patch) | |
tree | c0022d75c65602d1bd88c10b9bd07a826616be5f /src/com/android/camera/WideAnglePanoramaModule.java | |
parent | 458ed8fdbcc100570aef15d887a14be00d9deb36 (diff) | |
download | android_packages_apps_Snap-4902254a1e97c6ed2e4d9721ff11f4f2225acb46.tar.gz android_packages_apps_Snap-4902254a1e97c6ed2e4d9721ff11f4f2225acb46.tar.bz2 android_packages_apps_Snap-4902254a1e97c6ed2e4d9721ff11f4f2225acb46.zip |
Camera: fix panorama rotation issues.
preview and snapshot are rotated unexpectedly.
Need to change rotation angles in panorama based on
sensor mount angle.
(cherrypicked from commit e80845863aa453eb85cbf7f01af32b9c0c0b874a)
Change-Id: I09d3111c3513141bffc649349a55d36a79818124
(cherry picked from commit 85ce7ba402fe354784505a8d6939700706e4401b)
(cherry picked from commit be1768dfed2acedb34a3f393304999df3d4cabfb)
(cherry picked from commit 790aeae0ed544e10ede5ccd7636eb4cf08a1d979)
Diffstat (limited to 'src/com/android/camera/WideAnglePanoramaModule.java')
-rw-r--r-- | src/com/android/camera/WideAnglePanoramaModule.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java index 5d8065e14..0fa28c263 100644 --- a/src/com/android/camera/WideAnglePanoramaModule.java +++ b/src/com/android/camera/WideAnglePanoramaModule.java @@ -637,12 +637,17 @@ 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 - mCameraOrientation + 360) % 360; + orientation = (mDeviceOrientationAtCapture - cameraOrientation + 360) % 360; } else { - orientation = (mDeviceOrientationAtCapture + mCameraOrientation) % 360; + orientation = (mDeviceOrientationAtCapture + cameraOrientation) % 360; } return orientation; } @@ -971,8 +976,12 @@ 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); + if (mCameraTexture != null) mCameraTexture.setOnFrameAvailableListener(this); mCameraDevice.setPreviewTexture(mCameraTexture); } |