summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2017-01-30 16:22:40 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2017-01-30 16:22:40 -0800
commitae583b87e043ee72e227b96e2be712974279aba6 (patch)
treefcedf4f6fa9d33f40e480647adb4dbba68af3dc6 /src
parent507e33ea0bdd483bc520aba7ce8e70f5cc09bd8d (diff)
parent61fcbe0db3b88036592673bd5bc83aef68058696 (diff)
downloadandroid_packages_apps_Snap-ae583b87e043ee72e227b96e2be712974279aba6.tar.gz
android_packages_apps_Snap-ae583b87e043ee72e227b96e2be712974279aba6.tar.bz2
android_packages_apps_Snap-ae583b87e043ee72e227b96e2be712974279aba6.zip
Merge "SnapdragonCamera:Fix photo reversed when enable selfie Mirror" into camera.lnx.1.0-dev.1.0
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/BestpictureActivity.java4
-rw-r--r--[-rwxr-xr-x]src/com/android/camera/CaptureModule.java3
-rw-r--r--[-rwxr-xr-x]src/com/android/camera/CaptureUI.java2
-rw-r--r--src/com/android/camera/PhotoModule.java11
4 files changed, 13 insertions, 7 deletions
diff --git a/src/com/android/camera/BestpictureActivity.java b/src/com/android/camera/BestpictureActivity.java
index cf285c2eb..6eaa2a3d0 100644
--- a/src/com/android/camera/BestpictureActivity.java
+++ b/src/com/android/camera/BestpictureActivity.java
@@ -257,7 +257,7 @@ public class BestpictureActivity extends FragmentActivity {
private void initOverFlow(View v) {
View popView = getLayoutInflater().inflate(R.layout.overflow, null);
- PopupWindow pop = new PopupWindow(popView, CameraUtil.dip2px(BestpictureActivity.this, 150),
+ final PopupWindow pop = new PopupWindow(popView, CameraUtil.dip2px(BestpictureActivity.this, 150),
CameraUtil.dip2px(BestpictureActivity.this, 100), true);
pop.setOutsideTouchable(true);
pop.showAtLocation(v, Gravity.RIGHT | Gravity.TOP,
@@ -398,7 +398,7 @@ public class BestpictureActivity extends FragmentActivity {
});
}
- private void initSaveDialog(int mode, int choosenCount) {
+ private void initSaveDialog(int mode, final int choosenCount) {
BestPictureActionDialogLayout layout = getDialogLayout(mode);
layout.setDialogDataControler(mDialogRoot, new BestPictureActionDialogLayout
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index ab0854eea..9bf0f6ebe 100755..100644
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -1232,7 +1232,8 @@ public class CaptureModule implements CameraModule, PhotoController,
mJpegImageData = data;
}
- public void showCapturedReview(final byte[] jpegData, int orientation, boolean mirror) {
+ public void showCapturedReview(final byte[] jpegData, final int orientation,
+ final boolean mirror) {
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
diff --git a/src/com/android/camera/CaptureUI.java b/src/com/android/camera/CaptureUI.java
index 2ef89abdf..43e53c56a 100755..100644
--- a/src/com/android/camera/CaptureUI.java
+++ b/src/com/android/camera/CaptureUI.java
@@ -391,7 +391,7 @@ public class CaptureUI implements FocusOverlayManager.FocusUI,
mFaceView = (Camera2FaceView) mRootView.findViewById(R.id.face_view);
mCancelButton = (ImageView) mRootView.findViewById(R.id.cancel_button);
- int intentMode = mModule.getCurrentIntentMode();
+ final int intentMode = mModule.getCurrentIntentMode();
if (intentMode != CaptureModule.INTENT_MODE_NORMAL) {
mCameraControls.setIntentMode(intentMode);
mCameraControls.setVideoMode(false);
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);
}
}