diff options
author | weijiew <weijiew@codeaurora.org> | 2016-12-21 17:00:29 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-12-24 01:36:21 -0800 |
commit | df644374b03720135ee94218b7e318d79211f57a (patch) | |
tree | dcbc7d5c883258940477b9c2f3752981d29f30f5 | |
parent | ec1cdf7f6b81e42e90c6d0627955eae5fac1f294 (diff) | |
download | android_packages_apps_Snap-df644374b03720135ee94218b7e318d79211f57a.tar.gz android_packages_apps_Snap-df644374b03720135ee94218b7e318d79211f57a.tar.bz2 android_packages_apps_Snap-df644374b03720135ee94218b7e318d79211f57a.zip |
SnapdragonCamera: ROI circle becomes oval when start/stop recording
Face circle is drawed by Canvas.drawOval. When start/stop recording,
face Rect is stretched to rectangle and lead to ROI circle become oval.
So, change Canvas.drawOval to Canvas.drawCircle
CRs-Fixed: 1099754
Change-Id: If6258d844c0685a65439c3fe536674a4f6260b48
-rw-r--r-- | src/com/android/camera/ui/Camera2FaceView.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/com/android/camera/ui/Camera2FaceView.java b/src/com/android/camera/ui/Camera2FaceView.java index 40a3469aa..ea75c65e2 100644 --- a/src/com/android/camera/ui/Camera2FaceView.java +++ b/src/com/android/camera/ui/Camera2FaceView.java @@ -111,7 +111,6 @@ public class Camera2FaceView extends FaceView { translateMatrix.postScale(2000f / mCameraBound.width(), 2000f / mCameraBound.height()); int dx = (getWidth() - rw) / 2; - ; int dy = (getHeight() - rh) / 2; // Focus indicator is directional. Rotate the matrix and the canvas @@ -119,6 +118,10 @@ public class Camera2FaceView extends FaceView { canvas.save(); mMatrix.postRotate(mOrientation); // postRotate is clockwise canvas.rotate(-mOrientation); // rotate is counter-clockwise (for canvas) + + float rectWidth; + float rectHeight; + float diameter; for (int i = 0; i < mFaces.length; i++) { if (mFaces[i].getScore() < 50) continue; Rect faceBound = mFaces[i].getBounds(); @@ -129,7 +132,11 @@ public class Camera2FaceView extends FaceView { mPaint.setColor(mColor); mRect.offset(dx, dy); - canvas.drawOval(mRect, mPaint); + rectHeight = mRect.bottom-mRect.top; + rectWidth = mRect.right - mRect.left; + diameter = rectHeight > rectWidth ? rectWidth : rectHeight; + + canvas.drawCircle(mRect.centerX(), mRect.centerY(), diameter/2, mPaint); } canvas.restore(); } |