diff options
-rw-r--r-- | src/com/android/camera/PhotoModule.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java index 5aa7a57ae..d808fa6bb 100644 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java @@ -1262,13 +1262,18 @@ public class PhotoModule extends BaseModule<PhotoUI> implements } } - 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); @@ -1431,7 +1436,7 @@ public class PhotoModule extends BaseModule<PhotoUI> implements .findPreference(CameraSettings.KEY_SELFIE_MIRROR); if (selfieMirrorPref != null && selfieMirrorPref.getValue() != null && selfieMirrorPref.getValue().equalsIgnoreCase("enable")) { - jpegData = flipJpeg(jpegData, info.orientation); + jpegData = flipJpeg(jpegData, info.orientation, orientation); jpegData = addExifTags(jpegData, orientation); } } |