summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/PhotoModule.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/PhotoModule.java')
-rw-r--r--src/com/android/camera/PhotoModule.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index feaefd4ea..0db14c43e 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -1283,13 +1283,18 @@ public class PhotoModule
}
}
- private byte[] flipJpeg(byte[] jpegData, int orientation) {
+ private byte[] flipJpeg(byte[] jpegData, int orientation, int jpegOrientation) {
Bitmap srcBitmap = BitmapFactory.decodeByteArray(jpegData, 0, jpegData.length);
Matrix m = new Matrix();
if(orientation == 270) {
m.preScale(-1, 1);
} else { //if it's 90
- m.preScale(1, -1);
+ // Judge whether the picture or phone is horizontal screen
+ if (jpegOrientation == 0 || jpegOrientation == 180) {
+ m.preScale(-1, 1);
+ } else { // the picture or phone is Vertical screen
+ m.preScale(1, -1);
+ }
}
Bitmap dstBitmap = Bitmap.createBitmap(srcBitmap, 0, 0, srcBitmap.getWidth(), srcBitmap.getHeight(), m, false);
dstBitmap.setDensity(DisplayMetrics.DENSITY_DEFAULT);
@@ -1419,7 +1424,7 @@ public class PhotoModule
if (selfieMirrorPref != null && selfieMirrorPref.getValue() != null &&
selfieMirrorPref.getValue().equalsIgnoreCase("enable")) {
CameraInfo info = CameraHolder.instance().getCameraInfo()[mCameraId];
- jpegData = flipJpeg(jpegData, info.orientation);
+ jpegData = flipJpeg(jpegData, info.orientation, orientation);
jpegData = addExifTags(jpegData, orientation);
}
}