summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Hoford <hoford@google.com>2013-02-20 08:31:40 -0800
committerJohn Hoford <hoford@google.com>2013-02-20 08:31:40 -0800
commit0342a57fb113f26a6aed567a7f1434efd59a78fe (patch)
treeb4c21abf5787949731fb5eab314c9724309b7eba /src
parentffe5a12da3a9f61607c8ee5d81e21dfce763b7d9 (diff)
downloadandroid_packages_apps_Snap-0342a57fb113f26a6aed567a7f1434efd59a78fe.tar.gz
android_packages_apps_Snap-0342a57fb113f26a6aed567a7f1434efd59a78fe.tar.bz2
android_packages_apps_Snap-0342a57fb113f26a6aed567a7f1434efd59a78fe.zip
fix vignette startup issues
Change-Id: I3a8461edf3239044565611ed35b41cb87e5a529f
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/EclipseControl.java4
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/ImageVignette.java14
2 files changed, 13 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/filtershow/imageshow/EclipseControl.java b/src/com/android/gallery3d/filtershow/imageshow/EclipseControl.java
index 24791887d..b4ca8e1f1 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/EclipseControl.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/EclipseControl.java
@@ -249,4 +249,8 @@ public class EclipseControl {
fillHandles(canvas, mCenterX, mCenterY, mRadiusX, mRadiusY);
paintPoint(canvas, mCenterX, mCenterY);
}
+
+ public boolean isUndefined() {
+ return Float.isNaN(mCenterX);
+ }
}
diff --git a/src/com/android/gallery3d/filtershow/imageshow/ImageVignette.java b/src/com/android/gallery3d/filtershow/imageshow/ImageVignette.java
index d56cc4713..729ac7f41 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/ImageVignette.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/ImageVignette.java
@@ -92,17 +92,18 @@ public class ImageVignette extends ImageShow {
if (Float.isNaN(c[0])) {
float cx = mImageLoader.getOriginalBounds().width() / 2;
float cy = mImageLoader.getOriginalBounds().height() / 2;
- float rx = cx * .8f;
- float ry = cy * .8f;
+ float rx = Math.min(cx, cy) * .8f;
+ float ry = rx;
mVignetteRep.setCenter(cx, cy);
mVignetteRep.setRadius(rx, ry);
c[0] = cx;
c[1] = cy;
toScr.mapPoints(c);
-
- mElipse.setCenter(c[0], c[1]);
- mElipse.setRadius(c[0] * 0.8f, c[1] * 0.8f);
+ if (getWidth() != 0) {
+ mElipse.setCenter(c[0], c[1]);
+ mElipse.setRadius(c[0] * 0.8f, c[1] * 0.8f);
+ }
} else {
toScr.mapPoints(c);
@@ -120,6 +121,9 @@ public class ImageVignette extends ImageShow {
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
+ if (mElipse.isUndefined()) {
+ setRepresentation(mVignetteRep);
+ }
mElipse.draw(canvas);
}