diff options
| author | 2013-02-13 00:09:02 -0800 | |
|---|---|---|
| committer | 2013-02-13 00:09:02 -0800 | |
| commit | dac6ed0b69b23ab25757085dd5ce68092516ee2f (patch) | |
| tree | 6dea6180df015a6f29346679c6181d78fedafce3 | |
| parent | 7d9cf2b74236953671d20f5634f3b4234c25c6fa (diff) | |
Add rsnScriptForEachClipped() implementation with no param array.
JNI doesn't let us pass down a NULL parameter array (from the usrData part
of our reflection). In this case, we simply clone our existing function, but
remove the offending array parameter.
Change-Id: Ib1d6e202f2a55ba8922eec3da5a93d8daa882250
| -rw-r--r-- | graphics/java/android/renderscript/RenderScript.java | 8 | ||||
| -rw-r--r-- | graphics/jni/android_renderscript_RenderScript.cpp | 25 |
2 files changed, 30 insertions, 3 deletions
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java index 50d888fa242b..c3ddd32e39b6 100644 --- a/graphics/java/android/renderscript/RenderScript.java +++ b/graphics/java/android/renderscript/RenderScript.java @@ -519,6 +519,8 @@ public class RenderScript { native void rsnScriptForEach(int con, int id, int slot, int ain, int aout); native void rsnScriptForEachClipped(int con, int id, int slot, int ain, int aout, byte[] params, int xstart, int xend, int ystart, int yend, int zstart, int zend); + native void rsnScriptForEachClipped(int con, int id, int slot, int ain, int aout, + int xstart, int xend, int ystart, int yend, int zstart, int zend); synchronized void nScriptForEach(int id, int slot, int ain, int aout, byte[] params) { validate(); if (params == null) { @@ -531,7 +533,11 @@ public class RenderScript { synchronized void nScriptForEachClipped(int id, int slot, int ain, int aout, byte[] params, int xstart, int xend, int ystart, int yend, int zstart, int zend) { validate(); - rsnScriptForEachClipped(mContext, id, slot, ain, aout, params, xstart, xend, ystart, yend, zstart, zend); + if (params == null) { + rsnScriptForEachClipped(mContext, id, slot, ain, aout, xstart, xend, ystart, yend, zstart, zend); + } else { + rsnScriptForEachClipped(mContext, id, slot, ain, aout, params, xstart, xend, ystart, yend, zstart, zend); + } } native void rsnScriptInvokeV(int con, int id, int slot, byte[] params); diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp index 9a8a6e85f5ba..88306856cada 100644 --- a/graphics/jni/android_renderscript_RenderScript.cpp +++ b/graphics/jni/android_renderscript_RenderScript.cpp @@ -1055,10 +1055,30 @@ nScriptForEachV(JNIEnv *_env, jobject _this, RsContext con, static void nScriptForEachClipped(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slot, jint ain, jint aout, - jbyteArray params, jint xstart, jint xend, + jint xstart, jint xend, jint ystart, jint yend, jint zstart, jint zend) { LOG_API("nScriptForEachClipped, con(%p), s(%p), slot(%i)", con, (void *)script, slot); + RsScriptCall sc; + sc.xStart = xstart; + sc.xEnd = xend; + sc.yStart = ystart; + sc.yEnd = yend; + sc.zStart = zstart; + sc.zEnd = zend; + sc.strategy = RS_FOR_EACH_STRATEGY_DONT_CARE; + sc.arrayStart = 0; + sc.arrayEnd = 0; + rsScriptForEach(con, (RsScript)script, slot, (RsAllocation)ain, (RsAllocation)aout, NULL, 0, &sc, sizeof(sc)); +} + +static void +nScriptForEachClippedV(JNIEnv *_env, jobject _this, RsContext con, + jint script, jint slot, jint ain, jint aout, + jbyteArray params, jint xstart, jint xend, + jint ystart, jint yend, jint zstart, jint zend) +{ + LOG_API("nScriptForEachClipped, con(%p), s(%p), slot(%i)", con, (void *)script, slot); jint len = _env->GetArrayLength(params); jbyte *ptr = _env->GetByteArrayElements(params, NULL); RsScriptCall sc; @@ -1536,7 +1556,8 @@ static JNINativeMethod methods[] = { {"rsnScriptInvokeV", "(III[B)V", (void*)nScriptInvokeV }, {"rsnScriptForEach", "(IIIII)V", (void*)nScriptForEach }, {"rsnScriptForEach", "(IIIII[B)V", (void*)nScriptForEachV }, -{"rsnScriptForEachClipped", "(IIIII[BIIIIII)V", (void*)nScriptForEachClipped }, +{"rsnScriptForEachClipped", "(IIIIIIIIIII)V", (void*)nScriptForEachClipped }, +{"rsnScriptForEachClipped", "(IIIII[BIIIIII)V", (void*)nScriptForEachClippedV }, {"rsnScriptSetVarI", "(IIII)V", (void*)nScriptSetVarI }, {"rsnScriptSetVarJ", "(IIIJ)V", (void*)nScriptSetVarJ }, {"rsnScriptSetVarF", "(IIIF)V", (void*)nScriptSetVarF }, |