summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/filters
diff options
context:
space:
mode:
authornicolasroard <nicolasroard@google.com>2013-07-31 16:22:59 -0700
committernicolasroard <nicolasroard@google.com>2013-07-31 17:39:52 -0700
commit8f442fae60e0154867d2a6927eb9a35bcb7014e6 (patch)
tree5dbfc8c459e127bd3c05341f867a17972316ae7f /src/com/android/gallery3d/filtershow/filters
parent086b60315ff84c7551cc45af395a4f09f509b5c5 (diff)
downloadandroid_packages_apps_Gallery2-8f442fae60e0154867d2a6927eb9a35bcb7014e6.tar.gz
android_packages_apps_Gallery2-8f442fae60e0154867d2a6927eb9a35bcb7014e6.tar.bz2
android_packages_apps_Gallery2-8f442fae60e0154867d2a6927eb9a35bcb7014e6.zip
Fix problem with N-1 caching when no filters / one filter
- also fix equals() for geometry Change-Id: I6f6f21d1e274b3b95ac4b5189b2fa7f419912864
Diffstat (limited to 'src/com/android/gallery3d/filtershow/filters')
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterCropRepresentation.java19
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterMirrorRepresentation.java12
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterRotateRepresentation.java12
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterStraightenRepresentation.java12
4 files changed, 55 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterCropRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterCropRepresentation.java
index 345c2f1bf..fea8b2139 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterCropRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterCropRepresentation.java
@@ -60,6 +60,25 @@ public class FilterCropRepresentation extends FilterRepresentation {
mImage.set(r.mImage);
}
+ @Override
+ public boolean equals(FilterRepresentation rep) {
+ if (!(rep instanceof FilterCropRepresentation)) {
+ return false;
+ }
+ FilterCropRepresentation crop = (FilterCropRepresentation) rep;
+ if (mCrop.bottom != crop.mCrop.bottom
+ || mCrop.left != crop.mCrop.left
+ || mCrop.right != crop.mCrop.right
+ || mCrop.top != crop.mCrop.top
+ || mImage.bottom != crop.mImage.bottom
+ || mImage.left != crop.mImage.left
+ || mImage.right != crop.mImage.right
+ || mImage.top != crop.mImage.top) {
+ return false;
+ }
+ return true;
+ }
+
public RectF getCrop() {
return new RectF(mCrop);
}
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterMirrorRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterMirrorRepresentation.java
index 0acf70e71..22a15f27e 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterMirrorRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterMirrorRepresentation.java
@@ -79,6 +79,18 @@ public class FilterMirrorRepresentation extends FilterRepresentation {
this(Mirror.NONE);
}
+ @Override
+ public boolean equals(FilterRepresentation rep) {
+ if (!(rep instanceof FilterMirrorRepresentation)) {
+ return false;
+ }
+ FilterMirrorRepresentation mirror = (FilterMirrorRepresentation) rep;
+ if (mirror.mMirror.value() != mirror.mMirror.value()) {
+ return false;
+ }
+ return true;
+ }
+
public Mirror getMirror() {
return mMirror;
}
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRotateRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRotateRepresentation.java
index 8f7d8ebef..d5f3a5b40 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterRotateRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterRotateRepresentation.java
@@ -134,6 +134,18 @@ public class FilterRotateRepresentation extends FilterRepresentation {
}
@Override
+ public boolean equals(FilterRepresentation rep) {
+ if (!(rep instanceof FilterRotateRepresentation)) {
+ return false;
+ }
+ FilterRotateRepresentation rotate = (FilterRotateRepresentation) rep;
+ if (rotate.mRotation.value() != mRotation.value()) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
public void deSerializeRepresentation(JsonReader reader) throws IOException {
boolean unset = true;
reader.beginObject();
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterStraightenRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterStraightenRepresentation.java
index a06216ef3..890f1cfd6 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterStraightenRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterStraightenRepresentation.java
@@ -55,6 +55,18 @@ public class FilterStraightenRepresentation extends FilterRepresentation {
mStraighten = r.mStraighten;
}
+ @Override
+ public boolean equals(FilterRepresentation rep) {
+ if (!(rep instanceof FilterStraightenRepresentation)) {
+ return false;
+ }
+ FilterStraightenRepresentation straighten = (FilterStraightenRepresentation) rep;
+ if (straighten.mStraighten != mStraighten) {
+ return false;
+ }
+ return true;
+ }
+
public float getStraighten() {
return mStraighten;
}