summaryrefslogtreecommitdiffstats
path: root/graphics/jni
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2009-08-13 12:59:04 -0700
committerJason Sams <rjsams@android.com>2009-08-13 12:59:04 -0700
commitfbf0b9ecda03fbdbd4ebabfd18da09a789686249 (patch)
tree6c321ebb1d011aae9961ed7c046645028b05da86 /graphics/jni
parent1b52aae4d908fcf749e9a8d86bb0a33c70728c56 (diff)
downloadframeworks_base-fbf0b9ecda03fbdbd4ebabfd18da09a789686249.zip
frameworks_base-fbf0b9ecda03fbdbd4ebabfd18da09a789686249.tar.gz
frameworks_base-fbf0b9ecda03fbdbd4ebabfd18da09a789686249.tar.bz2
Implement named slots and convert script.addType to script.setType to remove ordering restrictions.
Diffstat (limited to 'graphics/jni')
-rw-r--r--graphics/jni/android_renderscript_RenderScript.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index ef0cf68..5780e02 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -824,30 +824,37 @@ nScriptSetTimeZone(JNIEnv *_env, jobject _this, jint script, jbyteArray timeZone
}
}
-// -----------------------------------
-
static void
-nScriptCBegin(JNIEnv *_env, jobject _this)
+nScriptSetType(JNIEnv *_env, jobject _this, jint type, jstring _str, jint slot)
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nScriptCBegin, con(%p)", con);
- rsScriptCBegin();
+ LOG_API("nScriptCAddType, con(%p), type(%p), slot(%i)", con, (RsType)type, slot);
+ const char* n = NULL;
+ if (_str) {
+ n = _env->GetStringUTFChars(_str, NULL);
+ }
+ rsScriptSetType((RsType)type, slot, n);
+ if (n) {
+ _env->ReleaseStringUTFChars(_str, n);
+ }
}
static void
-nScriptCAddType(JNIEnv *_env, jobject _this, jint type)
+nScriptSetRoot(JNIEnv *_env, jobject _this, jboolean isRoot)
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nScriptCAddType, con(%p), type(%p)", con, (RsType)type);
- rsScriptCAddType((RsType)type);
+ LOG_API("nScriptCSetRoot, con(%p), isRoot(%i)", con, isRoot);
+ rsScriptSetRoot(isRoot);
}
+// -----------------------------------
+
static void
-nScriptCSetRoot(JNIEnv *_env, jobject _this, jboolean isRoot)
+nScriptCBegin(JNIEnv *_env, jobject _this)
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nScriptCSetRoot, con(%p), isRoot(%i)", con, isRoot);
- rsScriptCSetRoot(isRoot);
+ LOG_API("nScriptCBegin, con(%p)", con);
+ rsScriptCBegin();
}
static void
@@ -1374,10 +1381,10 @@ static JNINativeMethod methods[] = {
{"nScriptSetClearDepth", "(IF)V", (void*)nScriptSetClearDepth },
{"nScriptSetClearStencil", "(II)V", (void*)nScriptSetClearStencil },
{"nScriptSetTimeZone", "(I[B)V", (void*)nScriptSetTimeZone },
+{"nScriptSetType", "(ILjava/lang/String;I)V", (void*)nScriptSetType },
+{"nScriptSetRoot", "(Z)V", (void*)nScriptSetRoot },
{"nScriptCBegin", "()V", (void*)nScriptCBegin },
-{"nScriptCAddType", "(I)V", (void*)nScriptCAddType },
-{"nScriptCSetRoot", "(Z)V", (void*)nScriptCSetRoot },
{"nScriptCSetScript", "([BII)V", (void*)nScriptCSetScript },
{"nScriptCCreate", "()I", (void*)nScriptCCreate },
{"nScriptCAddDefineI32", "(Ljava/lang/String;I)V", (void*)nScriptCAddDefineI32 },