summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLikai Ding <likaid@codeaurora.org>2015-07-30 14:27:43 +0800
committerMichael Bestas <mikeioannina@cyanogenmod.org>2016-01-14 18:44:03 +0200
commit8a0414d2c32c5f550b185d954611d036ec29376e (patch)
tree430660990e8e95d5de94f7d51f45d0cdb69ba885 /src
parentff10b54cad0c205dda809474e184b97ab26c9fa7 (diff)
downloadandroid_packages_apps_Snap-8a0414d2c32c5f550b185d954611d036ec29376e.tar.gz
android_packages_apps_Snap-8a0414d2c32c5f550b185d954611d036ec29376e.tar.bz2
android_packages_apps_Snap-8a0414d2c32c5f550b185d954611d036ec29376e.zip
SnapdragonCamera: fix thumbnail display
Thumbnail image is usually larger than needed due to the choice of down-sampling factor. When the decoded bitmap is square, it's width and height is not correctly set in CircularDrawable, so only the left-top part of the cropped image is shown. Set the size and only decode exactly the region for display. Change-Id: I5f4af66a08f0dc02d84bda605b74c9e2b782fe63 CRs-Fixed: 881895
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/CameraActivity.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 79030c1b3..09cb46707 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -817,8 +817,6 @@ public class CameraActivity extends Activity
int w = opt.outWidth;
int h = opt.outHeight;
int d = w > h ? h : w;
- final Rect rect = w > h ? new Rect((w - h) / 2, 0, (w + h) / 2, h)
- : new Rect(0, (h - w) / 2, w, (h + w) / 2);
final int target = getResources().getDimensionPixelSize(R.dimen.capture_size);
int sample = 1;
@@ -827,6 +825,8 @@ public class CameraActivity extends Activity
sample *= 2;
}
}
+ int st = sample * target;
+ final Rect rect = new Rect((w - st) / 2, (h - st) / 2, (w + st) / 2, (h + st) / 2);
opt.inJustDecodeBounds = false;
opt.inSampleSize = sample;
@@ -866,6 +866,8 @@ public class CameraActivity extends Activity
} else if (w < h) {
mLength = w;
bitmap = Bitmap.createBitmap(bitmap, 0, (h - w) / 2, w, w);
+ } else {
+ mLength = w;
}
mBitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);