summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Hoford <hoford@google.com>2013-08-14 14:49:36 -0700
committerJohn Hoford <hoford@google.com>2013-08-14 14:55:48 -0700
commit3e3e9e219a76e8ef4fb56b8ef4c6e0bac06c6cd1 (patch)
treed44d0fbda10f647a4135722bce282fa3269bb227 /src
parenta044ee9746c40ec003ba5a96bea91abd7cee2bb5 (diff)
downloadandroid_packages_apps_Gallery2-3e3e9e219a76e8ef4fb56b8ef4c6e0bac06c6cd1.tar.gz
android_packages_apps_Gallery2-3e3e9e219a76e8ef4fb56b8ef4c6e0bac06c6cd1.tar.bz2
android_packages_apps_Gallery2-3e3e9e219a76e8ef4fb56b8ef4c6e0bac06c6cd1.zip
fix vignette dragged off screen
bug:9471206 Change-Id: I4a64db869f05521fb4e1f32fffe67757c0e74348
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/EclipseControl.java12
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/ImageVignette.java3
2 files changed, 13 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/filtershow/imageshow/EclipseControl.java b/src/com/android/gallery3d/filtershow/imageshow/EclipseControl.java
index 8ceb37599..068464c44 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/EclipseControl.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/EclipseControl.java
@@ -22,6 +22,7 @@ import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.RadialGradient;
+import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
@@ -56,6 +57,7 @@ public class EclipseControl {
public final static int HAN_SW = 4;
public final static int HAN_WEST = 5;
public final static int HAN_NW = 6;
+ private Rect mImageBounds;
public EclipseControl(Context context) {
mSliderColor = Color.WHITE;
@@ -96,8 +98,13 @@ public class EclipseControl {
return -1;
}
- public void setScrToImageMatrix(Matrix scrToImg) {
+ public void setScrImageInfo(Matrix scrToImg, Rect imageBounds) {
mScrToImg = scrToImg;
+ mImageBounds = new Rect(imageBounds);
+ }
+
+ private boolean centerIsOutside(float x1, float y1) {
+ return (!mImageBounds.contains((int) x1, (int) y1));
}
public void actionDown(float x, float y, Oval oval) {
@@ -130,6 +137,9 @@ public class EclipseControl {
case HAN_CENTER:
float ctrdx = mDownX - mDownCenterX;
float ctrdy = mDownY - mDownCenterY;
+ if (centerIsOutside(x - ctrdx, y - ctrdy)) {
+ break;
+ }
oval.setCenter(x - ctrdx, y - ctrdy);
// setRepresentation(mVignetteRep);
break;
diff --git a/src/com/android/gallery3d/filtershow/imageshow/ImageVignette.java b/src/com/android/gallery3d/filtershow/imageshow/ImageVignette.java
index 518969ee1..039aea939 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/ImageVignette.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/ImageVignette.java
@@ -71,7 +71,8 @@ public class ImageVignette extends ImageShow {
float x = event.getX();
float y = event.getY();
- mElipse.setScrToImageMatrix(getScreenToImageMatrix(true));
+ mElipse.setScrImageInfo(getScreenToImageMatrix(true),
+ MasterImage.getImage().getOriginalBounds());
boolean didComputeEllipses = false;
switch (mask) {