summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/Util.java
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2010-12-17 11:27:48 +0800
committerWu-cheng Li <wuchengli@google.com>2010-12-17 11:36:47 +0800
commit0fad45d0d64569098f4daf34ff7e5ae785601304 (patch)
treee724cc1ce5b30f509f51388a7ff48cfa26371275 /src/com/android/camera/Util.java
parent5849ebe2eb6463018a015cabcad3b61f1befcc9c (diff)
downloadLegacyCamera-0fad45d0d64569098f4daf34ff7e5ae785601304.tar.gz
LegacyCamera-0fad45d0d64569098f4daf34ff7e5ae785601304.tar.bz2
LegacyCamera-0fad45d0d64569098f4daf34ff7e5ae785601304.zip
Choose the preview size that has the same aspect ratio as picture size.
Sometimes the camera driver has many preview sizes with close aspect ratios. Now camera app only chooses the preview size if its aspect ratio is an exact match of the picture size or video size. Change-Id: I3be1189688de3ac499f7d69f4febf09c7763393a
Diffstat (limited to 'src/com/android/camera/Util.java')
-rw-r--r--src/com/android/camera/Util.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java
index 3e5dd77c..f2350d00 100644
--- a/src/com/android/camera/Util.java
+++ b/src/com/android/camera/Util.java
@@ -337,7 +337,8 @@ public class Util {
public static Size getOptimalPreviewSize(Activity currentActivity,
List<Size> sizes, double targetRatio) {
- final double ASPECT_TOLERANCE = 0.05;
+ // Use a very small tolerance because we want an exact match.
+ final double ASPECT_TOLERANCE = 0.001;
if (sizes == null) return null;
Size optimalSize = null;
@@ -367,9 +368,10 @@ public class Util {
}
}
- // Cannot find the one match the aspect ratio, ignore the requirement
+ // Cannot find the one match the aspect ratio. This should not happen.
+ // Ignore the requirement.
if (optimalSize == null) {
- Log.v(TAG, "No preview size match the aspect ratio");
+ Log.w(TAG, "No preview size match the aspect ratio");
minDiff = Double.MAX_VALUE;
for (Size size : sizes) {
if (Math.abs(size.height - targetHeight) < minDiff) {