summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d
diff options
context:
space:
mode:
authornicolasroard <nicolasroard@google.com>2013-03-11 19:16:03 -0700
committernicolasroard <nicolasroard@google.com>2013-03-11 19:22:46 -0700
commit1440e7564079e4e6e54216e0ed80c809a3cec421 (patch)
tree1462a428a890344445f3c91071963db244c43230 /src/com/android/gallery3d
parentbced6706a5c0a383e6cb9c5b9b7ddf4dd11f1a1d (diff)
downloadandroid_packages_apps_Snap-1440e7564079e4e6e54216e0ed80c809a3cec421.tar.gz
android_packages_apps_Snap-1440e7564079e4e6e54216e0ed80c809a3cec421.tar.bz2
android_packages_apps_Snap-1440e7564079e4e6e54216e0ed80c809a3cec421.zip
Various bugfixes/improvements for Fx Filters:
- fix bug in history with Fx filters - don't load Fx bitmaps at startup - free bitmaps when unneeded - fix history preview bitmaps Change-Id: I5631a5bcec12c121871b3575066c201486896a14
Diffstat (limited to 'src/com/android/gallery3d')
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java26
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java6
-rw-r--r--src/com/android/gallery3d/filtershow/presets/ImagePreset.java2
3 files changed, 19 insertions, 15 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java
index d4128dc79..6e2e7ea16 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java
@@ -17,10 +17,11 @@
package com.android.gallery3d.filtershow.filters;
import android.graphics.Bitmap;
+import com.android.gallery3d.app.Log;
import com.android.gallery3d.filtershow.editors.ImageOnlyEditor;
public class FilterFxRepresentation extends FilterRepresentation {
- private Bitmap mFxBitmap = null;
+ private static final String LOGTAG = "FilterFxRepresentation";
// TODO: When implementing serialization, we should find a unique way of
// specifying bitmaps / names (the resource IDs being random)
private int mBitmapResource = 0;
@@ -41,26 +42,24 @@ public class FilterFxRepresentation extends FilterRepresentation {
}
public String toString() {
- return "FilterFx: " + getName();
+ return "FilterFx: " + hashCode() + " : " + getName() + " bitmap rsc: " + mBitmapResource;
}
@Override
- public FilterRepresentation clone() throws CloneNotSupportedException {
+ public synchronized FilterRepresentation clone() throws CloneNotSupportedException {
FilterFxRepresentation representation = (FilterFxRepresentation) super.clone();
representation.setName(getName());
representation.setBitmapResource(getBitmapResource());
representation.setNameResource(getNameResource());
- representation.setFxBitmap(getFxBitmap());
return representation;
}
- public void useParametersFrom(FilterRepresentation a) {
+ public synchronized void useParametersFrom(FilterRepresentation a) {
if (a instanceof FilterFxRepresentation) {
FilterFxRepresentation representation = (FilterFxRepresentation) a;
setName(representation.getName());
setBitmapResource(representation.getBitmapResource());
setNameResource(representation.getNameResource());
- setFxBitmap(representation.getFxBitmap());
}
}
@@ -79,16 +78,15 @@ public class FilterFxRepresentation extends FilterRepresentation {
return false;
}
- public boolean allowsMultipleInstances() {
- return true;
- }
-
- public Bitmap getFxBitmap() {
- return mFxBitmap;
+ public boolean same(FilterRepresentation representation) {
+ if (!super.same(representation)) {
+ return false;
+ }
+ return equals(representation);
}
- public void setFxBitmap(Bitmap fxBitmap) {
- mFxBitmap = fxBitmap;
+ public boolean allowsMultipleInstances() {
+ return true;
}
public int getNameResource() {
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
index e0dc905e3..b92460d99 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
@@ -21,6 +21,7 @@ import com.android.gallery3d.filtershow.editors.BasicEditor;
public class FilterRepresentation implements Cloneable {
private static final String LOGTAG = "FilterRepresentation";
+ private static final boolean DEBUG = false;
private String mName;
private int mPriority = TYPE_NORMAL;
private Class mFilterClass;
@@ -62,7 +63,10 @@ public class FilterRepresentation implements Cloneable {
representation.setShowEditingControls(showEditingControls());
representation.setShowParameterValue(showParameterValue());
representation.setShowUtilityPanel(showUtilityPanel());
- Log.v(LOGTAG, "cloning from <" + this + "> to <" + representation + ">");
+ representation.mTempRepresentation = null;
+ if (DEBUG) {
+ Log.v(LOGTAG, "cloning from <" + this + "> to <" + representation + ">");
+ }
return representation;
}
diff --git a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java
index 87d9c8183..e27afe580 100644
--- a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java
+++ b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java
@@ -54,6 +54,7 @@ public class ImagePreset {
public final GeometryMetadata mGeoData = new GeometryMetadata();
private boolean mPartialRendering = false;
private Rect mPartialRenderingBounds;
+
private Bitmap mPreviewImage;
private FilterEnvironment mEnvironment = new FilterEnvironment();
@@ -90,6 +91,7 @@ public class ImagePreset {
mHistoryName = source.name();
mIsFxPreset = source.isFx();
mImageLoader = source.getImageLoader();
+ mPreviewImage = source.getPreviewImage();
mGeoData.set(source.mGeoData);
}