From 650712e4615d4bbc25b07c11babfe824d7fb6f64 Mon Sep 17 00:00:00 2001 From: cretin45 Date: Mon, 15 Dec 2014 16:52:42 -0800 Subject: Gallery2: Fix filtershow renderscript for lollipop * Use the non support version Change-Id: Idce8f3f4741def8dcd080f226cd9a0ef909f7eb1 --- .../android/gallery3d/filtershow/filters/ImageFilter.java | 2 +- .../gallery3d/filtershow/filters/ImageFilterChanSat.java | 14 +++++++------- .../gallery3d/filtershow/filters/ImageFilterGrad.java | 15 ++++++++------- .../gallery3d/filtershow/filters/ImageFilterRS.java | 8 +++++--- .../gallery3d/filtershow/filters/ImageFilterSharpen.java | 2 +- .../gallery3d/filtershow/filters/ImageFilterVignette.java | 9 +++------ src/com/android/gallery3d/filtershow/pipeline/Buffer.java | 4 ++-- .../gallery3d/filtershow/pipeline/CachingPipeline.java | 5 +++-- .../gallery3d/filtershow/pipeline/FilterEnvironment.java | 2 +- .../gallery3d/filtershow/pipeline/ImagePreset.java | 2 +- .../gallery3d/filtershow/pipeline/PipelineInterface.java | 4 ++-- 11 files changed, 34 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilter.java b/src/com/android/gallery3d/filtershow/filters/ImageFilter.java index 437137416..1fcd3008c 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilter.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilter.java @@ -19,7 +19,7 @@ package com.android.gallery3d.filtershow.filters; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.Matrix; -import android.support.v8.renderscript.Allocation; +import android.renderscript.Allocation; import android.widget.Toast; import com.android.gallery3d.filtershow.imageshow.GeometryMathUtils; diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterChanSat.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterChanSat.java index 1ea8edfb8..6c48a6a9f 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterChanSat.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterChanSat.java @@ -18,11 +18,11 @@ package com.android.gallery3d.filtershow.filters; import android.graphics.Bitmap; import android.graphics.Matrix; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.Element; -import android.support.v8.renderscript.RenderScript; -import android.support.v8.renderscript.Script.LaunchOptions; -import android.support.v8.renderscript.Type; +import android.renderscript.Allocation; +import android.renderscript.Element; +import android.renderscript.RenderScript; +import android.renderscript.Script; +import android.renderscript.Type; import com.android.gallery3d.R; import com.android.gallery3d.filtershow.pipeline.FilterEnvironment; @@ -77,7 +77,7 @@ public class ImageFilterChanSat extends ImageFilterRS { Type.Builder tb_float = new Type.Builder(rsCtx, Element.F32_4(rsCtx)); tb_float.setX(in.getType().getX()); tb_float.setY(in.getType().getY()); - mScript = new ScriptC_saturation(rsCtx, res, R.raw.saturation); + mScript = new ScriptC_saturation(rsCtx); } @@ -132,7 +132,7 @@ public class ImageFilterChanSat extends ImageFilterRS { int width = in.getType().getX(); int height = in.getType().getY(); - LaunchOptions options = new LaunchOptions(); + Script.LaunchOptions options = new Script.LaunchOptions(); int ty; options.setX(0, width); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterGrad.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterGrad.java index cbdfaa623..7f10af990 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterGrad.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterGrad.java @@ -26,11 +26,12 @@ import com.android.gallery3d.filtershow.pipeline.FilterEnvironment; import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.Matrix; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.Element; -import android.support.v8.renderscript.RenderScript; -import android.support.v8.renderscript.Script.LaunchOptions; -import android.support.v8.renderscript.Type; + +import android.renderscript.Allocation; +import android.renderscript.Element; +import android.renderscript.RenderScript; +import android.renderscript.Script; +import android.renderscript.Type; import android.util.Log; import com.android.gallery3d.R; @@ -87,7 +88,7 @@ public class ImageFilterGrad extends ImageFilterRS { Type.Builder tb_float = new Type.Builder(rsCtx, Element.F32_4(rsCtx)); tb_float.setX(in.getType().getX()); tb_float.setY(in.getType().getY()); - mScript = new ScriptC_grad(rsCtx, res, R.raw.grad); + mScript = new ScriptC_grad(rsCtx); } @@ -161,7 +162,7 @@ public class ImageFilterGrad extends ImageFilterRS { int width = in.getType().getX(); int height = in.getType().getY(); - LaunchOptions options = new LaunchOptions(); + Script.LaunchOptions options = new Script.LaunchOptions(); int ty; options.setX(0, width); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java index 9a494d823..b7c4d80e0 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java @@ -18,7 +18,10 @@ package com.android.gallery3d.filtershow.filters; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.support.v8.renderscript.*; +import android.renderscript.Allocation; +import android.renderscript.Element; +import android.renderscript.RenderScript; +import android.renderscript.Type; import android.util.Log; import android.content.res.Resources; import com.android.gallery3d.R; @@ -159,8 +162,7 @@ public abstract class ImageFilterRS extends ImageFilter { private static Allocation convertRGBAtoA(RenderScript RS, Bitmap bitmap) { if (RS != mRScache || mGreyConvert == null) { - mGreyConvert = new ScriptC_grey(RS, RS.getApplicationContext().getResources(), - R.raw.grey); + mGreyConvert = new ScriptC_grey(RS); mRScache = RS; } diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java index 418afc40f..bfec89f6b 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java @@ -64,7 +64,7 @@ public class ImageFilterSharpen extends ImageFilterRS { protected void createFilter(android.content.res.Resources res, float scaleFactor, int quality) { if (mScript == null) { - mScript = new ScriptC_convolve3x3(getRenderScriptContext(), res, R.raw.convolve3x3); + mScript = new ScriptC_convolve3x3(getRenderScriptContext()); } } diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java index 49ac5959c..279bd1857 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java @@ -24,11 +24,8 @@ import android.graphics.Rect; import com.android.gallery3d.R; import com.android.gallery3d.filtershow.imageshow.MasterImage; import com.android.gallery3d.filtershow.pipeline.FilterEnvironment; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.Element; -import android.support.v8.renderscript.RenderScript; -import android.support.v8.renderscript.Script.LaunchOptions; -import android.support.v8.renderscript.Type; + +import android.renderscript.RenderScript; import android.util.Log; public class ImageFilterVignette extends ImageFilterRS { @@ -79,7 +76,7 @@ public class ImageFilterVignette extends ImageFilterRS { protected void createFilter(Resources res, float scaleFactor, int quality) { RenderScript rsCtx = getRenderScriptContext(); - mScript = new ScriptC_vignette(rsCtx, res, R.raw.vignette); + mScript = new ScriptC_vignette(rsCtx); } @Override diff --git a/src/com/android/gallery3d/filtershow/pipeline/Buffer.java b/src/com/android/gallery3d/filtershow/pipeline/Buffer.java index c378eb994..a487a5d8d 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/Buffer.java +++ b/src/com/android/gallery3d/filtershow/pipeline/Buffer.java @@ -18,8 +18,8 @@ package com.android.gallery3d.filtershow.pipeline; import android.graphics.Bitmap; import android.graphics.Canvas; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.RenderScript; +import android.renderscript.Allocation; +import android.renderscript.RenderScript; import android.util.Log; import com.android.gallery3d.filtershow.cache.BitmapCache; import com.android.gallery3d.filtershow.imageshow.MasterImage; diff --git a/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java b/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java index 8ae9a7c7b..e8c9b0f5c 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java +++ b/src/com/android/gallery3d/filtershow/pipeline/CachingPipeline.java @@ -24,8 +24,9 @@ import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.RectF; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.RenderScript; + +import android.renderscript.Allocation; +import android.renderscript.RenderScript; import android.util.Log; import com.android.gallery3d.filtershow.cache.BitmapCache; diff --git a/src/com/android/gallery3d/filtershow/pipeline/FilterEnvironment.java b/src/com/android/gallery3d/filtershow/pipeline/FilterEnvironment.java index ebf83b720..0b84f5203 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/FilterEnvironment.java +++ b/src/com/android/gallery3d/filtershow/pipeline/FilterEnvironment.java @@ -18,7 +18,7 @@ package com.android.gallery3d.filtershow.pipeline; import android.graphics.Bitmap; import android.graphics.Canvas; -import android.support.v8.renderscript.Allocation; +import android.renderscript.Allocation; import com.android.gallery3d.app.Log; import com.android.gallery3d.filtershow.cache.BitmapCache; diff --git a/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java b/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java index 18321f567..1460ad434 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java +++ b/src/com/android/gallery3d/filtershow/pipeline/ImagePreset.java @@ -18,7 +18,7 @@ package com.android.gallery3d.filtershow.pipeline; import android.graphics.Bitmap; import android.graphics.Rect; -import android.support.v8.renderscript.Allocation; +import android.renderscript.Allocation; import android.util.JsonReader; import android.util.JsonWriter; import android.util.Log; diff --git a/src/com/android/gallery3d/filtershow/pipeline/PipelineInterface.java b/src/com/android/gallery3d/filtershow/pipeline/PipelineInterface.java index d53768c95..ad59e0c44 100644 --- a/src/com/android/gallery3d/filtershow/pipeline/PipelineInterface.java +++ b/src/com/android/gallery3d/filtershow/pipeline/PipelineInterface.java @@ -18,8 +18,8 @@ package com.android.gallery3d.filtershow.pipeline; import android.content.res.Resources; import android.graphics.Bitmap; -import android.support.v8.renderscript.Allocation; -import android.support.v8.renderscript.RenderScript; +import android.renderscript.Allocation; +import android.renderscript.RenderScript; public interface PipelineInterface { public String getName(); -- cgit v1.2.3