summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui
diff options
context:
space:
mode:
authorzhuw <zhuw@codeaurora.org>2018-01-15 15:52:11 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2018-01-14 23:59:47 -0800
commit716814f7d8e5b6980dd20d44fe08a1edc944ab9b (patch)
tree4fdf2b6ad1cfb442e7e6fb60e5eeb7d087e8e0df /src/com/android/camera/ui
parent2fdb251817064f39c23a1404617cdc3a613d3688 (diff)
downloadandroid_packages_apps_Snap-716814f7d8e5b6980dd20d44fe08a1edc944ab9b.tar.gz
android_packages_apps_Snap-716814f7d8e5b6980dd20d44fe08a1edc944ab9b.tar.bz2
android_packages_apps_Snap-716814f7d8e5b6980dd20d44fe08a1edc944ab9b.zip
SDCamera:Fix offset when show circle in face detection
change rw and rh to correct size Change-Id: I9482dd03529f5f2d86aad481ece049c31da32105 CRs-Fixed: 2163923
Diffstat (limited to 'src/com/android/camera/ui')
-rw-r--r--src/com/android/camera/ui/Camera2FaceView.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/com/android/camera/ui/Camera2FaceView.java b/src/com/android/camera/ui/Camera2FaceView.java
index 81be61f81..d08a4a722 100644
--- a/src/com/android/camera/ui/Camera2FaceView.java
+++ b/src/com/android/camera/ui/Camera2FaceView.java
@@ -117,6 +117,14 @@ public class Camera2FaceView extends FaceView {
rw = rh;
rh = temp;
}
+ if (rw * mCameraBound.width() != mCameraBound.height() * rh) {
+ if (rw >= getWidth()) {
+ rh = getWidth() * mCameraBound.width() / mCameraBound.height();
+ }
+ if (rh >= getHeight()) {
+ rw = getHeight() * mCameraBound.height() / mCameraBound.width();
+ }
+ }
CameraUtil.prepareMatrix(mMatrix, mMirror, mDisplayOrientation, rw, rh);
// mMatrix assumes that the face coordinates are from -1000 to 1000.
@@ -131,8 +139,10 @@ public class Camera2FaceView extends FaceView {
bsgcTranslateMatrix.postScale(2000f / mCameraBound.width(),
2000f / mCameraBound.height());
- int dx = (getWidth() - rw) / 2;
- int dy = (getHeight() - rh) / 2;
+ int dx = (getWidth() - mUncroppedWidth) / 2;
+ dx -= (rw - mUncroppedWidth) / 2;
+ int dy = (getHeight() - mUncroppedHeight) / 2;
+ dy -= (rh - mUncroppedHeight) / 2;
// Focus indicator is directional. Rotate the matrix and the canvas
// so it looks correctly in all orientations.