summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/gallery3d/filtershow/PanelController.java2
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java21
-rw-r--r--src/com/android/gallery3d/filtershow/presets/ImagePreset.java4
3 files changed, 25 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/filtershow/PanelController.java b/src/com/android/gallery3d/filtershow/PanelController.java
index 45868eeba..18a9585a6 100644
--- a/src/com/android/gallery3d/filtershow/PanelController.java
+++ b/src/com/android/gallery3d/filtershow/PanelController.java
@@ -459,7 +459,7 @@ public class PanelController implements OnClickListener {
copy.addFilter(filterRepresentation);
} else {
if (filterRepresentation.allowsMultipleInstances()) {
- representation.useParametersFrom(filterRepresentation);
+ representation.updateTempParametersFrom(filterRepresentation);
copy.setHistoryName(filterRepresentation.getName());
}
filterRepresentation = representation;
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
index 8ac191de7..513cdcdef 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
@@ -40,6 +40,8 @@ public class FilterRepresentation implements Cloneable {
public static final byte TYPE_NORMAL = 5;
public static final byte TYPE_TINYPLANET = 6;
+ public FilterRepresentation mTempRepresentation = null;
+
public FilterRepresentation(String name) {
mName = name;
}
@@ -107,6 +109,24 @@ public class FilterRepresentation implements Cloneable {
public void useParametersFrom(FilterRepresentation a) {
}
+ public synchronized void updateTempParametersFrom(FilterRepresentation representation) {
+ if (mTempRepresentation == null) {
+ try {
+ mTempRepresentation = representation.clone();
+ } catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ } else {
+ mTempRepresentation.useParametersFrom(representation);
+ }
+ }
+
+ public synchronized void synchronizeRepresentation() {
+ if (mTempRepresentation != null) {
+ useParametersFrom(mTempRepresentation);
+ }
+ }
+
public boolean allowsMultipleInstances() {
return false;
}
@@ -185,4 +205,5 @@ public class FilterRepresentation implements Cloneable {
public String getStateRepresentation() {
return "";
}
+
}
diff --git a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java
index e3594848c..84266c55d 100644
--- a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java
+++ b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java
@@ -130,7 +130,7 @@ public class ImagePreset {
synchronized (mFilters) {
int position = getPositionForRepresentation(representation);
FilterRepresentation old = mFilters.elementAt(position);
- old.useParametersFrom(representation);
+ old.updateTempParametersFrom(representation);
}
MasterImage.getImage().invalidatePreview();
}
@@ -388,6 +388,7 @@ public class ImagePreset {
public Bitmap applyBorder(Bitmap bitmap) {
if (mBorder != null && mDoApplyGeometry) {
ImageFilter filter = FiltersManager.getManager().getFilterForRepresentation(mBorder);
+ mBorder.synchronizeRepresentation();
filter.useRepresentation(mBorder);
filter.setImagePreset(this);
bitmap = filter.apply(bitmap, mScaleFactor, mQuality);
@@ -408,6 +409,7 @@ public class ImagePreset {
FilterRepresentation representation = null;
synchronized (mFilters) {
representation = mFilters.elementAt(i);
+ representation.synchronizeRepresentation();
}
ImageFilter filter = FiltersManager.getManager().getFilterForRepresentation(representation);
filter.useRepresentation(representation);