diff options
author | Byunghun Jeon <bjeon@codeaurora.org> | 2015-02-19 15:58:56 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-02-20 14:31:00 -0800 |
commit | adbd5d23d47bc30562d1508b2bff06128cd78268 (patch) | |
tree | 248072a3c821c1b631e05d5783c0511e1f812b0a /src/com/android/camera/util | |
parent | 542cf402a8958f8bab78dfd2b21991b290bd14b5 (diff) | |
download | android_packages_apps_Snap-adbd5d23d47bc30562d1508b2bff06128cd78268.tar.gz android_packages_apps_Snap-adbd5d23d47bc30562d1508b2bff06128cd78268.tar.bz2 android_packages_apps_Snap-adbd5d23d47bc30562d1508b2bff06128cd78268.zip |
Snapdragon: Fix photo/video preview to match with captured photo/video
Photo and video preview and the captured results are different for
some resolutions. Fix them to match the result.
Change-Id: Ie5fb1954448fa54ffb968f2882e74bfd98c97548
CRs-Fixed: 791082
Diffstat (limited to 'src/com/android/camera/util')
-rw-r--r-- | src/com/android/camera/util/CameraUtil.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java index debc04939..51c91cfe5 100644 --- a/src/com/android/camera/util/CameraUtil.java +++ b/src/com/android/camera/util/CameraUtil.java @@ -1093,4 +1093,27 @@ public class CameraUtil { return RATIO_UNKNOWN; } } + + public static int determinCloseRatio(float ratio) { + if (ratio < 1) { + ratio = 1 / ratio; + } + + float diffFrom_4_3 = ((float) 4 / 3) / ratio; + if (diffFrom_4_3 < 1) { + diffFrom_4_3 = 1 / diffFrom_4_3; + } + + float diffFrom_16_9 = ((float) 16 / 9) / ratio; + if (diffFrom_16_9 < 1) { + diffFrom_16_9 = 1 / diffFrom_16_9; + } + + if (diffFrom_4_3 < diffFrom_16_9) { + return RATIO_4_3; + } else { + return RATIO_16_9; + } + } + } |