diff options
4 files changed, 26 insertions, 19 deletions
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index b758e8151..b526f91fe 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -1240,7 +1240,7 @@ public class PhotoPage extends ActivityState implements if (resultCode == Activity.RESULT_OK) { Context context = mActivity.getAndroidContext(); String message = context.getString(R.string.crop_saved, - context.getString(R.string.folder_download)); + context.getString(R.string.folder_edited_online_photos)); Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); } break; 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; diff --git a/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java b/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java index 164b6f989..666eff99e 100644 --- a/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java +++ b/src/com/android/gallery3d/filtershow/imageshow/GeometryMetadata.java @@ -239,4 +239,21 @@ public class GeometryMetadata { float h = mPhotoBounds.height(); return buildGeometryMatrix(w, h, scaling, dx, dy, false); } + + public Matrix buildTotalXform(float pwidth, float pheight, float cwidth, float cheight, + float cleft, float ctop, float rotation, float straighten, float scale, RectF dst) { + Matrix m = getFlipMatrix(pwidth, pheight); + m.postRotate(rotation + straighten, pwidth / 2, pheight / 2); + Matrix m1 = new Matrix(); + m1.setRotate(rotation, pwidth / 2, pheight / 2); + // find new top left for crop. + RectF crop = new RectF(cleft, ctop, cleft + cwidth, ctop + cheight); + if (!m1.mapRect(crop)) + return null; + if (dst != null) + dst.set(crop); + m.postTranslate(-crop.left, -crop.top); + m.postScale(scale, scale); + return m; + } } diff --git a/src/com/android/gallery3d/filtershow/imageshow/ImageFlip.java b/src/com/android/gallery3d/filtershow/imageshow/ImageFlip.java index a75ce4d0c..f6cd9b7e2 100644 --- a/src/com/android/gallery3d/filtershow/imageshow/ImageFlip.java +++ b/src/com/android/gallery3d/filtershow/imageshow/ImageFlip.java @@ -28,7 +28,7 @@ import com.android.gallery3d.filtershow.imageshow.GeometryMetadata.FLIP; public class ImageFlip extends ImageGeometry { private static final Paint gPaint = new Paint(); - private static final float MIN_FLICK_DIST_FOR_FLIP = 0.2f; + private static final float MIN_FLICK_DIST_FOR_FLIP = 0.1f; private static final String LOGTAG = "ImageFlip"; private FLIP mNextFlip = FLIP.NONE; |