summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);
}