diff options
author | nicolasroard <nicolasroard@google.com> | 2012-10-11 18:12:09 -0700 |
---|---|---|
committer | nicolasroard <nicolasroard@google.com> | 2012-10-11 19:50:22 -0700 |
commit | bcea53b010546ef1fe948ea7d9667e635496d55e (patch) | |
tree | 25c419aa8da638e01aa04005e827b8e158766b8c /src/com/android/gallery3d/filtershow/imageshow/ImageRotate.java | |
parent | faa46e509993bdba852f6ce03add6022a0e21b6e (diff) | |
download | android_packages_apps_Snap-bcea53b010546ef1fe948ea7d9667e635496d55e.tar.gz android_packages_apps_Snap-bcea53b010546ef1fe948ea7d9667e635496d55e.tar.bz2 android_packages_apps_Snap-bcea53b010546ef1fe948ea7d9667e635496d55e.zip |
Fixes Rotate, Flip, Straighten tools.
bug:7314849
Bug:7224232
Bug:7218935
Change-Id: I418287ff1f81c25f8e089821d823dc29ee62ff0e
Diffstat (limited to 'src/com/android/gallery3d/filtershow/imageshow/ImageRotate.java')
-rw-r--r-- | src/com/android/gallery3d/filtershow/imageshow/ImageRotate.java | 57 |
1 files changed, 2 insertions, 55 deletions
diff --git a/src/com/android/gallery3d/filtershow/imageshow/ImageRotate.java b/src/com/android/gallery3d/filtershow/imageshow/ImageRotate.java index c0999e3d0..089e11732 100644 --- a/src/com/android/gallery3d/filtershow/imageshow/ImageRotate.java +++ b/src/com/android/gallery3d/filtershow/imageshow/ImageRotate.java @@ -19,12 +19,8 @@ package com.android.gallery3d.filtershow.imageshow; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; -import android.graphics.Matrix; import android.graphics.Paint; -import android.graphics.Path; -import android.graphics.RectF; import android.util.AttributeSet; -import android.util.Log; public class ImageRotate extends ImageGeometry { private static final float MATH_PI = (float) Math.PI; @@ -32,8 +28,7 @@ public class ImageRotate extends ImageGeometry { private float mBaseAngle = 0; private float mAngle = 0; - private RectF mLocalBoundsCopy = null; - private boolean mSnapToNinety = true; + private final boolean mSnapToNinety = true; private static final String LOGTAG = "ImageRotate"; public ImageRotate(Context context, AttributeSet attrs) { @@ -98,21 +93,6 @@ public class ImageRotate extends ImageGeometry { } @Override - public void resetParameter() { - super.resetParameter(); - mLocalBoundsCopy = getLocalCropBounds(); - } - - @Override - protected void gainedVisibility() { - mLocalBoundsCopy = getLocalCropBounds(); - } - - @Override - protected void lostVisibility() { - } - - @Override protected int getLocalValue() { return (int) getLocalRotation(); } @@ -123,39 +103,6 @@ public class ImageRotate extends ImageGeometry { gPaint.setFilterBitmap(true); gPaint.setDither(true); gPaint.setARGB(255, 255, 255, 255); - - drawRegularFlippedBitmap(canvas, image, gPaint); - - RectF cropBounds = getCropBoundsDisplayed(mLocalBoundsCopy); - - Matrix m0 = new Matrix(); - m0.setRotate(getLocalRotation(), mCenterX, mCenterY); - float[] corners = getCornersFromRect(cropBounds); - m0.mapPoints(corners); - - gPaint.setARGB(255, 255, 255, 255); - gPaint.setStrokeWidth(3); - gPaint.setStyle(Paint.Style.STROKE); - drawClosedPath(canvas, gPaint, corners); - - canvas.save(); - canvas.rotate(getLocalRotation(), mCenterX, mCenterY); - RectF displayRect = getLocalDisplayBounds(); - float dWidth = displayRect.width(); - float dHeight = displayRect.height(); - RectF boundsRect = cropBounds; - gPaint.setARGB(128, 0, 0, 0); - // TODO: move style to xml - gPaint.setStyle(Paint.Style.FILL); - canvas.drawRect(0, 0, dWidth, boundsRect.top, gPaint); - canvas.drawRect(0, boundsRect.bottom, dWidth, dHeight, gPaint); - canvas.drawRect(0, boundsRect.top, boundsRect.left, boundsRect.bottom, - gPaint); - canvas.drawRect(boundsRect.right, boundsRect.top, dWidth, - boundsRect.bottom, gPaint); - canvas.rotate(-getLocalRotation(), mCenterX, mCenterY); - canvas.restore(); - + drawTransformedBitmap(canvas, image, gPaint, true); } - } |