summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/pipeline
diff options
context:
space:
mode:
authornicolasroard <nicolasroard@google.com>2013-09-20 18:49:41 -0700
committernicolasroard <nicolasroard@google.com>2013-09-20 18:51:47 -0700
commit3bc6e6f3b5ac0bb989c5e2f1580bdb40ead5dc25 (patch)
treed9a87bd5d82cee90f5f7d7d049c83fec7462e9a1 /src/com/android/gallery3d/filtershow/pipeline
parent6904a72d84d6662c00be83186468600f84448590 (diff)
downloadandroid_packages_apps_Gallery2-3bc6e6f3b5ac0bb989c5e2f1580bdb40ead5dc25.tar.gz
android_packages_apps_Gallery2-3bc6e6f3b5ac0bb989c5e2f1580bdb40ead5dc25.tar.bz2
android_packages_apps_Gallery2-3bc6e6f3b5ac0bb989c5e2f1580bdb40ead5dc25.zip
Fix crash / jank / presets add
- don't cache immutable bitmaps - fix junk in anims/zoom/constrain - fix edge glow when moving - fix double-tap zoom - fix presets / user presets adds - fix state panel names for geometry ops bug:10803026 Change-Id: I9328d7005d3ecee3566c104c3392de9325c50b74
Diffstat (limited to 'src/com/android/gallery3d/filtershow/pipeline')
-rw-r--r--src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java56
1 files changed, 10 insertions, 46 deletions
diff --git a/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java b/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java
index bc4ce0cfe..7b8f1b3b5 100644
--- a/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java
+++ b/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java
@@ -351,17 +351,13 @@ public class ImagePreset {
&& preset.contains(FilterRepresentation.TYPE_FX)) {
FilterRepresentation rep = preset.getFilterRepresentationForType(
FilterRepresentation.TYPE_FX);
- removeFilter(rep);
- if (!isNoneBorderFilter(rep)) {
- mFilters.add(rep);
- }
+ addFilter(rep);
} else {
// user preset replaces everything
mFilters.clear();
for (int i = 0; i < preset.nbFilters(); i++) {
addFilter(preset.getFilterRepresentation(i));
}
- mFilters.add(representation);
}
} else if (representation.getFilterType() == FilterRepresentation.TYPE_GEOMETRY) {
// Add geometry filter, removing duplicates and do-nothing operations.
@@ -386,52 +382,20 @@ public class ImagePreset {
mFilters.add(representation);
}
} else if (representation.getFilterType() == FilterRepresentation.TYPE_FX) {
- boolean found = false;
+ boolean replaced = false;
for (int i = 0; i < mFilters.size(); i++) {
FilterRepresentation current = mFilters.elementAt(i);
- int type = current.getFilterType();
- if (found) {
- if (type != FilterRepresentation.TYPE_VIGNETTE) {
- mFilters.remove(i);
- continue;
- }
- }
- if (type == FilterRepresentation.TYPE_FX) {
- if (current instanceof FilterUserPresetRepresentation) {
- ImagePreset preset = ((FilterUserPresetRepresentation) current)
- .getImagePreset();
- // If we had an existing user preset, let's remove all the presets that
- // were added by it
- for (int j = 0; j < preset.nbFilters(); j++) {
- FilterRepresentation rep = preset.getFilterRepresentation(j);
- int pos = getPositionForRepresentation(rep);
- if (pos != -1) {
- mFilters.remove(pos);
- }
- }
- int pos = getPositionForRepresentation(current);
- if (pos != -1) {
- mFilters.remove(pos);
- } else {
- pos = 0;
- }
- if (!isNoneFxFilter(representation)) {
- mFilters.add(pos, representation);
- }
-
- } else {
- mFilters.remove(i);
- if (!isNoneFxFilter(representation)) {
- mFilters.add(i, representation);
- }
+ if (current.getFilterType() == FilterRepresentation.TYPE_FX) {
+ mFilters.remove(i);
+ replaced = true;
+ if (!isNoneBorderFilter(representation)) {
+ mFilters.add(i, representation);
}
- found = true;
+ break;
}
}
- if (!found) {
- if (!isNoneFxFilter(representation)) {
- mFilters.add(representation);
- }
+ if (!replaced) {
+ mFilters.add(0, representation);
}
} else {
mFilters.add(representation);