diff options
author | Ruben Brunk <rubenbrunk@google.com> | 2012-10-18 23:39:18 -0700 |
---|---|---|
committer | Ruben Brunk <rubenbrunk@google.com> | 2012-10-19 00:43:12 -0700 |
commit | 00d64dd584c6d08310a32a28e75aebc6eb8238ea (patch) | |
tree | b72825f74c14d13b749337ae408d64a78eb20c63 /src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java | |
parent | c5590eb1a20b112e67e4c43684790587f844fc6b (diff) | |
download | android_packages_apps_Gallery2-00d64dd584c6d08310a32a28e75aebc6eb8238ea.tar.gz android_packages_apps_Gallery2-00d64dd584c6d08310a32a28e75aebc6eb8238ea.tar.bz2 android_packages_apps_Gallery2-00d64dd584c6d08310a32a28e75aebc6eb8238ea.zip |
Fix geometry xforms & minor bug.
Bug: 7376048
Fixed geometry transform. Fixed minor bug where the foldername
for saved edited images was incorrect.
Change-Id: Icb3156f02b7db7b50a455aaa31ee70832e3fdca8
Diffstat (limited to 'src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java')
-rw-r--r-- | src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java index 3d48b7e53..b5b505f55 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterGeometry.java @@ -63,21 +63,6 @@ public class ImageFilterGeometry extends ImageFilter { native protected void nativeApplyFilterStraighten(Bitmap src, int srcWidth, int srcHeight, Bitmap dst, int dstWidth, int dstHeight, float straightenAngle); - public Matrix buildMatrix(RectF r) { - float dx = r.width()/2; - float dy = r.height()/2; - if(mGeometry.hasSwitchedWidthHeight()){ - float temp = dx; - dx = dy; - dy = temp; - } - float w = r.left * 2 + r.width(); - float h = r.top * 2 + r.height(); - Matrix m = mGeometry.buildGeometryMatrix(w, h, 1f, dx, dy, false); - - return m; - } - @Override public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) { // TODO: implement bilinear or bicubic here... for now, just use @@ -85,7 +70,7 @@ public class ImageFilterGeometry extends ImageFilter { // TODO: and be more memory efficient! (do it in native?) Rect cropBounds = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()); RectF crop = mGeometry.getCropBounds(bitmap); - if(crop.width() > 0 && crop.height() > 0) + if (crop.width() > 0 && crop.height() > 0) crop.roundOut(cropBounds); Bitmap temp = null; if (mGeometry.hasSwitchedWidthHeight()) { @@ -94,7 +79,12 @@ public class ImageFilterGeometry extends ImageFilter { temp = Bitmap.createBitmap(cropBounds.width(), cropBounds.height(), mConfig); } - Matrix drawMatrix = buildMatrix(crop); + RectF rp = mGeometry.getPhotoBounds(); + RectF rc = mGeometry.getPreviewCropBounds(); + Matrix drawMatrix = mGeometry.buildTotalXform(rp.width(), rp.height(), rc.width(), + rc.height(), rc.left, rc.top, + mGeometry.getRotation(), mGeometry.getStraightenRotation(), + bitmap.getWidth() / rp.width(), null); Canvas canvas = new Canvas(temp); canvas.drawBitmap(bitmap, drawMatrix, new Paint()); return temp; |