summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/pipeline/Buffer.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/gallery3d/filtershow/pipeline/Buffer.java')
-rw-r--r--src/com/android/gallery3d/filtershow/pipeline/Buffer.java22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/filtershow/pipeline/Buffer.java b/src/com/android/gallery3d/filtershow/pipeline/Buffer.java
index 72685167a..c6dbdb75a 100644
--- a/src/com/android/gallery3d/filtershow/pipeline/Buffer.java
+++ b/src/com/android/gallery3d/filtershow/pipeline/Buffer.java
@@ -20,16 +20,21 @@ import android.graphics.Bitmap;
import android.support.v8.renderscript.Allocation;
import android.support.v8.renderscript.RenderScript;
import com.android.gallery3d.filtershow.cache.CachingPipeline;
+import com.android.gallery3d.filtershow.presets.ImagePreset;
public class Buffer {
+ private static final String LOGTAG = "Buffer";
private Bitmap mBitmap;
private Allocation mAllocation;
private boolean mUseAllocation = false;
private static final Bitmap.Config BITMAP_CONFIG = Bitmap.Config.ARGB_8888;
+ private ImagePreset mPreset;
public Buffer(Bitmap bitmap) {
RenderScript rs = CachingPipeline.getRenderScriptContext();
- mBitmap = bitmap.copy(BITMAP_CONFIG, true);
+ if (bitmap != null) {
+ mBitmap = bitmap.copy(BITMAP_CONFIG, true);
+ }
if (mUseAllocation) {
// TODO: recreate the allocation when the RS context changes
mAllocation = Allocation.createFromBitmap(rs, mBitmap,
@@ -38,6 +43,10 @@ public class Buffer {
}
}
+ public void setBitmap(Bitmap bitmap) {
+ mBitmap = bitmap.copy(BITMAP_CONFIG, true);
+ }
+
public Bitmap getBitmap() {
return mBitmap;
}
@@ -52,5 +61,16 @@ public class Buffer {
}
}
+ public ImagePreset getPreset() {
+ return mPreset;
+ }
+
+ public void setPreset(ImagePreset preset) {
+ if ((mPreset == null) || (!mPreset.same(preset))) {
+ mPreset = new ImagePreset(preset);
+ } else {
+ mPreset.updateWith(preset);
+ }
+ }
}