diff options
author | Chih-yu Huang <akahuang@google.com> | 2011-10-21 11:50:02 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2011-10-21 19:47:21 +0800 |
commit | 048edf2ef22607b85bc4b062e2af71804f5b3530 (patch) | |
tree | c6fd30acd6a03b034296667f666f197c1d0bccb7 /src/com/android/camera/Util.java | |
parent | 7d9eadd0c6c38b3761b7e8d3fa3658d194810d60 (diff) | |
download | LegacyCamera-048edf2ef22607b85bc4b062e2af71804f5b3530.zip LegacyCamera-048edf2ef22607b85bc4b062e2af71804f5b3530.tar.gz LegacyCamera-048edf2ef22607b85bc4b062e2af71804f5b3530.tar.bz2 |
Fix focus area in front camera.
Front camera preview is mirrored. Change to use matrix to
calculate the focus area. So the focus area will be
correct in all orientations in front or back camera.
bug:5446617
bug:5461028
Change-Id: I2d39a22cd9f034c5028843ca3d4abe0f9962f18a
Diffstat (limited to 'src/com/android/camera/Util.java')
-rw-r--r-- | src/com/android/camera/Util.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java index 31a54d5..4c28e56 100644 --- a/src/com/android/camera/Util.java +++ b/src/com/android/camera/Util.java @@ -27,6 +27,8 @@ import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; +import android.graphics.Rect; +import android.graphics.RectF; import android.hardware.Camera; import android.hardware.Camera.CameraInfo; import android.hardware.Camera.Parameters; @@ -522,6 +524,18 @@ public class Util { } } + public static void dumpRect(RectF rect, String msg) { + Log.v(TAG, msg + "=(" + rect.left + "," + rect.top + + "," + rect.right + "," + rect.bottom + ")"); + } + + public static void rectFToRect(RectF rectF, Rect rect) { + rect.left = Math.round(rectF.left); + rect.top = Math.round(rectF.top); + rect.right = Math.round(rectF.right); + rect.bottom = Math.round(rectF.bottom); + } + public static void prepareMatrix(Matrix matrix, boolean mirror, int displayOrientation, int viewWidth, int viewHeight) { // Need mirror for front camera. |