Skip to content

Commit e9f5f8e

Browse files
Jason SamsAndroid (Google) Code Review
authored andcommitted
Merge "Fix readback lengths" into jb-mr1-dev
2 parents 5590027 + 3655e44 commit e9f5f8e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

graphics/jni/android_renderscript_RenderScript.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ nAllocationRead_i(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jintAr
718718
LOG_API("nAllocationRead_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len);
719719
jint *ptr = _env->GetIntArrayElements(data, NULL);
720720
jsize length = _env->GetArrayLength(data);
721-
rsAllocationRead(con, (RsAllocation)alloc, ptr, length);
721+
rsAllocationRead(con, (RsAllocation)alloc, ptr, length * sizeof(int));
722722
_env->ReleaseIntArrayElements(data, ptr, 0);
723723
}
724724

@@ -729,7 +729,7 @@ nAllocationRead_s(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jshort
729729
LOG_API("nAllocationRead_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len);
730730
jshort *ptr = _env->GetShortArrayElements(data, NULL);
731731
jsize length = _env->GetArrayLength(data);
732-
rsAllocationRead(con, (RsAllocation)alloc, ptr, length);
732+
rsAllocationRead(con, (RsAllocation)alloc, ptr, length * sizeof(short));
733733
_env->ReleaseShortArrayElements(data, ptr, 0);
734734
}
735735

@@ -740,7 +740,7 @@ nAllocationRead_b(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jbyteA
740740
LOG_API("nAllocationRead_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len);
741741
jbyte *ptr = _env->GetByteArrayElements(data, NULL);
742742
jsize length = _env->GetArrayLength(data);
743-
rsAllocationRead(con, (RsAllocation)alloc, ptr, length);
743+
rsAllocationRead(con, (RsAllocation)alloc, ptr, length * sizeof(char));
744744
_env->ReleaseByteArrayElements(data, ptr, 0);
745745
}
746746

@@ -751,7 +751,7 @@ nAllocationRead_f(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jfloat
751751
LOG_API("nAllocationRead_f, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len);
752752
jfloat *ptr = _env->GetFloatArrayElements(data, NULL);
753753
jsize length = _env->GetArrayLength(data);
754-
rsAllocationRead(con, (RsAllocation)alloc, ptr, length);
754+
rsAllocationRead(con, (RsAllocation)alloc, ptr, length * sizeof(float));
755755
_env->ReleaseFloatArrayElements(data, ptr, 0);
756756
}
757757

0 commit comments

Comments
 (0)