diff options
Diffstat (limited to 'rs')
41 files changed, 322 insertions, 171 deletions
diff --git a/rs/java/android/renderscript/Allocation.java b/rs/java/android/renderscript/Allocation.java index c2bab91..2191b54 100644 --- a/rs/java/android/renderscript/Allocation.java +++ b/rs/java/android/renderscript/Allocation.java @@ -16,16 +16,12 @@ package android.renderscript; -import java.io.IOException; -import java.io.InputStream; import java.util.HashMap; import android.content.res.Resources; -import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.view.Surface; import android.util.Log; -import android.util.TypedValue; import android.graphics.Canvas; import android.os.Trace; @@ -602,7 +598,6 @@ public class Allocation extends BaseObj { * without reinterpretation. * * @param array The source data array - * @hide */ public void copyFromUnchecked(Object array) { Trace.traceBegin(RenderScript.TRACE_TAG, "copyFromUnchecked"); @@ -662,8 +657,7 @@ public class Allocation extends BaseObj { * android.renderscript.Element} does not match the array's * primitive type. * - * @param d the source data array - * @hide + * @param array The source data array */ public void copyFrom(Object array) { Trace.traceBegin(RenderScript.TRACE_TAG, "copyFrom"); @@ -862,7 +856,6 @@ public class Allocation extends BaseObj { * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. * @param array The source data array - * @hide */ public void copy1DRangeFromUnchecked(int off, int count, Object array) { copy1DRangeFromUnchecked(off, count, array, @@ -927,7 +920,6 @@ public class Allocation extends BaseObj { * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. * @param array The source data array. - * @hide */ public void copy1DRangeFrom(int off, int count, Object array) { copy1DRangeFromUnchecked(off, count, array, @@ -1043,8 +1035,7 @@ public class Allocation extends BaseObj { * @param yoff Y offset of the region to update in this Allocation * @param w Width of the region to update * @param h Height of the region to update - * @param data to be placed into the Allocation - * @hide + * @param array Data to be placed into the Allocation */ public void copy2DRangeFrom(int xoff, int yoff, int w, int h, Object array) { Trace.traceBegin(RenderScript.TRACE_TAG, "copy2DRangeFrom"); @@ -1274,7 +1265,6 @@ public class Allocation extends BaseObj { * type of the array passed in. * * @param array The array to be set from the Allocation. - * @hide */ public void copyTo(Object array) { copyTo(array, validateObjectIsPrimitiveArray(array, true), @@ -1876,4 +1866,3 @@ public class Allocation extends BaseObj { } } - diff --git a/rs/java/android/renderscript/AllocationAdapter.java b/rs/java/android/renderscript/AllocationAdapter.java index b77d087..6c1b1ed 100644 --- a/rs/java/android/renderscript/AllocationAdapter.java +++ b/rs/java/android/renderscript/AllocationAdapter.java @@ -16,11 +16,6 @@ package android.renderscript; -import android.content.res.Resources; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.util.TypedValue; - /** * Only intended for use by generated reflected code. * diff --git a/rs/java/android/renderscript/Byte2.java b/rs/java/android/renderscript/Byte2.java index f796de3..3ad79e4 100644 --- a/rs/java/android/renderscript/Byte2.java +++ b/rs/java/android/renderscript/Byte2.java @@ -16,9 +16,6 @@ package android.renderscript; -import java.lang.Math; -import android.util.Log; - /** * Class for exposing the native RenderScript byte2 type back to the Android system. diff --git a/rs/java/android/renderscript/Byte3.java b/rs/java/android/renderscript/Byte3.java index f2a95ac..a138313 100644 --- a/rs/java/android/renderscript/Byte3.java +++ b/rs/java/android/renderscript/Byte3.java @@ -16,9 +16,6 @@ package android.renderscript; -import java.lang.Math; -import android.util.Log; - /** * Class for exposing the native RenderScript byte3 type back to the Android system. diff --git a/rs/java/android/renderscript/Byte4.java b/rs/java/android/renderscript/Byte4.java index b8a8a6b..fa4c13d 100644 --- a/rs/java/android/renderscript/Byte4.java +++ b/rs/java/android/renderscript/Byte4.java @@ -16,9 +16,6 @@ package android.renderscript; -import java.lang.Math; -import android.util.Log; - /** * Class for exposing the native RenderScript byte4 type back to the Android system. diff --git a/rs/java/android/renderscript/Element.java b/rs/java/android/renderscript/Element.java index 2932770..93e839e 100644 --- a/rs/java/android/renderscript/Element.java +++ b/rs/java/android/renderscript/Element.java @@ -16,9 +16,6 @@ package android.renderscript; -import java.lang.reflect.Field; -import android.util.Log; - /** * <p>An Element represents one item within an {@link * android.renderscript.Allocation}. An Element is roughly equivalent to a C diff --git a/rs/java/android/renderscript/FieldPacker.java b/rs/java/android/renderscript/FieldPacker.java index cf20e63..723ab24 100644 --- a/rs/java/android/renderscript/FieldPacker.java +++ b/rs/java/android/renderscript/FieldPacker.java @@ -16,7 +16,6 @@ package android.renderscript; -import android.util.Log; import java.util.BitSet; /** diff --git a/rs/java/android/renderscript/FileA3D.java b/rs/java/android/renderscript/FileA3D.java index 04bc7c6..4164810 100644 --- a/rs/java/android/renderscript/FileA3D.java +++ b/rs/java/android/renderscript/FileA3D.java @@ -17,15 +17,10 @@ package android.renderscript; import java.io.File; -import java.io.IOException; import java.io.InputStream; import android.content.res.AssetManager; import android.content.res.Resources; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.util.Log; -import android.util.TypedValue; /** * @hide diff --git a/rs/java/android/renderscript/Float2.java b/rs/java/android/renderscript/Float2.java index 26193d2..e9f8ca7 100644 --- a/rs/java/android/renderscript/Float2.java +++ b/rs/java/android/renderscript/Float2.java @@ -26,7 +26,7 @@ public class Float2 { public Float2() { } - /** @hide */ + /** @hide */ public Float2(Float2 data) { this.x = data.x; this.y = data.y; diff --git a/rs/java/android/renderscript/Font.java b/rs/java/android/renderscript/Font.java index cfd11c0..b22aeb7 100644 --- a/rs/java/android/renderscript/Font.java +++ b/rs/java/android/renderscript/Font.java @@ -17,7 +17,6 @@ package android.renderscript; import java.io.File; -import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; @@ -26,8 +25,6 @@ import android.os.Environment; import android.content.res.AssetManager; import android.content.res.Resources; -import android.util.Log; -import android.util.TypedValue; /** * @hide diff --git a/rs/java/android/renderscript/Int3.java b/rs/java/android/renderscript/Int3.java index c770395..5431b9a 100644 --- a/rs/java/android/renderscript/Int3.java +++ b/rs/java/android/renderscript/Int3.java @@ -27,7 +27,7 @@ public class Int3 { public Int3() { } - + /** @hide */ public Int3(int i) { this.x = this.y = this.z = i; diff --git a/rs/java/android/renderscript/Long3.java b/rs/java/android/renderscript/Long3.java index 88ff855..8e243cc 100644 --- a/rs/java/android/renderscript/Long3.java +++ b/rs/java/android/renderscript/Long3.java @@ -27,7 +27,7 @@ public class Long3 { public Long3() { } - + /** @hide */ public Long3(long i) { this.x = this.y = this.z = i; diff --git a/rs/java/android/renderscript/Matrix2f.java b/rs/java/android/renderscript/Matrix2f.java index d3621fa..048262d 100644 --- a/rs/java/android/renderscript/Matrix2f.java +++ b/rs/java/android/renderscript/Matrix2f.java @@ -16,9 +16,6 @@ package android.renderscript; -import java.lang.Math; -import android.util.Log; - /** * Class for exposing the native RenderScript rs_matrix2x2 type back to the Android system. diff --git a/rs/java/android/renderscript/Matrix3f.java b/rs/java/android/renderscript/Matrix3f.java index 8c3c330..9a4af77 100644 --- a/rs/java/android/renderscript/Matrix3f.java +++ b/rs/java/android/renderscript/Matrix3f.java @@ -16,9 +16,6 @@ package android.renderscript; -import java.lang.Math; -import android.util.Log; - /** * Class for exposing the native RenderScript rs_matrix3x3 type back to the Android system. diff --git a/rs/java/android/renderscript/Matrix4f.java b/rs/java/android/renderscript/Matrix4f.java index cd18e30..5d5bf5f 100644 --- a/rs/java/android/renderscript/Matrix4f.java +++ b/rs/java/android/renderscript/Matrix4f.java @@ -17,7 +17,6 @@ package android.renderscript; import java.lang.Math; -import android.util.Log; /** diff --git a/rs/java/android/renderscript/Mesh.java b/rs/java/android/renderscript/Mesh.java index 9ce3fb2..a4ecc38 100644 --- a/rs/java/android/renderscript/Mesh.java +++ b/rs/java/android/renderscript/Mesh.java @@ -18,8 +18,6 @@ package android.renderscript; import java.util.Vector; -import android.util.Log; - /** * @hide * @deprecated in API 16 diff --git a/rs/java/android/renderscript/Path.java b/rs/java/android/renderscript/Path.java index 5cc67de..f3502aa 100644 --- a/rs/java/android/renderscript/Path.java +++ b/rs/java/android/renderscript/Path.java @@ -16,9 +16,6 @@ package android.renderscript; -import java.util.Vector; -import android.util.Log; - /** * @hide * diff --git a/rs/java/android/renderscript/ProgramFragment.java b/rs/java/android/renderscript/ProgramFragment.java index 5e886a3..2704130 100644 --- a/rs/java/android/renderscript/ProgramFragment.java +++ b/rs/java/android/renderscript/ProgramFragment.java @@ -17,9 +17,6 @@ package android.renderscript; -import android.util.Log; - - /** * @hide * @deprecated in API 16 diff --git a/rs/java/android/renderscript/ProgramFragmentFixedFunction.java b/rs/java/android/renderscript/ProgramFragmentFixedFunction.java index 22aed0a..e1c35c5 100644 --- a/rs/java/android/renderscript/ProgramFragmentFixedFunction.java +++ b/rs/java/android/renderscript/ProgramFragmentFixedFunction.java @@ -17,9 +17,6 @@ package android.renderscript; -import android.util.Log; - - /** * @hide * @deprecated in API 16 diff --git a/rs/java/android/renderscript/ProgramRaster.java b/rs/java/android/renderscript/ProgramRaster.java index e294b05..8c7c9aa 100644 --- a/rs/java/android/renderscript/ProgramRaster.java +++ b/rs/java/android/renderscript/ProgramRaster.java @@ -17,9 +17,6 @@ package android.renderscript; -import android.util.Log; - - /** * @hide * @deprecated in API 16 diff --git a/rs/java/android/renderscript/ProgramStore.java b/rs/java/android/renderscript/ProgramStore.java index 969cc25..c0fa9c4 100644 --- a/rs/java/android/renderscript/ProgramStore.java +++ b/rs/java/android/renderscript/ProgramStore.java @@ -17,9 +17,6 @@ package android.renderscript; -import android.util.Log; - - /** * @hide * <p>ProgramStore contains a set of parameters that control how diff --git a/rs/java/android/renderscript/ProgramVertex.java b/rs/java/android/renderscript/ProgramVertex.java index b6886e1..d194ba9 100644 --- a/rs/java/android/renderscript/ProgramVertex.java +++ b/rs/java/android/renderscript/ProgramVertex.java @@ -39,10 +39,6 @@ package android.renderscript; -import android.graphics.Matrix; -import android.util.Log; - - /** * @hide * @deprecated in API 16 diff --git a/rs/java/android/renderscript/ProgramVertexFixedFunction.java b/rs/java/android/renderscript/ProgramVertexFixedFunction.java index c479c77..2d281b8 100644 --- a/rs/java/android/renderscript/ProgramVertexFixedFunction.java +++ b/rs/java/android/renderscript/ProgramVertexFixedFunction.java @@ -17,10 +17,6 @@ package android.renderscript; -import android.graphics.Matrix; -import android.util.Log; - - /** * @hide * @deprecated in API 16 diff --git a/rs/java/android/renderscript/RSSurfaceView.java b/rs/java/android/renderscript/RSSurfaceView.java index 308d97a..5db72d9 100644 --- a/rs/java/android/renderscript/RSSurfaceView.java +++ b/rs/java/android/renderscript/RSSurfaceView.java @@ -16,16 +16,8 @@ package android.renderscript; -import java.io.Writer; -import java.util.ArrayList; -import java.util.concurrent.Semaphore; - import android.content.Context; -import android.os.Handler; -import android.os.Message; import android.util.AttributeSet; -import android.util.Log; -import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceView; diff --git a/rs/java/android/renderscript/RSTextureView.java b/rs/java/android/renderscript/RSTextureView.java index 7eeeeae..af3258a 100644 --- a/rs/java/android/renderscript/RSTextureView.java +++ b/rs/java/android/renderscript/RSTextureView.java @@ -16,16 +16,9 @@ package android.renderscript; -import java.io.Writer; -import java.util.ArrayList; -import java.util.concurrent.Semaphore; - import android.content.Context; import android.graphics.SurfaceTexture; -import android.os.Handler; -import android.os.Message; import android.util.AttributeSet; -import android.util.Log; import android.view.TextureView; /** diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java index b211c5a..89dba9f 100644 --- a/rs/java/android/renderscript/RenderScript.java +++ b/rs/java/android/renderscript/RenderScript.java @@ -17,16 +17,12 @@ package android.renderscript; import java.io.File; -import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.concurrent.locks.ReentrantReadWriteLock; import android.content.Context; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager; import android.content.res.AssetManager; import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.graphics.SurfaceTexture; import android.os.Process; import android.util.Log; diff --git a/rs/java/android/renderscript/RenderScriptGL.java b/rs/java/android/renderscript/RenderScriptGL.java index c9cbe3e..714e835 100644 --- a/rs/java/android/renderscript/RenderScriptGL.java +++ b/rs/java/android/renderscript/RenderScriptGL.java @@ -16,17 +16,10 @@ package android.renderscript; -import java.lang.reflect.Field; - import android.content.Context; -import android.graphics.PixelFormat; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.graphics.SurfaceTexture; -import android.util.Log; import android.view.Surface; import android.view.SurfaceHolder; -import android.view.SurfaceView; /** * @hide diff --git a/rs/java/android/renderscript/Sampler.java b/rs/java/android/renderscript/Sampler.java index 8d0e29e..a4edbb5 100644 --- a/rs/java/android/renderscript/Sampler.java +++ b/rs/java/android/renderscript/Sampler.java @@ -16,17 +16,6 @@ package android.renderscript; - -import java.io.IOException; -import java.io.InputStream; - -import android.content.res.Resources; -import android.os.Bundle; -import android.util.Log; - -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; - /** * Sampler object that defines how Allocations can be read as textures within a * kernel. Samplers are used in conjunction with the {@code rsSample} runtime diff --git a/rs/java/android/renderscript/ScriptC.java b/rs/java/android/renderscript/ScriptC.java index cdb2b08..9e76f52 100644 --- a/rs/java/android/renderscript/ScriptC.java +++ b/rs/java/android/renderscript/ScriptC.java @@ -16,18 +16,11 @@ package android.renderscript; -import android.content.Context; import android.content.res.Resources; -import android.util.Log; import java.io.File; import java.io.IOException; import java.io.InputStream; -import java.util.Map.Entry; -import java.util.HashMap; - -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; /** * The superclass for all user-defined scripts. This is only diff --git a/rs/java/android/renderscript/ScriptGroup.java b/rs/java/android/renderscript/ScriptGroup.java index 48dba30..f1a7273 100644 --- a/rs/java/android/renderscript/ScriptGroup.java +++ b/rs/java/android/renderscript/ScriptGroup.java @@ -16,7 +16,6 @@ package android.renderscript; -import java.lang.reflect.Method; import java.util.ArrayList; /** diff --git a/rs/java/android/renderscript/ScriptIntrinsic3DLUT.java b/rs/java/android/renderscript/ScriptIntrinsic3DLUT.java index 96ec875..ce149d9 100644 --- a/rs/java/android/renderscript/ScriptIntrinsic3DLUT.java +++ b/rs/java/android/renderscript/ScriptIntrinsic3DLUT.java @@ -16,8 +16,6 @@ package android.renderscript; -import android.util.Log; - /** * * Intrinsic for converting RGB to RGBA by using a 3D lookup table. The @@ -86,10 +84,23 @@ public final class ScriptIntrinsic3DLUT extends ScriptIntrinsic { * @param aout Output allocation */ public void forEach(Allocation ain, Allocation aout) { - forEach(0, ain, aout, null); + forEach(ain, aout, null); } /** + * Invoke the kernel and apply the lookup to each cell of ain + * and copy to aout. + * + * @param ain Input allocation + * @param aout Output allocation + * @param opt Launch options for kernel + */ + public void forEach(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + forEach(0, ain, aout, null, opt); + } + + + /** * Get a KernelID for this intrinsic kernel. * * @return Script.KernelID The KernelID object. diff --git a/rs/java/android/renderscript/ScriptIntrinsicBlend.java b/rs/java/android/renderscript/ScriptIntrinsicBlend.java index 40f1a3e..d4038c2 100644 --- a/rs/java/android/renderscript/ScriptIntrinsicBlend.java +++ b/rs/java/android/renderscript/ScriptIntrinsicBlend.java @@ -40,14 +40,14 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { } - private void blend(int id, Allocation ain, Allocation aout) { + private void blend(int id, Allocation ain, Allocation aout, Script.LaunchOptions opt) { if (!ain.getElement().isCompatible(Element.U8_4(mRS))) { throw new RSIllegalArgumentException("Input is not of expected format."); } if (!aout.getElement().isCompatible(Element.U8_4(mRS))) { throw new RSIllegalArgumentException("Output is not of expected format."); } - forEach(id, ain, aout, null); + forEach(id, ain, aout, null, opt); } /** @@ -57,7 +57,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachClear(Allocation ain, Allocation aout) { - blend(0, ain, aout); + forEachClear(ain, aout, null); + } + + /** + * Sets dst = {0, 0, 0, 0} + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachClear(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(0, ain, aout, opt); } /** @@ -77,7 +88,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachSrc(Allocation ain, Allocation aout) { - blend(1, ain, aout); + forEachSrc(ain, aout, null); + } + + /** + * Sets dst = src + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachSrc(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + forEachDst(ain, aout, null); } /** @@ -102,6 +124,19 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { } /** + * Sets dst = dst + * + * This is a NOP. + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachDst(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + // N, optOP + } + + /** * Get a KernelID for the Dst kernel. * * @return Script.KernelID The KernelID object. @@ -117,7 +152,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachSrcOver(Allocation ain, Allocation aout) { - blend(3, ain, aout); + forEachSrcOver(ain, aout, null); + } + + /** + * Sets dst = src + dst * (1.0 - src.a) + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachSrcOver(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(3, ain, aout, opt); } /** @@ -136,7 +182,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachDstOver(Allocation ain, Allocation aout) { - blend(4, ain, aout); + forEachDstOver(ain, aout, null); + } + + /** + * Sets dst = dst + src * (1.0 - dst.a) + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachDstOver(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(4, ain, aout, opt); } /** @@ -155,7 +212,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachSrcIn(Allocation ain, Allocation aout) { - blend(5, ain, aout); + forEachSrcIn(ain, aout, null); + } + + /** + * Sets dst = src * dst.a + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachSrcIn(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(5, ain, aout, opt); } /** @@ -174,7 +242,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachDstIn(Allocation ain, Allocation aout) { - blend(6, ain, aout); + forEachDstIn(ain, aout, null); + } + + /** + * Sets dst = dst * src.a + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachDstIn(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(6, ain, aout, opt); } /** @@ -193,7 +272,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachSrcOut(Allocation ain, Allocation aout) { - blend(7, ain, aout); + forEachSrcOut(ain, aout, null); + } + + /** + * Sets dst = src * (1.0 - dst.a) + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachSrcOut(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(7, ain, aout, opt); } /** @@ -212,7 +302,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachDstOut(Allocation ain, Allocation aout) { - blend(8, ain, aout); + forEachDstOut(ain, aout, null); + } + + /** + * Sets dst = dst * (1.0 - src.a) + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachDstOut(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(8, ain, aout, opt); } /** @@ -232,7 +333,19 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachSrcAtop(Allocation ain, Allocation aout) { - blend(9, ain, aout); + forEachSrcAtop(ain, aout, null); + } + + /** + * dst.rgb = src.rgb * dst.a + (1.0 - src.a) * dst.rgb + * dst.a = dst.a + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachSrcAtop(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(9, ain, aout, opt); } /** @@ -252,7 +365,19 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachDstAtop(Allocation ain, Allocation aout) { - blend(10, ain, aout); + forEachDstAtop(ain, aout, null); + } + + /** + * dst = dst.rgb * src.a + (1.0 - dst.a) * src.rgb + * dst.a = src.a + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachDstAtop(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(10, ain, aout, opt); } /** @@ -271,7 +396,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachXor(Allocation ain, Allocation aout) { - blend(11, ain, aout); + forEachXor(ain, aout, null); + } + + /** + * Sets dst = {src.r ^ dst.r, src.g ^ dst.g, src.b ^ dst.b, src.a ^ dst.a} + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachXor(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(11, ain, aout, opt); } /** @@ -300,7 +436,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachMultiply(Allocation ain, Allocation aout) { - blend(14, ain, aout); + forEachMultiply(ain, aout, null); + } + + /** + * Sets dst = src * dst + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachMultiply(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(14, ain, aout, opt); } /** @@ -396,7 +543,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachAdd(Allocation ain, Allocation aout) { - blend(34, ain, aout); + forEachAdd(ain, aout, null); + } + + /** + * Sets dst = min(src + dst, 1.0) + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachAdd(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(34, ain, aout, opt); } /** @@ -415,7 +573,18 @@ public class ScriptIntrinsicBlend extends ScriptIntrinsic { * @param aout The destination buffer */ public void forEachSubtract(Allocation ain, Allocation aout) { - blend(35, ain, aout); + forEachSubtract(ain, aout, null); + } + + /** + * Sets dst = max(dst - src, 0.0) + * + * @param ain The source buffer + * @param aout The destination buffer + * @param opt LaunchOptions for clipping + */ + public void forEachSubtract(Allocation ain, Allocation aout, Script.LaunchOptions opt) { + blend(35, ain, aout, opt); } /** diff --git a/rs/java/android/renderscript/ScriptIntrinsicBlur.java b/rs/java/android/renderscript/ScriptIntrinsicBlur.java index d1a6fed..e7e33b8 100644 --- a/rs/java/android/renderscript/ScriptIntrinsicBlur.java +++ b/rs/java/android/renderscript/ScriptIntrinsicBlur.java @@ -16,10 +16,6 @@ package android.renderscript; -import android.content.Context; -import android.content.res.Resources; -import android.util.Log; - /** * Intrinsic Gausian blur filter. Applies a gaussian blur of the * specified radius to all elements of an allocation. @@ -88,10 +84,23 @@ public final class ScriptIntrinsicBlur extends ScriptIntrinsic { * type. */ public void forEach(Allocation aout) { - forEach(0, null, aout, null); + forEach(aout, null); } /** + * Apply the filter to the input and save to the specified + * allocation. + * + * @param aout Output allocation. Must match creation element + * type. + * @param opt LaunchOptions for clipping + */ + public void forEach(Allocation aout, Script.LaunchOptions opt) { + forEach(0, null, aout, null, opt); + } + + + /** * Get a KernelID for this intrinsic kernel. * * @return Script.KernelID The KernelID object. diff --git a/rs/java/android/renderscript/ScriptIntrinsicColorMatrix.java b/rs/java/android/renderscript/ScriptIntrinsicColorMatrix.java index 601db17..57d917c 100644 --- a/rs/java/android/renderscript/ScriptIntrinsicColorMatrix.java +++ b/rs/java/android/renderscript/ScriptIntrinsicColorMatrix.java @@ -16,8 +16,6 @@ package android.renderscript; -import android.util.Log; - /** * Intrinsic for applying a color matrix to allocations. * @@ -208,7 +206,6 @@ public final class ScriptIntrinsicColorMatrix extends ScriptIntrinsic { setMatrix(); } - /** * Invoke the kernel and apply the matrix to each cell of input * {@link Allocation} and copy to the output {@link Allocation}. @@ -225,6 +222,26 @@ public final class ScriptIntrinsicColorMatrix extends ScriptIntrinsic { * @param aout Output allocation */ public void forEach(Allocation ain, Allocation aout) { + forEach(ain, aout, null); + } + + /** + * Invoke the kernel and apply the matrix to each cell of input + * {@link Allocation} and copy to the output {@link Allocation}. + * + * If the vector size of the input is less than four, the + * remaining components are treated as zero for the matrix + * multiply. + * + * If the output vector size is less than four, the unused + * vector components are discarded. + * + * + * @param ain Input allocation + * @param aout Output allocation + * @param opt LaunchOptions for clipping + */ + public void forEach(Allocation ain, Allocation aout, Script.LaunchOptions opt) { if (!ain.getElement().isCompatible(Element.U8(mRS)) && !ain.getElement().isCompatible(Element.U8_2(mRS)) && !ain.getElement().isCompatible(Element.U8_3(mRS)) && @@ -249,7 +266,7 @@ public final class ScriptIntrinsicColorMatrix extends ScriptIntrinsic { throw new RSIllegalArgumentException("Unsuported element type."); } - forEach(0, ain, aout, null); + forEach(0, ain, aout, null, opt); } /** diff --git a/rs/java/android/renderscript/ScriptIntrinsicConvolve3x3.java b/rs/java/android/renderscript/ScriptIntrinsicConvolve3x3.java index 25f3ee8..fb91fdc 100644 --- a/rs/java/android/renderscript/ScriptIntrinsicConvolve3x3.java +++ b/rs/java/android/renderscript/ScriptIntrinsicConvolve3x3.java @@ -16,8 +16,6 @@ package android.renderscript; -import android.util.Log; - /** * Intrinsic for applying a 3x3 convolve to an allocation. * @@ -108,7 +106,19 @@ public final class ScriptIntrinsicConvolve3x3 extends ScriptIntrinsic { * type. */ public void forEach(Allocation aout) { - forEach(0, null, aout, null); + forEach(aout, null); + } + + /** + * Apply the filter to the input and save to the specified + * allocation. + * + * @param aout Output allocation. Must match creation element + * type. + * @param opt LaunchOptions for clipping + */ + public void forEach(Allocation aout, Script.LaunchOptions opt) { + forEach(0, null, aout, null, opt); } /** diff --git a/rs/java/android/renderscript/ScriptIntrinsicConvolve5x5.java b/rs/java/android/renderscript/ScriptIntrinsicConvolve5x5.java index 71ea4cb..0357560 100644 --- a/rs/java/android/renderscript/ScriptIntrinsicConvolve5x5.java +++ b/rs/java/android/renderscript/ScriptIntrinsicConvolve5x5.java @@ -16,8 +16,6 @@ package android.renderscript; -import android.util.Log; - /** * Intrinsic for applying a 5x5 convolve to an allocation. * @@ -109,10 +107,23 @@ public final class ScriptIntrinsicConvolve5x5 extends ScriptIntrinsic { * type. */ public void forEach(Allocation aout) { - forEach(0, null, aout, null); + forEach(aout, null); } /** + * Apply the filter to the input and save to the specified + * allocation. + * + * @param aout Output allocation. Must match creation element + * type. + * @param opt LaunchOptions for clipping + */ + public void forEach(Allocation aout, Script.LaunchOptions opt) { + forEach(0, null, aout, null, opt); + } + + + /** * Get a KernelID for this intrinsic kernel. * * @return Script.KernelID The KernelID object. diff --git a/rs/java/android/renderscript/ScriptIntrinsicHistogram.java b/rs/java/android/renderscript/ScriptIntrinsicHistogram.java index 42e4d04..95b610a 100644 --- a/rs/java/android/renderscript/ScriptIntrinsicHistogram.java +++ b/rs/java/android/renderscript/ScriptIntrinsicHistogram.java @@ -16,10 +16,6 @@ package android.renderscript; -import android.content.Context; -import android.content.res.Resources; -import android.util.Log; - /** * Intrinsic Histogram filter. * @@ -71,6 +67,24 @@ public final class ScriptIntrinsicHistogram extends ScriptIntrinsic { * @param ain The input image */ public void forEach(Allocation ain) { + forEach(ain, null); + } + + /** + * Process an input buffer and place the histogram into the + * output allocation. The output allocation may be a narrower + * vector size than the input. In this case the vector size of + * the output is used to determine how many of the input + * channels are used in the computation. This is useful if you + * have an RGBA input buffer but only want the histogram for + * RGB. + * + * 1D and 2D input allocations are supported. + * + * @param ain The input image + * @param opt LaunchOptions for clipping + */ + public void forEach(Allocation ain, Script.LaunchOptions opt) { if (ain.getType().getElement().getVectorSize() < mOut.getType().getElement().getVectorSize()) { @@ -82,9 +96,11 @@ public final class ScriptIntrinsicHistogram extends ScriptIntrinsic { throw new RSIllegalArgumentException("Output type must be U32 or I32."); } - forEach(0, ain, null, null); + forEach(0, ain, null, null, opt); } + + /** * Set the coefficients used for the RGBA to Luminocity * calculation. The default is {0.299f, 0.587f, 0.114f, 0.f}. @@ -141,6 +157,7 @@ public final class ScriptIntrinsicHistogram extends ScriptIntrinsic { setVar(1, aout); } + /** * Process an input buffer and place the histogram into the * output allocation. The dot product of the input channel and @@ -152,6 +169,21 @@ public final class ScriptIntrinsicHistogram extends ScriptIntrinsic { * @param ain The input image */ public void forEach_Dot(Allocation ain) { + forEach_Dot(ain, null); + } + + /** + * Process an input buffer and place the histogram into the + * output allocation. The dot product of the input channel and + * the coefficients from 'setDotCoefficients' are used to + * calculate the output values. + * + * 1D and 2D input allocations are supported. + * + * @param ain The input image + * @param opt LaunchOptions for clipping + */ + public void forEach_Dot(Allocation ain, Script.LaunchOptions opt) { if (mOut.getType().getElement().getVectorSize() != 1) { throw new RSIllegalArgumentException("Output vector size must be one."); } @@ -160,7 +192,7 @@ public final class ScriptIntrinsicHistogram extends ScriptIntrinsic { throw new RSIllegalArgumentException("Output type must be U32 or I32."); } - forEach(1, ain, null, null); + forEach(1, ain, null, null, opt); } diff --git a/rs/java/android/renderscript/ScriptIntrinsicLUT.java b/rs/java/android/renderscript/ScriptIntrinsicLUT.java index c45c015..69ff64a 100644 --- a/rs/java/android/renderscript/ScriptIntrinsicLUT.java +++ b/rs/java/android/renderscript/ScriptIntrinsicLUT.java @@ -16,8 +16,6 @@ package android.renderscript; -import android.util.Log; - /** * Intrinsic for applying a per-channel lookup table. Each * channel of the input has an independant lookup table. The @@ -116,7 +114,6 @@ public final class ScriptIntrinsicLUT extends ScriptIntrinsic { mDirty = true; } - /** * Invoke the kernel and apply the lookup to each cell of ain * and copy to aout. @@ -125,11 +122,23 @@ public final class ScriptIntrinsicLUT extends ScriptIntrinsic { * @param aout Output allocation */ public void forEach(Allocation ain, Allocation aout) { + forEach(ain, aout, null); + } + + /** + * Invoke the kernel and apply the lookup to each cell of ain + * and copy to aout. + * + * @param ain Input allocation + * @param aout Output allocation + * @param opt Options for clipping + */ + public void forEach(Allocation ain, Allocation aout, Script.LaunchOptions opt) { if (mDirty) { mDirty = false; mTables.copyFromUnchecked(mCache); } - forEach(0, ain, aout, null); + forEach(0, ain, aout, null, opt); } /** diff --git a/rs/java/android/renderscript/Short2.java b/rs/java/android/renderscript/Short2.java index 070d608..24809f7 100644 --- a/rs/java/android/renderscript/Short2.java +++ b/rs/java/android/renderscript/Short2.java @@ -16,7 +16,10 @@ package android.renderscript; -/** + +/** + * Class for exposing the native RenderScript Short2 type back to the Android system. + * * Vector version of the basic short type. * Provides two short fields packed. */ diff --git a/rs/java/android/renderscript/Type.java b/rs/java/android/renderscript/Type.java index 7283814..83bf4a5 100644 --- a/rs/java/android/renderscript/Type.java +++ b/rs/java/android/renderscript/Type.java @@ -16,12 +16,6 @@ package android.renderscript; - -import java.lang.reflect.Field; - -import android.graphics.ImageFormat; -import android.util.Log; - /** * <p>A Type describes the {@link android.renderscript.Element} and dimensions used for an {@link * android.renderscript.Allocation} or a parallel operation. Types are created through {@link diff --git a/rs/jni/android_renderscript_RenderScript.cpp b/rs/jni/android_renderscript_RenderScript.cpp index c4e19a1..80a5da2 100644 --- a/rs/jni/android_renderscript_RenderScript.cpp +++ b/rs/jni/android_renderscript_RenderScript.cpp @@ -392,7 +392,7 @@ nContextSendMessage(JNIEnv *_env, jobject _this, jlong con, jint id, jintArray d jint len = 0; if (data) { len = _env->GetArrayLength(data); - jint *ptr = _env->GetIntArrayElements(data, NULL); + ptr = _env->GetIntArrayElements(data, NULL); } LOG_API("nContextSendMessage, con(%p), id(%i), len(%i)", (RsContext)con, id, len); rsContextSendMessage((RsContext)con, id, (const uint8_t *)ptr, len * sizeof(int)); |