summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/camera/PhotoModule.java5
-rw-r--r--src/com/android/camera/PhotoUI.java4
-rw-r--r--src/com/android/camera/VideoModule.java11
-rwxr-xr-xsrc/com/android/camera/VideoUI.java3
-rw-r--r--src/com/android/camera/WideAnglePanoramaModule.java7
5 files changed, 24 insertions, 6 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 665e3db40..24bf3dd73 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -312,6 +312,7 @@ public class PhotoModule
private boolean mMirror;
private boolean mFirstTimeInitialized;
private boolean mIsImageCaptureIntent;
+ private int mOrientationOffset;
private int mCameraState = INIT;
private boolean mSnapshotOnIdle = false;
@@ -583,6 +584,7 @@ public class PhotoModule
public void init(CameraActivity activity, View parent) {
mActivity = activity;
mRootView = parent;
+ mOrientationOffset = CameraUtil.isDefaultToPortrait(mActivity) ? 0 : 90;
mPreferences = ComboPreferences.get(mActivity);
if (mPreferences == null) {
mPreferences = new ComboPreferences(mActivity);
@@ -1856,7 +1858,7 @@ public class PhotoModule
}
// Set rotation and gps data.
- int orientation = mOrientation;
+ int orientation = (mOrientation + mOrientationOffset) % 360;
mJpegRotation = CameraUtil.getJpegRotation(mCameraId, orientation);
String pictureFormat = mParameters.get(KEY_PICTURE_FORMAT);
Location loc = getLocationAccordPictureFormat(pictureFormat);
@@ -2358,6 +2360,7 @@ public class PhotoModule
// the camera then point the camera to floor or sky, we still have
// the correct orientation.
if (orientation == OrientationEventListener.ORIENTATION_UNKNOWN) return;
+ orientation = (orientation - mOrientationOffset + 360) % 360;
int oldOrientation = mOrientation;
mOrientation = CameraUtil.roundOrientation(orientation, mOrientation);
if (oldOrientation != mOrientation) {
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index 9dd1ed2b1..c1ccd9b41 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -372,6 +372,9 @@ public class PhotoUI implements PieListener,
FrameLayout.LayoutParams lp;
float scaledTextureWidth, scaledTextureHeight;
int rotation = CameraUtil.getDisplayRotation(mActivity);
+ if(!CameraUtil.isDefaultToPortrait(mActivity)) {
+ rotation = (rotation - 90) % 360;
+ }
mScreenRatio = CameraUtil.determineRatio(ratio);
if (mScreenRatio == CameraUtil.RATIO_16_9
&& CameraUtil.determinCloseRatio(ratio) == CameraUtil.RATIO_4_3) {
@@ -1471,6 +1474,7 @@ public class PhotoUI implements PieListener,
RotateImageView v = (RotateImageView) mReviewImage;
v.setOrientation(orientation, animation);
}
+ mOrientation = orientation;
}
public void tryToCloseSubList() {
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index e786cc261..529ca0a4f 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -179,6 +179,7 @@ public class VideoModule implements CameraModule,
// true.
private int mDisplayRotation;
private int mCameraDisplayOrientation;
+ private int mOrientationOffset;
private int mDesiredPreviewWidth;
private int mDesiredPreviewHeight;
@@ -491,6 +492,8 @@ public class VideoModule implements CameraModule,
public void init(CameraActivity activity, View root) {
mActivity = activity;
mUI = new VideoUI(activity, this, root);
+ mOrientationOffset = CameraUtil.isDefaultToPortrait(mActivity) ? 0 : 90;
+
mPreferences = ComboPreferences.get(mActivity);
if (mPreferences == null) {
mPreferences = new ComboPreferences(mActivity);
@@ -599,7 +602,8 @@ public class VideoModule implements CameraModule,
}
// Set rotation and gps data.
- int rotation = CameraUtil.getJpegRotation(mCameraId, mOrientation);
+ int orientation = (mOrientation + mOrientationOffset) % 360;
+ int rotation = CameraUtil.getJpegRotation(mCameraId, orientation);
mParameters.setRotation(rotation);
Location loc = mLocationManager.getCurrentLocation();
CameraUtil.setGpsParameters(mParameters, loc);
@@ -680,6 +684,7 @@ public class VideoModule implements CameraModule,
// the camera then point the camera to floor or sky, we still have
// the correct orientation.
if (orientation == OrientationEventListener.ORIENTATION_UNKNOWN) return;
+ orientation = (orientation - mOrientationOffset + 360) % 360;
int newOrientation = CameraUtil.roundOrientation(orientation, mOrientation);
if (mOrientation != newOrientation) {
@@ -1709,9 +1714,9 @@ public class VideoModule implements CameraModule,
if (mOrientation != OrientationEventListener.ORIENTATION_UNKNOWN) {
CameraInfo info = CameraHolder.instance().getCameraInfo()[mCameraId];
if (info.facing == CameraInfo.CAMERA_FACING_FRONT) {
- rotation = (info.orientation - mOrientation + 360) % 360;
+ rotation = (info.orientation - mOrientation - mOrientationOffset + 360) % 360;
} else { // back-facing camera
- rotation = (info.orientation + mOrientation) % 360;
+ rotation = (info.orientation + mOrientation + mOrientationOffset) % 360;
}
}
mMediaRecorder.setOrientationHint(rotation);
diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java
index 6d326bb2f..fa7ba6543 100755
--- a/src/com/android/camera/VideoUI.java
+++ b/src/com/android/camera/VideoUI.java
@@ -400,6 +400,9 @@ public class VideoUI implements PieRenderer.PieListener,
float scaledTextureWidth, scaledTextureHeight;
int rotation = CameraUtil.getDisplayRotation(mActivity);
+ if(!CameraUtil.isDefaultToPortrait(mActivity)) {
+ rotation = (rotation - 90) % 360;
+ }
mScreenRatio = CameraUtil.determineRatio(ratio);
if (mScreenRatio == CameraUtil.RATIO_16_9
&& CameraUtil.determinCloseRatio(ratio) == CameraUtil.RATIO_4_3) {
diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java
index 4e0da9fbe..ebf640f73 100644
--- a/src/com/android/camera/WideAnglePanoramaModule.java
+++ b/src/com/android/camera/WideAnglePanoramaModule.java
@@ -133,6 +133,7 @@ public class WideAnglePanoramaModule
// respectively.
private int mDeviceOrientation;
private int mDeviceOrientationAtCapture;
+ private int mOrientationOffset;
private int mCameraOrientation;
private int mOrientationCompensation;
private boolean mOrientationLocked;
@@ -197,6 +198,7 @@ public class WideAnglePanoramaModule
// the camera then point the camera to floor or sky, we still have
// the correct orientation.
if (orientation == ORIENTATION_UNKNOWN) return;
+ orientation = (orientation - mOrientationOffset + 360) % 360;
int oldOrientation = mDeviceOrientation;
mDeviceOrientation = CameraUtil.roundOrientation(orientation, mDeviceOrientation);
// When the screen is unlocked, display rotation may change. Always
@@ -230,6 +232,7 @@ public class WideAnglePanoramaModule
public void init(CameraActivity activity, View parent) {
mActivity = activity;
mRootView = parent;
+ mOrientationOffset = CameraUtil.isDefaultToPortrait(mActivity) ? 0 : 90;
mOrientationManager = new OrientationManager(activity);
mCaptureState = CAPTURE_STATE_VIEWFINDER;
@@ -728,9 +731,9 @@ public class WideAnglePanoramaModule
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 - mCameraOrientation - mOrientationOffset + 360) % 360;
} else {
- orientation = (mDeviceOrientationAtCapture + mCameraOrientation) % 360;
+ orientation = (mDeviceOrientationAtCapture + mCameraOrientation + mOrientationOffset) % 360;
}
return orientation;
}