summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolasroard <nicolasroard@google.com>2013-04-01 21:33:20 -0700
committernicolasroard <nicolasroard@google.com>2013-04-01 22:29:42 -0700
commit187a09a330f9c62783741b85b86b12610b2f595d (patch)
treeab51ef82c50e6ba17cec3e682e9021a35d49030c
parent2b28723e58966471cde60d9452cc90e860df1d20 (diff)
downloadandroid_packages_apps_Snap-187a09a330f9c62783741b85b86b12610b2f595d.tar.gz
android_packages_apps_Snap-187a09a330f9c62783741b85b86b12610b2f595d.tar.bz2
android_packages_apps_Snap-187a09a330f9c62783741b85b86b12610b2f595d.zip
Fix stickiness issues with UI
The renderGeometryIcon() function shouldn't be synchronized -- it's independent of the rest of the pipeline and is only used to apply a given geometry. Change-Id: I91a5d2ec3f28f15c489066ed2c5a5009e29fa7b3
-rw-r--r--src/com/android/gallery3d/filtershow/cache/CachingPipeline.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/com/android/gallery3d/filtershow/cache/CachingPipeline.java b/src/com/android/gallery3d/filtershow/cache/CachingPipeline.java
index 752e1c2f8..8c312a92b 100644
--- a/src/com/android/gallery3d/filtershow/cache/CachingPipeline.java
+++ b/src/com/android/gallery3d/filtershow/cache/CachingPipeline.java
@@ -23,6 +23,7 @@ import android.support.v8.renderscript.Allocation;
import android.support.v8.renderscript.RenderScript;
import android.util.Log;
import com.android.gallery3d.filtershow.filters.FiltersManager;
+import com.android.gallery3d.filtershow.filters.ImageFilterGeometry;
import com.android.gallery3d.filtershow.filters.ImageFilterRS;
import com.android.gallery3d.filtershow.imageshow.GeometryMetadata;
import com.android.gallery3d.filtershow.imageshow.MasterImage;
@@ -57,6 +58,8 @@ public class CachingPipeline {
private volatile float mHighResPreviewScaleFactor = 1.0f;
private volatile String mName = "";
+ private ImageFilterGeometry mGeometry = null;
+
public CachingPipeline(FiltersManager filtersManager, String name) {
mFiltersManager = filtersManager;
mName = name;
@@ -302,16 +305,15 @@ public class CachingPipeline {
}
}
- public synchronized Bitmap renderGeometryIcon(Bitmap bitmap, ImagePreset preset) {
- synchronized (CachingPipeline.class) {
- if (getRenderScriptContext() == null) {
- return bitmap;
- }
- setupEnvironment(preset, false);
- mEnvironment.setQuality(ImagePreset.QUALITY_PREVIEW);
- bitmap = preset.applyGeometry(bitmap, mEnvironment);
- return bitmap;
+ public Bitmap renderGeometryIcon(Bitmap bitmap, ImagePreset preset) {
+ // Called by RenderRequest on the main thread
+ // TODO: change this -- we should reuse a pool of bitmaps instead...
+ if (mGeometry == null) {
+ mGeometry = new ImageFilterGeometry();
}
+ mGeometry.useRepresentation(preset.getGeometry());
+ return mGeometry.apply(bitmap, mPreviewScaleFactor,
+ ImagePreset.QUALITY_PREVIEW);
}
public synchronized void compute(TripleBufferBitmap buffer, ImagePreset preset, int type) {