summaryrefslogtreecommitdiffstats
path: root/graphics/jni
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2010-10-14 17:48:46 -0700
committerJason Sams <rjsams@android.com>2010-10-14 17:48:46 -0700
commit3b9c52ab8c1ab240d2299358d01a8efbe392d111 (patch)
treead86f6f761e41591de73aeaa236fa8c99105e672 /graphics/jni
parentc65217e4ec3e6c80834988ec3bc66a90778ee4b0 (diff)
downloadframeworks_base-3b9c52ab8c1ab240d2299358d01a8efbe392d111.zip
frameworks_base-3b9c52ab8c1ab240d2299358d01a8efbe392d111.tar.gz
frameworks_base-3b9c52ab8c1ab240d2299358d01a8efbe392d111.tar.bz2
Async type creation.
Change-Id: I4d98446fabbf7e8a98c97f85b573a58c8a0c58c2
Diffstat (limited to 'graphics/jni')
-rw-r--r--graphics/jni/android_renderscript_RenderScript.cpp34
1 files changed, 14 insertions, 20 deletions
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index ce2a40c..d9ff62d 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -112,7 +112,7 @@ static void
nObjDestroy(JNIEnv *_env, jobject _this, RsContext con, jint obj)
{
LOG_API("nObjDestroy, con(%p) obj(%p)", con, (void *)obj);
- rsObjDestroy(con, (void *)obj);
+ rsObjDestroy(con, (uint32_t)obj);
}
@@ -336,25 +336,21 @@ nElementGetSubElements(JNIEnv *_env, jobject _this, RsContext con, jint id, jint
// -----------------------------------
-static void
-nTypeBegin(JNIEnv *_env, jobject _this, RsContext con, jint eID)
+static int
+nTypeCreate(JNIEnv *_env, jobject _this, RsContext con, RsElement eid, jintArray _dims, jintArray _dimValues)
{
- LOG_API("nTypeBegin, con(%p) e(%p)", con, (RsElement)eID);
- rsTypeBegin(con, (RsElement)eID);
-}
+ int count = _env->GetArrayLength(_dims);
+ LOG_API("nTypeCreate, con(%p)", con);
-static void
-nTypeAdd(JNIEnv *_env, jobject _this, RsContext con, jint dim, jint val)
-{
- LOG_API("nTypeAdd, con(%p) dim(%i), val(%i)", con, dim, val);
- rsTypeAdd(con, (RsDimension)dim, val);
-}
+ jint *dimPtr = _env->GetIntArrayElements(_dims, NULL);
+ jint *dimValPtr = _env->GetIntArrayElements(_dimValues, NULL);
-static jint
-nTypeCreate(JNIEnv *_env, jobject _this, RsContext con)
-{
- LOG_API("nTypeCreate, con(%p)", con);
- return (jint)rsTypeCreate(con);
+ jint id = (jint)rsaTypeCreate(con, (RsElement)eid, count,
+ (RsDimension *)dimPtr, (uint32_t *)dimValPtr);
+
+ _env->ReleaseIntArrayElements(_dims, dimPtr, JNI_ABORT);
+ _env->ReleaseIntArrayElements(_dimValues, dimValPtr, JNI_ABORT);
+ return (jint)id;
}
static void
@@ -1261,9 +1257,7 @@ static JNINativeMethod methods[] = {
{"rsnElementGetNativeData", "(II[I)V", (void*)nElementGetNativeData },
{"rsnElementGetSubElements", "(II[I[Ljava/lang/String;)V", (void*)nElementGetSubElements },
-{"rsnTypeBegin", "(II)V", (void*)nTypeBegin },
-{"rsnTypeAdd", "(III)V", (void*)nTypeAdd },
-{"rsnTypeCreate", "(I)I", (void*)nTypeCreate },
+{"rsnTypeCreate", "(II[I[I)I", (void*)nTypeCreate },
{"rsnTypeGetNativeData", "(II[I)V", (void*)nTypeGetNativeData },
{"rsnAllocationCreateTyped", "(II)I", (void*)nAllocationCreateTyped },