summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui
diff options
context:
space:
mode:
authormingwax <mingwax@codeaurora.org>2017-02-23 17:43:41 +0800
committermingwax <mingwax@codeaurora.org>2017-02-23 17:48:09 +0800
commit0deb06768ab319386e43f8ae17fb832aa55c8ce8 (patch)
tree2cf98ae6d63df6c4bb876c7c47ac956351218297 /src/com/android/camera/ui
parent3196565b3091f36a00428c0509c2bfd959c84b85 (diff)
downloadandroid_packages_apps_Snap-0deb06768ab319386e43f8ae17fb832aa55c8ce8.tar.gz
android_packages_apps_Snap-0deb06768ab319386e43f8ae17fb832aa55c8ce8.tar.bz2
android_packages_apps_Snap-0deb06768ab319386e43f8ae17fb832aa55c8ce8.zip
SnapdragonCamera: Fix rotation angle when the rear in differ angle
Change the rotation angle and px py values when the rear in different angle. 8953`s rear angle is 90. 8998`s rear angle is 270. CRs-Fixed: 1103364 Change-Id: I8bf2e76d2faf2417f9439b6b575bfc364974277e
Diffstat (limited to 'src/com/android/camera/ui')
-rw-r--r--src/com/android/camera/ui/PanoCaptureProcessView.java29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/com/android/camera/ui/PanoCaptureProcessView.java b/src/com/android/camera/ui/PanoCaptureProcessView.java
index 95e9a095f..ec3c7dd15 100644
--- a/src/com/android/camera/ui/PanoCaptureProcessView.java
+++ b/src/com/android/camera/ui/PanoCaptureProcessView.java
@@ -930,16 +930,29 @@ public class PanoCaptureProcessView extends View implements SensorEventListener
Canvas canvas = new Canvas(dstBitmap);
matrix.reset();
int sensorOrientation = mController.getCameraSensorOrientation();
- if(mOrientation == 0 || mOrientation == 270) {
- matrix.postRotate((sensorOrientation + mOrientation + 360) % 360, srcBitmap.getHeight() / 2, srcBitmap.getHeight() / 2);
+ matrix.setScale(ratio, ratio);
+ // See android.hardware.Camera.Parameters.setRotation for documentation.
+ // refer to CameraUtil.java getJpegRotation method
+ float rotationAngle = (sensorOrientation + mOrientation) % 360;
+ if (mOrientation == 0) {
+ if (sensorOrientation == 90) {
+ matrix.postRotate(rotationAngle, dstBitmap.getWidth() / 2,
+ dstBitmap.getWidth() / 2);
+ } else if (sensorOrientation == 270) {
+ matrix.postRotate(rotationAngle, dstBitmap.getHeight() / 2,
+ dstBitmap.getHeight() / 2);
+ }
} else if (mOrientation == 180){
- matrix.postRotate((sensorOrientation + mOrientation + 180 + 360) % 360, srcBitmap.getHeight() / 2, srcBitmap.getHeight() / 2);
- matrix.postRotate(180, srcBitmap.getHeight() / 2, srcBitmap.getWidth() / 2);
- } else if(mOrientation == 90) {
- matrix.postRotate((sensorOrientation + mOrientation + 180 + 360) % 360, srcBitmap.getHeight() / 2, srcBitmap.getHeight() / 2);
- matrix.postRotate(180, srcBitmap.getWidth() / 2, srcBitmap.getHeight() / 2);
+ if (sensorOrientation == 90) {
+ matrix.postRotate(rotationAngle, dstBitmap.getHeight() / 2,
+ dstBitmap.getHeight() / 2);
+ } else if (sensorOrientation == 270) {
+ matrix.postRotate(rotationAngle, dstBitmap.getWidth() / 2,
+ dstBitmap.getWidth() / 2);
+ }
+ } else if (mOrientation == 270 || mOrientation == 90) {
+ matrix.postRotate(rotationAngle, dstBitmap.getWidth() / 2, dstBitmap.getHeight() / 2);
}
- matrix.postScale(ratio, ratio);
canvas.drawBitmap(srcBitmap, matrix, null);
}