summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java
diff options
context:
space:
mode:
authornicolasroard <nicolasroard@google.com>2013-07-30 20:01:21 -0700
committernicolasroard <nicolasroard@google.com>2013-07-31 15:16:59 -0700
commit7f2b1e548ad3b5cdf8775b0a12f8f9b389477f21 (patch)
tree91e880d9905ff2a0307ab58d539d57add0158b55 /src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java
parent6d29a648f497f827d623d7af0b679e98ea58bf90 (diff)
downloadandroid_packages_apps_Snap-7f2b1e548ad3b5cdf8775b0a12f8f9b389477f21.tar.gz
android_packages_apps_Snap-7f2b1e548ad3b5cdf8775b0a12f8f9b389477f21.tar.bz2
android_packages_apps_Snap-7f2b1e548ad3b5cdf8775b0a12f8f9b389477f21.zip
Implements N-1 Caching
Change-Id: Ief1a04dbe4f6ced15f937177a556733cfcdb5879
Diffstat (limited to 'src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java')
-rw-r--r--src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java b/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java
index 535d02f0b..beba993e5 100644
--- a/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java
+++ b/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java
@@ -24,11 +24,14 @@ import android.support.v8.renderscript.RenderScript;
import android.util.Log;
import com.android.gallery3d.filtershow.cache.ImageLoader;
+import com.android.gallery3d.filtershow.filters.FilterRepresentation;
import com.android.gallery3d.filtershow.filters.FiltersManager;
import com.android.gallery3d.filtershow.filters.ImageFilterGeometry;
import com.android.gallery3d.filtershow.imageshow.GeometryMetadata;
import com.android.gallery3d.filtershow.imageshow.MasterImage;
+import java.util.Vector;
+
public class CachingPipeline implements PipelineInterface {
private static final String LOGTAG = "CachingPipeline";
private boolean DEBUG = false;
@@ -43,6 +46,8 @@ public class CachingPipeline implements PipelineInterface {
private volatile Bitmap mResizedOriginalBitmap = null;
private FilterEnvironment mEnvironment = new FilterEnvironment();
+ private CacheProcessing mCachedProcessing = new CacheProcessing();
+
private volatile Allocation mOriginalAllocation = null;
private volatile Allocation mFiltersOnlyOriginalAllocation = null;
@@ -338,7 +343,17 @@ public class CachingPipeline implements PipelineInterface {
FilterEnvironment.QUALITY_PREVIEW);
}
- public synchronized void compute(SharedBuffer buffer, ImagePreset preset, int type) {
+ public void compute(SharedBuffer buffer, ImagePreset preset, int type) {
+ if (getRenderScriptContext() == null) {
+ return;
+ }
+ setupEnvironment(preset, false);
+ Vector<FilterRepresentation> filters = preset.getFilters();
+ Bitmap result = mCachedProcessing.process(mOriginalBitmap, filters, mEnvironment);
+ buffer.setProducer(result);
+ }
+
+ public synchronized void computeOld(SharedBuffer buffer, ImagePreset preset, int type) {
synchronized (CachingPipeline.class) {
if (getRenderScriptContext() == null) {
return;