summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/ui
diff options
context:
space:
mode:
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;
}