diff options
author | Miao Wang <miaowang@google.com> | 2015-03-04 16:40:21 -0800 |
---|---|---|
committer | Miao Wang <miaowang@google.com> | 2015-03-05 16:52:05 -0800 |
commit | 45cec0a9711f736df26fd097c6d74834e350f9bc (patch) | |
tree | ce861763dad707c884f2d83b30fbf0a0c9f28b15 /rs/jni/android_renderscript_RenderScript.cpp | |
parent | 8b86ee9fb5909a95a46907aede4d1b22b4ef3bba (diff) | |
download | frameworks_base-45cec0a9711f736df26fd097c6d74834e350f9bc.zip frameworks_base-45cec0a9711f736df26fd097c6d74834e350f9bc.tar.gz frameworks_base-45cec0a9711f736df26fd097c6d74834e350f9bc.tar.bz2 |
[RenderScript] Update the java API about Allocation copyTo & From FieldPacker
Change-Id: I4e1b911d4cdfec8a841bc5a8bc615c64c50e8fc8
Diffstat (limited to 'rs/jni/android_renderscript_RenderScript.cpp')
-rw-r--r-- | rs/jni/android_renderscript_RenderScript.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/rs/jni/android_renderscript_RenderScript.cpp b/rs/jni/android_renderscript_RenderScript.cpp index fa7b2bc..f2c9d31 100644 --- a/rs/jni/android_renderscript_RenderScript.cpp +++ b/rs/jni/android_renderscript_RenderScript.cpp @@ -1302,19 +1302,21 @@ nAllocationRead1D(JNIEnv *_env, jobject _this, jlong con, jlong _alloc, jint off // Copies from the Element in the Allocation pointed to by _alloc into the Java array data. static void -nAllocationElementRead(JNIEnv *_env, jobject _this, jlong con, jlong _alloc, +nAllocationElementRead(JNIEnv *_env, jobject _this, jlong con, jlong alloc, jint xoff, jint yoff, jint zoff, - jint lod, jint compIdx, jobject data, jint sizeBytes, int dataType) + jint lod, jint compIdx, jbyteArray data, jint sizeBytes) { - RsAllocation *alloc = (RsAllocation *)_alloc; + jint len = _env->GetArrayLength(data); if (kLogApi) { - ALOGD("nAllocationElementRead, con(%p), alloc(%p), xoff(%i), yoff(%i), zoff(%i), comp(%i), " - "sizeBytes(%i)", (RsContext)con, alloc, xoff, yoff, zoff, compIdx, sizeBytes); + ALOGD("nAllocationElementRead, con(%p), alloc(%p), xoff(%i), yoff(%i), zoff(%i), comp(%i), len(%i), " + "sizeBytes(%i)", (RsContext)con, (RsAllocation)alloc, xoff, yoff, zoff, compIdx, len, + sizeBytes); } - int mSize = sizeBytes; - int count = 0; - PER_ARRAY_TYPE(0, rsAllocationElementRead, false, (RsContext)con, alloc, - xoff, yoff, zoff, lod, ptr, sizeBytes, compIdx); + jbyte *ptr = _env->GetByteArrayElements(data, nullptr); + rsAllocationElementRead((RsContext)con, (RsAllocation)alloc, + xoff, yoff, zoff, + lod, ptr, sizeBytes, compIdx); + _env->ReleaseByteArrayElements(data, ptr, JNI_ABORT); } // Copies from the Allocation pointed to by _alloc into the Java object data. @@ -2377,7 +2379,7 @@ static JNINativeMethod methods[] = { {"rsnAllocationData3D", "(JJIIIIIIIJIIII)V", (void*)nAllocationData3D_alloc }, {"rsnAllocationRead", "(JJLjava/lang/Object;IIZ)V", (void*)nAllocationRead }, {"rsnAllocationRead1D", "(JJIIILjava/lang/Object;IIIZ)V", (void*)nAllocationRead1D }, -{"rsnAllocationElementRead", "(JJIIIIILjava/lang/Object;II)V", (void*)nAllocationElementRead }, +{"rsnAllocationElementRead", "(JJIIIII[BI)V", (void*)nAllocationElementRead }, {"rsnAllocationRead2D", "(JJIIIIIILjava/lang/Object;IIIZ)V", (void*)nAllocationRead2D }, {"rsnAllocationRead3D", "(JJIIIIIIILjava/lang/Object;IIIZ)V", (void*)nAllocationRead3D }, {"rsnAllocationGetType", "(JJ)J", (void*)nAllocationGetType}, |