From 62bffb2f0ec34fba6f2e51087a307afa96c64dea Mon Sep 17 00:00:00 2001 From: Wu-cheng Li Date: Sat, 16 Oct 2010 22:36:41 +0800 Subject: Fix wrong aspect ratio of camera preview. Surface view must match the preview size ratio. Deduct all paddings while calculating the width and height of surface view. bug:3104492 Change-Id: I0d87a1c531f51fe74dd62b59f32dc40b1d1fb84d --- src/com/android/camera/PreviewFrameLayout.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/com/android/camera/PreviewFrameLayout.java b/src/com/android/camera/PreviewFrameLayout.java index d65cc22..1ec629f 100644 --- a/src/com/android/camera/PreviewFrameLayout.java +++ b/src/com/android/camera/PreviewFrameLayout.java @@ -70,24 +70,13 @@ public class PreviewFrameLayout extends ViewGroup { @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { - // Try to layout the "frame" in the center of the area, and put - // "gripper" just to the left of it. If there is no enough space for - // the gripper, the "frame" will be moved a little right so that - // they won't overlap with each other. - int frameWidth = getWidth(); int frameHeight = getHeight(); FrameLayout f = mFrame; - - int horizontalPadding = Math.max( - f.getPaddingLeft() + f.getPaddingRight(), - (int) (MIN_HORIZONTAL_MARGIN * mMetrics.density)); + int horizontalPadding = f.getPaddingLeft() + f.getPaddingRight(); int verticalPadding = f.getPaddingBottom() + f.getPaddingTop(); - - // Ignore the vertical paddings, so that we won't draw the frame on the - // top and bottom sides - int previewHeight = frameHeight; + int previewHeight = frameHeight - verticalPadding; int previewWidth = frameWidth - horizontalPadding; // resize frame and preview for aspect ratio -- cgit v1.1