summaryrefslogtreecommitdiffstats
path: root/graphics/jni
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2010-09-02 17:35:23 -0700
committerAlex Sakhartchouk <alexst@google.com>2010-09-07 12:06:05 -0700
commit70d4e5024298f71edb3b04867e05568f5495b4ce (patch)
tree031a101a16e33230c0d902f0e2c389aaf7996116 /graphics/jni
parent355383e424882b590139590296562d644dd97a95 (diff)
downloadframeworks_base-70d4e5024298f71edb3b04867e05568f5495b4ce.zip
frameworks_base-70d4e5024298f71edb3b04867e05568f5495b4ce.tar.gz
frameworks_base-70d4e5024298f71edb3b04867e05568f5495b4ce.tar.bz2
Add arrays to elements.
Change-Id: I624b03bfc1fd26136afd9305a96026b91b1fad3c
Diffstat (limited to 'graphics/jni')
-rw-r--r--graphics/jni/android_renderscript_RenderScript.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index c8e6656..f07dbfd 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -253,12 +253,13 @@ nElementCreate(JNIEnv *_env, jobject _this, RsContext con, jint type, jint kind,
}
static jint
-nElementCreate2(JNIEnv *_env, jobject _this, RsContext con, jintArray _ids, jobjectArray _names)
+nElementCreate2(JNIEnv *_env, jobject _this, RsContext con, jintArray _ids, jobjectArray _names, jintArray _arraySizes)
{
int fieldCount = _env->GetArrayLength(_ids);
LOG_API("nElementCreate2, con(%p)", con);
jint *ids = _env->GetIntArrayElements(_ids, NULL);
+ jint *arraySizes = _env->GetIntArrayElements(_arraySizes, NULL);
const char ** nameArray = (const char **)calloc(fieldCount, sizeof(char *));
size_t* sizeArray = (size_t*)calloc(fieldCount, sizeof(size_t));
@@ -267,12 +268,13 @@ nElementCreate2(JNIEnv *_env, jobject _this, RsContext con, jintArray _ids, jobj
nameArray[ct] = _env->GetStringUTFChars(s, NULL);
sizeArray[ct] = _env->GetStringUTFLength(s);
}
- jint id = (jint)rsElementCreate2(con, fieldCount, (RsElement *)ids, nameArray, sizeArray);
+ jint id = (jint)rsElementCreate2(con, fieldCount, (RsElement *)ids, nameArray, sizeArray, (const uint32_t *)arraySizes);
for (int ct=0; ct < fieldCount; ct++) {
jstring s = (jstring)_env->GetObjectArrayElement(_names, ct);
_env->ReleaseStringUTFChars(s, nameArray[ct]);
}
_env->ReleaseIntArrayElements(_ids, ids, JNI_ABORT);
+ _env->ReleaseIntArrayElements(_arraySizes, arraySizes, JNI_ABORT);
free(nameArray);
free(sizeArray);
return (jint)id;
@@ -1230,7 +1232,7 @@ static JNINativeMethod methods[] = {
{"rsnFontCreateFromFile", "(ILjava/lang/String;II)I", (void*)nFontCreateFromFile },
{"rsnElementCreate", "(IIIZI)I", (void*)nElementCreate },
-{"rsnElementCreate2", "(I[I[Ljava/lang/String;)I", (void*)nElementCreate2 },
+{"rsnElementCreate2", "(I[I[Ljava/lang/String;[I)I", (void*)nElementCreate2 },
{"rsnElementGetNativeData", "(II[I)V", (void*)nElementGetNativeData },
{"rsnElementGetSubElements", "(II[I[Ljava/lang/String;)V", (void*)nElementGetSubElements },