summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java
diff options
context:
space:
mode:
authorRuben Brunk <rubenbrunk@google.com>2012-10-23 18:11:10 -0700
committerRuben Brunk <rubenbrunk@google.com>2012-10-23 21:32:43 -0700
commit026dabdcb13bd0095a970af8e1a05741f801db50 (patch)
tree79864c73cc56384ca3cc7b7369c152074104f93b /src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java
parent57cc382afb777db41002619da6f4762f4251bb59 (diff)
downloadandroid_packages_apps_Snap-026dabdcb13bd0095a970af8e1a05741f801db50.tar.gz
android_packages_apps_Snap-026dabdcb13bd0095a970af8e1a05741f801db50.tar.bz2
android_packages_apps_Snap-026dabdcb13bd0095a970af8e1a05741f801db50.zip
Fixed scaling factor for ImageShow and rotations.
Bug: 7392240 Bug: 7386048 Change-Id: I156c52acbd041604df2f7ccacca3a80f1b9fdb3b
Diffstat (limited to 'src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java')
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java b/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java
index 4c2918465..77e78fe7d 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java
@@ -105,9 +105,8 @@ public class GeometryMetadata {
public RectF getCropBounds(Bitmap bitmap) {
float scale = 1.0f;
- if (mPhotoBounds.width() > 0) {
- scale = bitmap.getWidth() / mPhotoBounds.width();
- }
+ scale = GeometryMath.scale(mPhotoBounds.width(), mPhotoBounds.height(), bitmap.getWidth(),
+ bitmap.getHeight());
return new RectF(mCropBounds.left * scale, mCropBounds.top * scale,
mCropBounds.right * scale, mCropBounds.bottom * scale);
}
@@ -299,8 +298,8 @@ public class GeometryMetadata {
/**
* Builds a matrix to transform a bitmap of width bmWidth and height
- * bmHeight so that the region of the bitmap being cropped to is
- * oriented and centered at displayCenter.
+ * bmHeight so that the region of the bitmap being cropped to is oriented
+ * and centered at displayCenter.
*
* @param bmWidth
* @param bmHeight
@@ -311,7 +310,7 @@ public class GeometryMetadata {
RectF rp = getPhotoBounds();
RectF rc = getPreviewCropBounds();
- float scale = bmWidth / rp.width();
+ float scale = GeometryMath.scale(rp.width(), rp.height(), bmWidth, bmHeight);
RectF scaledCrop = GeometryMath.scaleRect(rc, scale);
RectF scaledPhoto = GeometryMath.scaleRect(rp, scale);