summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2013-10-07 18:39:26 -0700
committerDoris Liu <tianliu@google.com>2013-10-07 18:39:26 -0700
commitc502bc9d50ded1f2eec28f4809c7193ec4ec5298 (patch)
treebe273a39cd3af3927bcff4a1c416430e92939a7c
parent73809edd589fe54b44452cfa7c3935477d68dd5e (diff)
downloadandroid_packages_apps_Snap-c502bc9d50ded1f2eec28f4809c7193ec4ec5298.tar.gz
android_packages_apps_Snap-c502bc9d50ded1f2eec28f4809c7193ec4ec5298.tar.bz2
android_packages_apps_Snap-c502bc9d50ded1f2eec28f4809c7193ec4ec5298.zip
Correct sample factor for rotated images in zoom view
Bug: 11067085 Change-Id: I52093052393fb1b2db08f105b8a16b68c3d3c95a
-rw-r--r--src/com/android/camera/ui/ZoomView.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/com/android/camera/ui/ZoomView.java b/src/com/android/camera/ui/ZoomView.java
index ca9747b0d..f7b645341 100644
--- a/src/com/android/camera/ui/ZoomView.java
+++ b/src/com/android/camera/ui/ZoomView.java
@@ -103,7 +103,17 @@ public class ZoomView extends ImageView {
}
BitmapFactory.Options options = new BitmapFactory.Options();
- options.inSampleSize = getSampleFactor(region.width(), region.height());
+
+ if ((mOrientation + 360) % 180 == 0) {
+ options.inSampleSize = getSampleFactor(region.width(), region.height());
+ } else {
+ // The decoded region will be rotated 90/270 degrees before showing
+ // on screen. In other words, the width and height will be swapped.
+ // Therefore, sample factor should be calculated using swapped width
+ // and height.
+ options.inSampleSize = getSampleFactor(region.height(), region.width());
+ }
+
if (mRegionDecoder == null) {
InputStream is = getInputStream();
try {