OSDN Git Service

Fix copies / undo manager issues in filters
authornicolasroard <nicolasroard@google.com>
Thu, 15 Aug 2013 22:35:53 +0000 (15:35 -0700)
committernicolasroard <nicolasroard@google.com>
Thu, 15 Aug 2013 22:35:53 +0000 (15:35 -0700)
Change-Id: Icc7671ccfe52a2519ad8f4833e746768ec97cff8

src/com/android/gallery3d/filtershow/FilterShowActivity.java
src/com/android/gallery3d/filtershow/filters/FilterVignetteRepresentation.java
src/com/android/gallery3d/filtershow/history/HistoryItem.java

index d90dd61..61f7e68 100644 (file)
@@ -596,6 +596,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
         ImagePreset copy = new ImagePreset(oldPreset);
         FilterRepresentation representation = copy.getRepresentation(filterRepresentation);
         if (representation == null) {
+            filterRepresentation = filterRepresentation.copy();
             copy.addFilter(filterRepresentation);
         } else if (filterRepresentation.getFilterType() == FilterRepresentation.TYPE_GEOMETRY) {
             representation.useParametersFrom(filterRepresentation);
index 42a7406..8429d3b 100644 (file)
@@ -51,6 +51,11 @@ public class FilterVignetteRepresentation extends FilterBasicRepresentation impl
     }
 
     @Override
+    public String toString() {
+        return getName() + " : " + mCenterX + ", " + mCenterY + " radius: " + mRadiusX;
+    }
+
+    @Override
     public FilterRepresentation copy() {
         FilterVignetteRepresentation representation = new FilterVignetteRepresentation();
         copyAllParameters(representation);
index 2baaac3..80da330 100644 (file)
@@ -28,7 +28,7 @@ public class HistoryItem {
     private Bitmap mPreviewImage;
 
     public HistoryItem(ImagePreset preset, FilterRepresentation representation) {
-        mImagePreset = new ImagePreset(preset);
+        mImagePreset = preset; // just keep a pointer to the current preset
         if (representation != null) {
             mFilterRepresentation = representation.copy();
         }