summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlikaid <likaid@codeaurora.org>2015-07-13 17:19:56 +0800
committerSteve Kondik <steve@cyngn.com>2016-08-03 15:44:38 -0700
commitfb876ae48c9dc41cd7bcca7629649e51a727d5fc (patch)
tree7e7c4670c7ab3c5d58ccd54731c7ed5fb93ee76a
parentd3497e2d8dc8c1ea841be19474b12adbc28edfdf (diff)
downloadandroid_packages_apps_Snap-fb876ae48c9dc41cd7bcca7629649e51a727d5fc.tar.gz
android_packages_apps_Snap-fb876ae48c9dc41cd7bcca7629649e51a727d5fc.tar.bz2
android_packages_apps_Snap-fb876ae48c9dc41cd7bcca7629649e51a727d5fc.zip
SnapdragonCamera: Fix display smaller thumbnail on panorama preview
The preview thumbnail size is calculated according to the captured image size. When capture panorama image with landscape, the height of the image will be too small to fill the thumbnail view. Enlarge the bitmap to the thumbnail size if it is not large enough. Change-Id: I65afcdf2943eed4526639ff418b929e6450711b5 CRs-Fixed: 868550
-rw-r--r--src/com/android/camera/CameraActivity.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index d7bc6616e..fbdb38f5b 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -893,6 +893,20 @@ public class CameraActivity extends Activity
public CircularDrawable(Bitmap bitmap) {
int w = bitmap.getWidth();
int h = bitmap.getHeight();
+ int targetSize = getResources().getDimensionPixelSize(R.dimen.capture_size);
+ if (Math.min(w, h) < targetSize) {
+ Matrix matrix = new Matrix();
+ float scale = 1.0f;
+ if (w > h) {
+ scale = (float) targetSize / (float) h;
+ } else {
+ scale = (float) targetSize / (float) w;
+ }
+ matrix.postScale(scale, scale);
+ bitmap = Bitmap.createBitmap(bitmap, 0, 0, w, h, matrix, true);
+ w = (int) (w * scale);
+ h = (int) (h * scale);
+ }
if (w > h) {
mLength = h;
bitmap = Bitmap.createBitmap(bitmap, (w - h) / 2, 0, h, h);