summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/ui
diff options
context:
space:
mode:
authorztenghui <ztenghui@google.com>2013-07-16 17:07:23 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-07-16 17:07:23 +0000
commit6d13e422b2ca68dce029c96e3b8789bae990a88c (patch)
tree9e64c41431bac1b6a512b51ffe0b92366e955550 /src/com/android/gallery3d/filtershow/ui
parent4e7deb5f4f56ca570858c10c5614ca8083f4b6ed (diff)
parent9448b353e8cb1936fb62262b8c4962cfd3765bab (diff)
downloadandroid_packages_apps_Snap-6d13e422b2ca68dce029c96e3b8789bae990a88c.tar.gz
android_packages_apps_Snap-6d13e422b2ca68dce029c96e3b8789bae990a88c.tar.bz2
android_packages_apps_Snap-6d13e422b2ca68dce029c96e3b8789bae990a88c.zip
Merge "Add equality check into FilterCurveRep" into gb-ub-photos-carlsbad
Diffstat (limited to 'src/com/android/gallery3d/filtershow/ui')
-rw-r--r--src/com/android/gallery3d/filtershow/ui/ControlPoint.java17
-rw-r--r--src/com/android/gallery3d/filtershow/ui/Spline.java22
2 files changed, 39 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/filtershow/ui/ControlPoint.java b/src/com/android/gallery3d/filtershow/ui/ControlPoint.java
index 73589d373..a95364b27 100644
--- a/src/com/android/gallery3d/filtershow/ui/ControlPoint.java
+++ b/src/com/android/gallery3d/filtershow/ui/ControlPoint.java
@@ -30,6 +30,23 @@ public class ControlPoint implements Comparable {
y = point.y;
}
+ public boolean sameValues(ControlPoint other) {
+ if (this == other) {
+ return true;
+ }
+ if (other == null) {
+ return false;
+ }
+
+ if (Float.floatToIntBits(x) != Float.floatToIntBits(other.x)) {
+ return false;
+ }
+ if (Float.floatToIntBits(y) != Float.floatToIntBits(other.y)) {
+ return false;
+ }
+ return true;
+ }
+
public ControlPoint copy() {
return new ControlPoint(x, y);
}
diff --git a/src/com/android/gallery3d/filtershow/ui/Spline.java b/src/com/android/gallery3d/filtershow/ui/Spline.java
index cadf2fd9c..5b931a98c 100644
--- a/src/com/android/gallery3d/filtershow/ui/Spline.java
+++ b/src/com/android/gallery3d/filtershow/ui/Spline.java
@@ -83,6 +83,28 @@ public class Spline {
return Color.WHITE;
}
+ public boolean sameValues(Spline other) {
+ if (this == other) {
+ return true;
+ }
+ if (other == null) {
+ return false;
+ }
+
+ if (getNbPoints() != other.getNbPoints()) {
+ return false;
+ }
+
+ for (int i = 0; i < getNbPoints(); i++) {
+ ControlPoint p = mPoints.elementAt(i);
+ ControlPoint otherPoint = other.mPoints.elementAt(i);
+ if (!p.sameValues(otherPoint)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
private void didMovePoint(ControlPoint point) {
mCurrentControlPoint = point;
}