summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/Util.java
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2010-10-19 11:18:23 -0700
committerJean-Baptiste Queru <jbq@google.com>2010-10-19 11:18:23 -0700
commit9a2b75b19b46ad5a66edf9a1c97f8da281c3dfdc (patch)
treec420795b10c4909a86a4212db0477c8cc5b8b2b0 /src/com/android/camera/Util.java
parentc4a762222cf20beee749a448be2bdf4765d06e54 (diff)
parent559a415158aa0b2efde072d29cfec1b82634fd2e (diff)
downloadpackages_apps_LegacyCamera-9a2b75b19b46ad5a66edf9a1c97f8da281c3dfdc.zip
packages_apps_LegacyCamera-9a2b75b19b46ad5a66edf9a1c97f8da281c3dfdc.tar.gz
packages_apps_LegacyCamera-9a2b75b19b46ad5a66edf9a1c97f8da281c3dfdc.tar.bz2
Merge 559a4151 from gingerbread-plus-aosp
Change-Id: I8ec4aa5210cb5104bedb7d5ed6f823f44517b203
Diffstat (limited to 'src/com/android/camera/Util.java')
-rw-r--r--src/com/android/camera/Util.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java
index 2bff219..71d0c21 100644
--- a/src/com/android/camera/Util.java
+++ b/src/com/android/camera/Util.java
@@ -24,6 +24,7 @@ import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
+import android.hardware.Camera;
import android.hardware.Camera.Size;
import android.util.Log;
import android.view.Display;
@@ -295,12 +296,19 @@ public class Util {
}
public static void setCameraDisplayOrientation(Activity activity,
- int cameraId, android.hardware.Camera camera) {
- android.hardware.Camera.CameraInfo info =
- new android.hardware.Camera.CameraInfo();
- android.hardware.Camera.getCameraInfo(cameraId, info);
+ int cameraId, Camera camera) {
+ // See android.hardware.Camera.setCameraDisplayOrientation for
+ // documentation.
+ Camera.CameraInfo info = new Camera.CameraInfo();
+ Camera.getCameraInfo(cameraId, info);
int degrees = getDisplayRotation(activity);
- int result = (info.orientation - degrees + 360) % 360;
+ int result;
+ if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
+ result = (info.orientation + degrees) % 360;
+ result = (360 - result) % 360; // compensate the mirror
+ } else { // back-facing
+ result = (info.orientation - degrees + 360) % 360;
+ }
camera.setDisplayOrientation(result);
}