From 3b9c52ab8c1ab240d2299358d01a8efbe392d111 Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Thu, 14 Oct 2010 17:48:46 -0700 Subject: Async type creation. Change-Id: I4d98446fabbf7e8a98c97f85b573a58c8a0c58c2 --- graphics/jni/android_renderscript_RenderScript.cpp | 34 +++++++++------------- 1 file changed, 14 insertions(+), 20 deletions(-) (limited to 'graphics/jni/android_renderscript_RenderScript.cpp') 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 }, -- cgit v1.1