summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java2
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/GeometryMath.java7
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java6
3 files changed, 10 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java
index bdcb0ea4e..d74a6faab 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java
@@ -72,7 +72,7 @@ public class ImageFilterGeometry extends ImageFilter {
Rect cropBounds = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
RectF crop = mGeometry.getCropBounds(bitmap);
if (crop.width() > 0 && crop.height() > 0)
- crop.roundOut(cropBounds);
+ cropBounds = GeometryMath.roundNearest(crop);
Bitmap temp = null;
if (mGeometry.hasSwitchedWidthHeight()) {
temp = Bitmap.createBitmap(cropBounds.height(), cropBounds.width(), mConfig);
diff --git a/src/com/android/gallery3d/filtershow/imageshow/GeometryMath.java b/src/com/android/gallery3d/filtershow/imageshow/GeometryMath.java
index 33a3f73cb..55f791820 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/GeometryMath.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/GeometryMath.java
@@ -16,6 +16,7 @@
package com.android.gallery3d.filtershow.imageshow;
+import android.graphics.Rect;
import android.graphics.RectF;
public class GeometryMath {
@@ -99,4 +100,10 @@ public class GeometryMath {
return Math.min(newWidth / oldWidth , newHeight / oldHeight);
}
+ public static Rect roundNearest(RectF r){
+ Rect q = new Rect(Math.round(r.left), Math.round(r.top), Math.round(r.right),
+ Math.round(r.bottom));
+ return q;
+ }
+
}
diff --git a/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java b/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java
index cf52b15ca..dffdc2449 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java
@@ -59,10 +59,8 @@ public class GeometryMetadata {
if (mStraightenRotation != 0) {
return true;
}
- Rect cropBounds = new Rect();
- mCropBounds.roundOut(cropBounds);
- Rect photoBounds = new Rect();
- mPhotoBounds.roundOut(photoBounds);
+ Rect cropBounds = GeometryMath.roundNearest(mCropBounds);
+ Rect photoBounds = GeometryMath.roundNearest(mPhotoBounds);
if (!cropBounds.equals(photoBounds)) {
return true;
}