diff options
author | Wu-cheng Li <wuchengli@google.com> | 2010-10-16 22:36:41 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2010-10-18 14:15:31 +0800 |
commit | 62bffb2f0ec34fba6f2e51087a307afa96c64dea (patch) | |
tree | 36a8b5047e455d330dd6d5e5dbc7785112aa382f /src | |
parent | d6e48e7e4836fd9fe9a6ab6ef2b82feb038f80c6 (diff) | |
download | packages_apps_LegacyCamera-62bffb2f0ec34fba6f2e51087a307afa96c64dea.zip packages_apps_LegacyCamera-62bffb2f0ec34fba6f2e51087a307afa96c64dea.tar.gz packages_apps_LegacyCamera-62bffb2f0ec34fba6f2e51087a307afa96c64dea.tar.bz2 |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/PreviewFrameLayout.java | 15 |
1 files 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 |