diff options
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/camera/CameraSettings.java | 19 | ||||
-rw-r--r-- | src/com/android/camera/PhotoModule.java | 50 |
2 files changed, 22 insertions, 47 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java index 7db9fec80..3eab068c3 100644 --- a/src/com/android/camera/CameraSettings.java +++ b/src/com/android/camera/CameraSettings.java @@ -242,7 +242,7 @@ public class CameraSettings { public static final String VALUE_ON = "on"; public static final String VALUE_OFF = "off"; - public static final int CURRENT_VERSION = 5; + public static final int CURRENT_VERSION = 6; public static final int CURRENT_LOCAL_VERSION = 2; private static final String TAG = "CameraSettings"; @@ -1049,6 +1049,23 @@ public class CameraSettings { // Just use video quality to replace it and // ignore the current settings. editor.remove("pref_camera_videoquality_key"); + version = 4; + } + if (version == 4) { + // Just upgrade to version 5 directly + version = 5; + } + if (version == 5) { + // Change jpeg quality {normal,fine,superfine} back to {65,75,85} + String quality = pref.getString(KEY_JPEG_QUALITY, "superfine"); + if (quality.equals("normal")) { + quality = "65"; + } else if (quality.equals("fine")) { + quality = "75"; + } else { + quality = context.getString(R.string.pref_camera_jpegquality_default); + } + editor.putString(KEY_JPEG_QUALITY, quality); } editor.putInt(KEY_VERSION, CURRENT_VERSION); diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java index c8cd0a0da..399f784b6 100644 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java @@ -2862,12 +2862,11 @@ public class PhotoModule Size pic_size = mParameters.getPictureSize(); if (pic_size == null) { Log.e(TAG, "error getPictureSize: size is null"); - } - else{ - if("100".equals(jpegQuality) && (pic_size.width >= 3200)){ + } else { + if ("100".equals(jpegQuality) && (pic_size.width >= 3200)) { //mUnsupportedJpegQuality = true; - }else { - mParameters.setJpegQuality(JpegEncodingQualityMappings.getQualityNumber(jpegQuality)); + } else { + mParameters.setJpegQuality(Integer.parseInt(jpegQuality)); int jpegFileSize = estimateJpegFileSize(pic_size, jpegQuality); if (jpegFileSize != mJpegFileSizeEstimation) { mJpegFileSizeEstimation = jpegFileSize; @@ -3534,11 +3533,6 @@ public class PhotoModule } } - // Set JPEG quality. - int jpegQuality = CameraProfile.getJpegEncodingQualityParameter(mCameraId, - CameraProfile.QUALITY_HIGH); - mParameters.setJpegQuality(jpegQuality); - // For the following settings, we need to check if the settings are // still supported by latest driver, if not, ignore the settings. @@ -4508,42 +4502,6 @@ public class PhotoModule } } -/* Below is no longer needed, except to get rid of compile error - * TODO: Remove these - */ -class JpegEncodingQualityMappings { - private static final String TAG = "JpegEncodingQualityMappings"; - private static final int DEFAULT_QUALITY = 85; - private static HashMap<String, Integer> mHashMap = - new HashMap<String, Integer>(); - - static { - mHashMap.put("normal", CameraProfile.QUALITY_LOW); - mHashMap.put("fine", CameraProfile.QUALITY_MEDIUM); - mHashMap.put("superfine", CameraProfile.QUALITY_HIGH); - } - - // Retrieve and return the Jpeg encoding quality number - // for the given quality level. - public static int getQualityNumber(String jpegQuality) { - try{ - int qualityPercentile = Integer.parseInt(jpegQuality); - if(qualityPercentile >= 0 && qualityPercentile <=100) - return qualityPercentile; - else - return DEFAULT_QUALITY; - } catch(NumberFormatException nfe){ - //chosen quality is not a number, continue - } - Integer quality = mHashMap.get(jpegQuality); - if (quality == null) { - Log.w(TAG, "Unknown Jpeg quality: " + jpegQuality); - return DEFAULT_QUALITY; - } - return CameraProfile.getJpegEncodingQualityParameter(quality.intValue()); - } -} - class GraphView extends View { private Bitmap mBitmap; private Paint mPaint = new Paint(); |