From dd1652d871dccb2d76ac670b47a19a074146d243 Mon Sep 17 00:00:00 2001 From: althafvly Date: Fri, 28 Oct 2022 11:32:13 +0530 Subject: [PATCH] Camera: Fix camera orientation Change-Id: I228bb71853b3417c8a103710b83a68d933cb314c --- .../java/net/sourceforge/opencamera/preview/Preview.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/java/net/sourceforge/opencamera/preview/Preview.java b/app/src/main/java/net/sourceforge/opencamera/preview/Preview.java index f2e621d79..dcccc4e00 100644 --- a/app/src/main/java/net/sourceforge/opencamera/preview/Preview.java +++ b/app/src/main/java/net/sourceforge/opencamera/preview/Preview.java @@ -4033,6 +4033,13 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu if (MyDebug.LOG) Log.d(TAG, "getImageVideoRotation() lock to portrait, returns " + result); return result; + } else { + int cameraRotationOffset = camera_controller.getCameraOrientation(); + boolean isFrontFacing = camera_controller.getFacing() == CameraController.Facing.FACING_FRONT; + int rotation = isFrontFacing ? cameraRotationOffset + getDisplayRotationDegrees() : + cameraRotationOffset - getDisplayRotationDegrees(); + + current_rotation = (360 + rotation) % 360; } if (MyDebug.LOG) Log.d(TAG, "getImageVideoRotation() returns current_rotation " + current_rotation); -- GitLab