Loading graphics/java/android/renderscript/RenderScript.java +2 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,8 @@ public class RenderScript { native void nScriptSetTimeZone(int script, byte[] timeZone); native void nScriptSetType(int type, boolean writable, String name, int slot); native void nScriptSetRoot(boolean isRoot); native void nScriptSetInvokable(String name, int slot); native void nScriptInvoke(int id, int slot); native void nScriptCBegin(); native void nScriptCSetScript(byte[] script, int offset, int length); Loading graphics/java/android/renderscript/Script.java +37 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,22 @@ public class Script extends BaseObj { boolean mIsRoot; Type[] mTypes; boolean[] mWritable; Invokable[] mInvokables; public static class Invokable { RenderScript mRS; Script mScript; int mSlot; String mName; Invokable() { mSlot = -1; } public void execute() { mRS.nScriptInvoke(mScript.mID, mSlot); } } Script(int id, RenderScript rs) { super(rs); Loading Loading @@ -61,12 +77,15 @@ public class Script extends BaseObj { Type[] mTypes; String[] mNames; boolean[] mWritable; int mInvokableCount = 0; Invokable[] mInvokables; Builder(RenderScript rs) { mRS = rs; mTypes = new Type[MAX_SLOT]; mNames = new String[MAX_SLOT]; mWritable = new boolean[MAX_SLOT]; mInvokables = new Invokable[MAX_SLOT]; } public void setType(Type t, int slot) { Loading @@ -79,6 +98,15 @@ public class Script extends BaseObj { mNames[slot] = name; } public Invokable addInvokable(String func) { Invokable i = new Invokable(); i.mName = func; i.mRS = mRS; i.mSlot = mInvokableCount; mInvokables[mInvokableCount++] = i; return i; } public void setType(boolean writable, int slot) { mWritable[slot] = writable; } Loading @@ -90,11 +118,20 @@ public class Script extends BaseObj { mRS.nScriptSetType(mTypes[ct].mID, mWritable[ct], mNames[ct], ct); } } for(int ct=0; ct < mInvokableCount; ct++) { mRS.nScriptSetInvokable(mInvokables[ct].mName, ct); } } void transferObject(Script s) { s.mIsRoot = mIsRoot; s.mTypes = mTypes; s.mInvokables = new Invokable[mInvokableCount]; for(int ct=0; ct < mInvokableCount; ct++) { s.mInvokables[ct] = mInvokables[ct]; s.mInvokables[ct].mScript = s; } s.mInvokables = null; } public void setRoot(boolean r) { Loading graphics/jni/android_renderscript_RenderScript.cpp +25 −0 Original line number Diff line number Diff line Loading @@ -890,6 +890,29 @@ nScriptSetType(JNIEnv *_env, jobject _this, jint type, jboolean writable, jstrin } } static void nScriptSetInvoke(JNIEnv *_env, jobject _this, jstring _str, jint slot) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nScriptSetInvoke, con(%p)", con); const char* n = NULL; if (_str) { n = _env->GetStringUTFChars(_str, NULL); } rsScriptSetInvoke(con, n, slot); if (n) { _env->ReleaseStringUTFChars(_str, n); } } static void nScriptInvoke(JNIEnv *_env, jobject _this, jint obj, jint slot) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nScriptInvoke, con(%p), script(%p)", con, (void *)obj); rsScriptInvoke(con, (RsScript)obj, slot); } static void nScriptSetRoot(JNIEnv *_env, jobject _this, jboolean isRoot) { Loading Loading @@ -1366,6 +1389,8 @@ static JNINativeMethod methods[] = { {"nScriptSetTimeZone", "(I[B)V", (void*)nScriptSetTimeZone }, {"nScriptSetType", "(IZLjava/lang/String;I)V", (void*)nScriptSetType }, {"nScriptSetRoot", "(Z)V", (void*)nScriptSetRoot }, {"nScriptSetInvokable", "(Ljava/lang/String;I)V", (void*)nScriptSetInvoke }, {"nScriptInvoke", "(II)V", (void*)nScriptInvoke }, {"nScriptCBegin", "()V", (void*)nScriptCBegin }, {"nScriptCSetScript", "([BII)V", (void*)nScriptCSetScript }, Loading libs/rs/rs.spec +10 −0 Original line number Diff line number Diff line Loading @@ -297,6 +297,16 @@ ScriptSetType { param const char * name } ScriptSetInvoke { param const char * name param uint32_t slot } ScriptInvoke { param RsScript s param uint32_t slot } ScriptSetRoot { param bool isRoot } Loading libs/rs/rsScript.cpp +16 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ Script::Script() mEnviroment.mClearColor[2] = 0; mEnviroment.mClearColor[3] = 1; mEnviroment.mClearDepth = 1; mEnviroment.mClearStencil = 0; mEnviroment.mIsRoot = false; } Script::~Script() Loading Loading @@ -83,10 +85,23 @@ void rsi_ScriptSetType(Context * rsc, RsType vt, uint32_t slot, bool writable, c } } void rsi_ScriptSetInvoke(Context *rsc, const char *name, uint32_t slot) { ScriptCState *ss = &rsc->mScriptC; ss->mInvokableNames[slot] = name; } void rsi_ScriptInvoke(Context *rsc, RsScript vs, uint32_t slot) { Script *s = static_cast<Script *>(vs); s->mEnviroment.mInvokables[slot](); } void rsi_ScriptSetRoot(Context * rsc, bool isRoot) { ScriptCState *ss = &rsc->mScriptC; ss->mEnviroment.mIsRoot = isRoot; ss->mScript->mEnviroment.mIsRoot = isRoot; } Loading Loading
graphics/java/android/renderscript/RenderScript.java +2 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,8 @@ public class RenderScript { native void nScriptSetTimeZone(int script, byte[] timeZone); native void nScriptSetType(int type, boolean writable, String name, int slot); native void nScriptSetRoot(boolean isRoot); native void nScriptSetInvokable(String name, int slot); native void nScriptInvoke(int id, int slot); native void nScriptCBegin(); native void nScriptCSetScript(byte[] script, int offset, int length); Loading
graphics/java/android/renderscript/Script.java +37 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,22 @@ public class Script extends BaseObj { boolean mIsRoot; Type[] mTypes; boolean[] mWritable; Invokable[] mInvokables; public static class Invokable { RenderScript mRS; Script mScript; int mSlot; String mName; Invokable() { mSlot = -1; } public void execute() { mRS.nScriptInvoke(mScript.mID, mSlot); } } Script(int id, RenderScript rs) { super(rs); Loading Loading @@ -61,12 +77,15 @@ public class Script extends BaseObj { Type[] mTypes; String[] mNames; boolean[] mWritable; int mInvokableCount = 0; Invokable[] mInvokables; Builder(RenderScript rs) { mRS = rs; mTypes = new Type[MAX_SLOT]; mNames = new String[MAX_SLOT]; mWritable = new boolean[MAX_SLOT]; mInvokables = new Invokable[MAX_SLOT]; } public void setType(Type t, int slot) { Loading @@ -79,6 +98,15 @@ public class Script extends BaseObj { mNames[slot] = name; } public Invokable addInvokable(String func) { Invokable i = new Invokable(); i.mName = func; i.mRS = mRS; i.mSlot = mInvokableCount; mInvokables[mInvokableCount++] = i; return i; } public void setType(boolean writable, int slot) { mWritable[slot] = writable; } Loading @@ -90,11 +118,20 @@ public class Script extends BaseObj { mRS.nScriptSetType(mTypes[ct].mID, mWritable[ct], mNames[ct], ct); } } for(int ct=0; ct < mInvokableCount; ct++) { mRS.nScriptSetInvokable(mInvokables[ct].mName, ct); } } void transferObject(Script s) { s.mIsRoot = mIsRoot; s.mTypes = mTypes; s.mInvokables = new Invokable[mInvokableCount]; for(int ct=0; ct < mInvokableCount; ct++) { s.mInvokables[ct] = mInvokables[ct]; s.mInvokables[ct].mScript = s; } s.mInvokables = null; } public void setRoot(boolean r) { Loading
graphics/jni/android_renderscript_RenderScript.cpp +25 −0 Original line number Diff line number Diff line Loading @@ -890,6 +890,29 @@ nScriptSetType(JNIEnv *_env, jobject _this, jint type, jboolean writable, jstrin } } static void nScriptSetInvoke(JNIEnv *_env, jobject _this, jstring _str, jint slot) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nScriptSetInvoke, con(%p)", con); const char* n = NULL; if (_str) { n = _env->GetStringUTFChars(_str, NULL); } rsScriptSetInvoke(con, n, slot); if (n) { _env->ReleaseStringUTFChars(_str, n); } } static void nScriptInvoke(JNIEnv *_env, jobject _this, jint obj, jint slot) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nScriptInvoke, con(%p), script(%p)", con, (void *)obj); rsScriptInvoke(con, (RsScript)obj, slot); } static void nScriptSetRoot(JNIEnv *_env, jobject _this, jboolean isRoot) { Loading Loading @@ -1366,6 +1389,8 @@ static JNINativeMethod methods[] = { {"nScriptSetTimeZone", "(I[B)V", (void*)nScriptSetTimeZone }, {"nScriptSetType", "(IZLjava/lang/String;I)V", (void*)nScriptSetType }, {"nScriptSetRoot", "(Z)V", (void*)nScriptSetRoot }, {"nScriptSetInvokable", "(Ljava/lang/String;I)V", (void*)nScriptSetInvoke }, {"nScriptInvoke", "(II)V", (void*)nScriptInvoke }, {"nScriptCBegin", "()V", (void*)nScriptCBegin }, {"nScriptCSetScript", "([BII)V", (void*)nScriptCSetScript }, Loading
libs/rs/rs.spec +10 −0 Original line number Diff line number Diff line Loading @@ -297,6 +297,16 @@ ScriptSetType { param const char * name } ScriptSetInvoke { param const char * name param uint32_t slot } ScriptInvoke { param RsScript s param uint32_t slot } ScriptSetRoot { param bool isRoot } Loading
libs/rs/rsScript.cpp +16 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,8 @@ Script::Script() mEnviroment.mClearColor[2] = 0; mEnviroment.mClearColor[3] = 1; mEnviroment.mClearDepth = 1; mEnviroment.mClearStencil = 0; mEnviroment.mIsRoot = false; } Script::~Script() Loading Loading @@ -83,10 +85,23 @@ void rsi_ScriptSetType(Context * rsc, RsType vt, uint32_t slot, bool writable, c } } void rsi_ScriptSetInvoke(Context *rsc, const char *name, uint32_t slot) { ScriptCState *ss = &rsc->mScriptC; ss->mInvokableNames[slot] = name; } void rsi_ScriptInvoke(Context *rsc, RsScript vs, uint32_t slot) { Script *s = static_cast<Script *>(vs); s->mEnviroment.mInvokables[slot](); } void rsi_ScriptSetRoot(Context * rsc, bool isRoot) { ScriptCState *ss = &rsc->mScriptC; ss->mEnviroment.mIsRoot = isRoot; ss->mScript->mEnviroment.mIsRoot = isRoot; } Loading