summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d
diff options
context:
space:
mode:
authorztenghui <ztenghui@google.com>2013-07-15 16:04:32 -0700
committerztenghui <ztenghui@google.com>2013-07-15 16:04:32 -0700
commit36cf7a9bbd856063eaf5779e05ae75645a458226 (patch)
tree09f388e8ef4ba12af8a263f9d3d633946e361f95 /src/com/android/gallery3d
parentb7f5b39dee010424b1d57257b728255c0bf334f2 (diff)
downloadandroid_packages_apps_Snap-36cf7a9bbd856063eaf5779e05ae75645a458226.tar.gz
android_packages_apps_Snap-36cf7a9bbd856063eaf5779e05ae75645a458226.tar.bz2
android_packages_apps_Snap-36cf7a9bbd856063eaf5779e05ae75645a458226.zip
Add equality check into FilterCurveRep
Consequently add equality check support in Spline and ControlPoint. bug:9468909 Change-Id: I8078b994beac4056ca92e76da0e15d618389e56e
Diffstat (limited to 'src/com/android/gallery3d')
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java
index a71aa8863..569ead957 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java
@@ -58,6 +58,7 @@ public class FilterCurvesRepresentation extends FilterRepresentation {
mSplines = spline;
}
+ @Override
public boolean isNil() {
for (int i = 0; i < MAX_SPLINE_NUMBER; i++) {
if (getSpline(i) != null && !getSpline(i).isOriginal()) {
@@ -67,6 +68,27 @@ public class FilterCurvesRepresentation extends FilterRepresentation {
return true;
}
+ @Override
+ public boolean equals(FilterRepresentation representation) {
+ if (!super.equals(representation)) {
+ return false;
+ }
+
+ if (!(representation instanceof FilterCurvesRepresentation)) {
+ return false;
+ } else {
+ FilterCurvesRepresentation curve =
+ (FilterCurvesRepresentation) representation;
+ for (int i = 0; i < MAX_SPLINE_NUMBER; i++) {
+ if (!getSpline(i).sameValues(curve.getSpline(i))) {
+ return false;
+ }
+ }
+ }
+ // Every spline matches, therefore they are the same.
+ return true;
+ }
+
public void reset() {
Spline spline = new Spline();
@@ -81,6 +103,7 @@ public class FilterCurvesRepresentation extends FilterRepresentation {
public void setSpline(int splineIndex, Spline s) {
mSplines[splineIndex] = s;
}
+
public Spline getSpline(int splineIndex) {
return mSplines[splineIndex];
}