OSDN Git Service

Fix the orientation issue for front camera.
authorSenpo Hu <senpo@google.com>
Tue, 2 Dec 2014 22:52:23 +0000 (14:52 -0800)
committerSenpo Hu <senpo@google.com>
Thu, 4 Dec 2014 18:54:37 +0000 (10:54 -0800)
This bug is introduced by the refactoring done in ag/589395.

Bug: 18520267
Change-Id: If0df6a7d6fe3ca630839ef92dccaa78f0136bb7d

src/com/android/camera/util/CameraUtil.java

index c587ff4..c265f00 100644 (file)
@@ -1361,11 +1361,10 @@ public class CameraUtil {
     public static int getImageRotation(int sensorOrientation,
                                        int deviceOrientation,
                                        boolean isFrontCamera) {
-        int rotation = (sensorOrientation + deviceOrientation) % 360;
         // The sensor of front camera faces in the opposite direction from back camera.
         if (isFrontCamera) {
-            return (360 - rotation) % 360;
+            deviceOrientation = (360 - deviceOrientation) % 360;
         }
-        return rotation;
+        return (sensorOrientation + deviceOrientation) % 360;
     }
 }