diff options
author | Miao Wang <miaowang@google.com> | 2015-03-08 00:17:34 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-03-08 00:17:34 +0000 |
commit | de770528ec18445175ea2a1d025988c73e62d7c7 (patch) | |
tree | b6e62ddcb3d837470117ee674acacb8e9c598962 /rs/jni | |
parent | b5c8004d6fe5bca9d40e97484bf0ba88c152d067 (diff) | |
parent | 989e03f144e8031f33af08945e845283dddcc8ad (diff) | |
download | frameworks_base-de770528ec18445175ea2a1d025988c73e62d7c7.zip frameworks_base-de770528ec18445175ea2a1d025988c73e62d7c7.tar.gz frameworks_base-de770528ec18445175ea2a1d025988c73e62d7c7.tar.bz2 |
am 989e03f1: am c1e2bf95: am 4b5af9bc: Merge "[RenderScript] Update the java API about Allocation copyTo & From FieldPacker"
* commit '989e03f144e8031f33af08945e845283dddcc8ad':
[RenderScript] Update the java API about Allocation copyTo & From FieldPacker
Diffstat (limited to 'rs/jni')
-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 c139df7..8483507 100644 --- a/rs/jni/android_renderscript_RenderScript.cpp +++ b/rs/jni/android_renderscript_RenderScript.cpp @@ -1297,19 +1297,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. @@ -2372,7 +2374,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}, |