diff options
author | Jason Sams <rjsams@android.com> | 2009-08-10 14:55:26 -0700 |
---|---|---|
committer | Jason Sams <rjsams@android.com> | 2009-08-10 14:55:26 -0700 |
commit | 40a29e8e28772b37ab0f9fe9708ecdcba24abb84 (patch) | |
tree | ddc7de5fe342a6bded733e8341b1953a49e0a2d0 /graphics/jni | |
parent | c028d09409c3cd290949974258264903106a3346 (diff) | |
download | frameworks_base-40a29e8e28772b37ab0f9fe9708ecdcba24abb84.zip frameworks_base-40a29e8e28772b37ab0f9fe9708ecdcba24abb84.tar.gz frameworks_base-40a29e8e28772b37ab0f9fe9708ecdcba24abb84.tar.bz2 |
Implement basic allocation readback. Add Get height, width to ScriptC_Lib.
Diffstat (limited to 'graphics/jni')
-rw-r--r-- | graphics/jni/android_renderscript_RenderScript.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp index 2c3a6cb..285fdc0 100644 --- a/graphics/jni/android_renderscript_RenderScript.cpp +++ b/graphics/jni/android_renderscript_RenderScript.cpp @@ -389,6 +389,27 @@ nAllocationSubData2D_f(JNIEnv *_env, jobject _this, jint alloc, jint xoff, jint _env->ReleaseFloatArrayElements(data, ptr, JNI_ABORT); } +static void +nAllocationRead_i(JNIEnv *_env, jobject _this, jint alloc, jintArray data) +{ + RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); + jint len = _env->GetArrayLength(data); + LOG_API("nAllocationRead_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len); + jint *ptr = _env->GetIntArrayElements(data, NULL); + rsAllocationData((RsAllocation)alloc, ptr); + _env->ReleaseIntArrayElements(data, ptr, JNI_COMMIT); +} + +static void +nAllocationRead_f(JNIEnv *_env, jobject _this, jint alloc, jfloatArray data) +{ + RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); + jint len = _env->GetArrayLength(data); + LOG_API("nAllocationRead_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len); + jfloat *ptr = _env->GetFloatArrayElements(data, NULL); + rsAllocationData((RsAllocation)alloc, ptr); + _env->ReleaseFloatArrayElements(data, ptr, JNI_COMMIT); +} // ----------------------------------- @@ -1197,6 +1218,8 @@ static JNINativeMethod methods[] = { {"nAllocationSubData1D", "(III[F)V", (void*)nAllocationSubData1D_f }, {"nAllocationSubData2D", "(IIIII[I)V", (void*)nAllocationSubData2D_i }, {"nAllocationSubData2D", "(IIIII[F)V", (void*)nAllocationSubData2D_f }, +{"nAllocationRead", "(I[I)V", (void*)nAllocationRead_i }, +{"nAllocationRead", "(I[F)V", (void*)nAllocationRead_f }, {"nTriangleMeshDestroy", "(I)V", (void*)nTriangleMeshDestroy }, {"nTriangleMeshBegin", "(II)V", (void*)nTriangleMeshBegin }, |