Merge "Native Runtime: Add LOG_ID_CRASH"
diff --git a/core/jni/android_database_CursorWindow.cpp b/core/jni/android_database_CursorWindow.cpp
index 67f3879..af6cc72 100644
--- a/core/jni/android_database_CursorWindow.cpp
+++ b/core/jni/android_database_CursorWindow.cpp
@@ -17,6 +17,7 @@
#undef LOG_TAG
#define LOG_TAG "CursorWindow"
+#include <inttypes.h>
#include <jni.h>
#include <JNIHelp.h>
#include <android_runtime/AndroidRuntime.h>
@@ -225,7 +226,7 @@
} else if (type == CursorWindow::FIELD_TYPE_INTEGER) {
int64_t value = window->getFieldSlotValueLong(fieldSlot);
char buf[32];
- snprintf(buf, sizeof(buf), "%lld", value);
+ snprintf(buf, sizeof(buf), "%" PRId64, value);
return env->NewStringUTF(buf);
} else if (type == CursorWindow::FIELD_TYPE_FLOAT) {
double value = window->getFieldSlotValueDouble(fieldSlot);
@@ -314,7 +315,7 @@
} else if (type == CursorWindow::FIELD_TYPE_INTEGER) {
int64_t value = window->getFieldSlotValueLong(fieldSlot);
char buf[32];
- snprintf(buf, sizeof(buf), "%lld", value);
+ snprintf(buf, sizeof(buf), "%" PRId64, value);
fillCharArrayBufferUTF(env, bufferObj, buf, strlen(buf));
} else if (type == CursorWindow::FIELD_TYPE_FLOAT) {
double value = window->getFieldSlotValueDouble(fieldSlot);
diff --git a/core/jni/android_net_TrafficStats.cpp b/core/jni/android_net_TrafficStats.cpp
index f904b62..031637f 100644
--- a/core/jni/android_net_TrafficStats.cpp
+++ b/core/jni/android_net_TrafficStats.cpp
@@ -19,6 +19,7 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
+#include <inttypes.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -85,9 +86,9 @@
uint64_t rxBytes, rxPackets, txBytes, txPackets, tcpRxPackets, tcpTxPackets;
while (fgets(buffer, sizeof(buffer), fp) != NULL) {
- int matched = sscanf(buffer, "%31s %llu %llu %llu %llu "
- "%*u %llu %*u %*u %*u %*u "
- "%*u %llu %*u %*u %*u %*u", cur_iface, &rxBytes,
+ int matched = sscanf(buffer, "%31s %" SCNu64 " %" SCNu64 " %" SCNu64
+ " %" SCNu64 " " "%*u %" SCNu64 " %*u %*u %*u %*u "
+ "%*u %" SCNu64 " %*u %*u %*u %*u", cur_iface, &rxBytes,
&rxPackets, &txBytes, &txPackets, &tcpRxPackets, &tcpTxPackets);
if (matched >= 5) {
if (matched == 7) {
@@ -129,9 +130,11 @@
uint64_t tag, rxBytes, rxPackets, txBytes, txPackets;
while (fgets(buffer, sizeof(buffer), fp) != NULL) {
- if (sscanf(buffer, "%d %31s 0x%llx %u %u %llu %llu %llu %llu", &idx,
- iface, &tag, &cur_uid, &set, &rxBytes, &rxPackets, &txBytes,
- &txPackets) == 9) {
+ if (sscanf(buffer,
+ "%" SCNu32 " %31s 0x%" SCNx64 " %u %u %" SCNu64 " %" SCNu64
+ " %" SCNu64 " %" SCNu64 "",
+ &idx, iface, &tag, &cur_uid, &set, &rxBytes, &rxPackets,
+ &txBytes, &txPackets) == 9) {
if (uid == cur_uid && tag == 0L) {
stats->rxBytes += rxBytes;
stats->rxPackets += rxPackets;
diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp
index d4873d6..86207f0 100644
--- a/core/jni/android_os_Debug.cpp
+++ b/core/jni/android_os_Debug.cpp
@@ -24,6 +24,7 @@
#include <cutils/log.h>
#include <fcntl.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -824,9 +825,9 @@
break;
} else {
#ifdef __LP64__
- fprintf(fp, " %016x", backtrace[bt]);
+ fprintf(fp, " %016" PRIxPTR, backtrace[bt]);
#else
- fprintf(fp, " %08x", backtrace[bt]);
+ fprintf(fp, " %08" PRIxPTR, backtrace[bt]);
#endif
}
}
diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp
index 475e926..662af89 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -23,6 +23,7 @@
#include "JNIHelp.h"
#include <fcntl.h>
+#include <inttypes.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -334,7 +335,7 @@
if (b == NULL) {
b = new JavaBBinder(env, obj);
mBinder = b;
- ALOGV("Creating JavaBinder %p (refs %p) for Object %p, weakCount=%d\n",
+ ALOGV("Creating JavaBinder %p (refs %p) for Object %p, weakCount=%" PRId32 "\n",
b.get(), b->getWeakRefs(), obj, b->getWeakRefs()->getWeakCount());
}
@@ -697,9 +698,9 @@
"Not allowed to write file descriptors here");
break;
default:
- ALOGE("Unknown binder error code. 0x%x", err);
+ ALOGE("Unknown binder error code. 0x%" PRIx32, err);
String8 msg;
- msg.appendFormat("Unknown binder error code. 0x%x", err);
+ msg.appendFormat("Unknown binder error code. 0x%" PRIx32, err);
// RemoteException is a checked exception, only throw from certain methods.
jniThrowException(env, canThrowRemoteException
? "android/os/RemoteException" : "java/lang/RuntimeException", msg.string());
@@ -733,7 +734,7 @@
if (uid > 0 && uid < 999) {
// In Android currently there are no uids in this range.
char buf[128];
- sprintf(buf, "Restoring bad calling ident: 0x%Lx", token);
+ sprintf(buf, "Restoring bad calling ident: 0x%" PRIx64, token);
jniThrowException(env, "java/lang/IllegalStateException", buf);
return;
}
@@ -965,8 +966,8 @@
jint len = strlen(str);
int space_needed = 1 + sizeof(len) + len;
if (end - *pos < space_needed) {
- ALOGW("not enough space for string. remain=%d; needed=%d",
- (end - *pos), space_needed);
+ ALOGW("not enough space for string. remain=%" PRIdPTR "; needed=%d",
+ end - *pos, space_needed);
return false;
}
**pos = EVENT_TYPE_STRING;
@@ -981,8 +982,8 @@
static bool push_eventlog_int(char** pos, const char* end, jint val) {
int space_needed = 1 + sizeof(val);
if (end - *pos < space_needed) {
- ALOGW("not enough space for int. remain=%d; needed=%d",
- (end - *pos), space_needed);
+ ALOGW("not enough space for int. remain=%" PRIdPTR "; needed=%d",
+ end - *pos, space_needed);
return false;
}
**pos = EVENT_TYPE_INT;
@@ -1068,7 +1069,7 @@
return JNI_FALSE;
}
- ALOGV("Java code calling transact on %p in Java object %p with code %d\n",
+ ALOGV("Java code calling transact on %p in Java object %p with code %" PRId32 "\n",
target, obj, code);
#if ENABLE_BINDER_SAMPLE
diff --git a/media/jni/android_media_MediaRecorder.cpp b/media/jni/android_media_MediaRecorder.cpp
index 0cfd2ff..b74d0fb3 100644
--- a/media/jni/android_media_MediaRecorder.cpp
+++ b/media/jni/android_media_MediaRecorder.cpp
@@ -14,6 +14,13 @@
* limitations under the License.
*/
+#include <assert.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <stdio.h>
+#include <unistd.h>
+
//#define LOG_NDEBUG 0
#define LOG_TAG "MediaRecorderJNI"
#include <utils/Log.h>
@@ -22,11 +29,6 @@
#include <camera/ICameraService.h>
#include <camera/Camera.h>
#include <media/mediarecorder.h>
-#include <stdio.h>
-#include <assert.h>
-#include <limits.h>
-#include <unistd.h>
-#include <fcntl.h>
#include <utils/threads.h>
#include "jni.h"
@@ -303,7 +305,7 @@
sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
char params[64];
- sprintf(params, "max-filesize=%lld", max_filesize_bytes);
+ sprintf(params, "max-filesize=%" PRId64, max_filesize_bytes);
process_media_recorder_call(env, mr->setParameters(String8(params)), "java/lang/RuntimeException", "setMaxFileSize failed.");
}
diff --git a/media/jni/mediaeditor/VideoEditorMain.cpp b/media/jni/mediaeditor/VideoEditorMain.cpp
index 058012b..0894d74 100644
--- a/media/jni/mediaeditor/VideoEditorMain.cpp
+++ b/media/jni/mediaeditor/VideoEditorMain.cpp
@@ -16,6 +16,7 @@
#define LOG_NDEBUG 1
#define LOG_TAG "VideoEditorMain"
#include <dlfcn.h>
+#include <inttypes.h>
#include <stdio.h>
#include <unistd.h>
#include <utils/Log.h>
@@ -24,7 +25,6 @@
#include <VideoEditorJava.h>
#include <VideoEditorOsal.h>
#include <VideoEditorLogging.h>
-#include <marker.h>
#include <VideoEditorClasses.h>
#include <VideoEditorThumbnailMain.h>
#include <M4OSA_Debug.h>
@@ -438,7 +438,7 @@
M4VS, (M4OSA_Char*)"videoEdito JNI overlayFile");
if (pContext->mOverlayFileName != NULL) {
strncpy (pContext->mOverlayFileName,
- (const char*)pContext->pEditSettings->\
+ (const char*)pContext->pEditSettings->
Effects[overlayEffectIndex].xVSS.pFramingFilePath, overlayFileNameLen);
//Change the name to png file
extPos = strstr(pContext->mOverlayFileName, ".rgb");
@@ -1560,9 +1560,6 @@
int *pOverlayIndex = M4OSA_NULL;
M4OSA_Char* pTempChar = M4OSA_NULL;
- // Add a code marker (the condition must always be true).
- ADD_CODE_MARKER_FUN(NULL != pEnv)
-
// Validate the settings parameter.
videoEditJava_checkAndThrowIllegalArgumentException(&needToBeLoaded, pEnv,
(NULL == settings),
@@ -2196,10 +2193,6 @@
M4OSA_Context mContext = M4OSA_NULL;
jint* m_dst32 = M4OSA_NULL;
-
- // Add a text marker (the condition must always be true).
- ADD_TEXT_MARKER_FUN(NULL != env)
-
const char *pString = env->GetStringUTFChars(path, NULL);
if (pString == M4OSA_NULL) {
if (env != NULL) {
@@ -2537,9 +2530,6 @@
VIDEOEDIT_LOG_API(ANDROID_LOG_INFO, "VIDEO_EDITOR", "videoEditor_init()");
- // Add a text marker (the condition must always be true).
- ADD_TEXT_MARKER_FUN(NULL != pEnv)
-
// Get the context.
pContext = (ManualEditContext*)videoEditClasses_getContext(&initialized, pEnv, thiz);
@@ -2948,9 +2938,6 @@
VIDEOEDIT_LOG_API(ANDROID_LOG_INFO, "VIDEO_EDITOR", "videoEditor_loadSettings()");
- // Add a code marker (the condition must always be true).
- ADD_CODE_MARKER_FUN(NULL != pEnv)
-
// Get the context.
pContext = (ManualEditContext*)videoEditClasses_getContext(&needToBeLoaded,
pEnv, thiz);
@@ -3123,9 +3110,6 @@
VIDEOEDIT_LOG_API(ANDROID_LOG_INFO, "VIDEO_EDITOR", "videoEditor_release()");
- // Add a text marker (the condition must always be true).
- ADD_TEXT_MARKER_FUN(NULL != pEnv)
-
// Get the context.
pContext = (ManualEditContext*)videoEditClasses_getContext(&released, pEnv, thiz);
@@ -3388,7 +3372,7 @@
err = M4OSA_fileReadOpen (&inputFileHandle, pInputFileURL, M4OSA_kFileRead);
if (inputFileHandle == M4OSA_NULL) {
VIDEOEDIT_LOG_ERROR(ANDROID_LOG_INFO, "VIDEO_EDITOR",
- "M4MA_generateAudioGraphFile: Cannot open input file 0x%lx", err);
+ "M4MA_generateAudioGraphFile: Cannot open input file 0x%" PRIx32, err);
return err;
}
@@ -3422,7 +3406,7 @@
bufferIn.m_bufferSize = samplesCountInBytes*sizeof(M4OSA_UInt16);
} else {
VIDEOEDIT_LOG_ERROR(ANDROID_LOG_INFO, "VIDEO_EDITOR",
- "M4MA_generateAudioGraphFile: Malloc failed for bufferIn.m_dataAddress 0x%lx",
+ "M4MA_generateAudioGraphFile: Malloc failed for bufferIn.m_dataAddress 0x%" PRIx32,
M4ERR_ALLOC);
return M4ERR_ALLOC;
}
@@ -3462,7 +3446,7 @@
if (err != M4NO_ERROR) {
// if out value of bytes-read is 0, break
if ( numBytesToRead == 0) {
- VIDEOEDIT_LOG_ERROR(ANDROID_LOG_INFO, "VIDEO_EDITOR", "numBytesToRead 0x%lx",
+ VIDEOEDIT_LOG_ERROR(ANDROID_LOG_INFO, "VIDEO_EDITOR", "numBytesToRead 0x%" PRIx32,
numBytesToRead);
break; /* stop if file is empty or EOF */
}
@@ -3514,7 +3498,7 @@
} while (numBytesToRead != 0);
- VIDEOEDIT_LOG_ERROR(ANDROID_LOG_INFO, "VIDEO_EDITOR", "loop 0x%lx", volumeValuesCount);
+ VIDEOEDIT_LOG_ERROR(ANDROID_LOG_INFO, "VIDEO_EDITOR", "loop 0x%" PRIx32, volumeValuesCount);
/* if some error occured in fwrite */
if (numBytesToRead != 0) {
@@ -3633,15 +3617,9 @@
VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR", "JNI_OnLoad()");
- // Add a text marker (the condition must always be true).
- ADD_TEXT_MARKER_FUN(NULL != pVm)
-
// Check the JNI version.
if (pVm->GetEnv(&pEnv, JNI_VERSION_1_4) == JNI_OK)
{
- // Add a code marker (the condition must always be true).
- ADD_CODE_MARKER_FUN(NULL != pEnv)
-
// Register the manual edit JNI methods.
if (videoEditor_registerManualEditMethods((JNIEnv*)pEnv) == 0)
{
diff --git a/media/jni/mediaeditor/VideoEditorPropertiesMain.cpp b/media/jni/mediaeditor/VideoEditorPropertiesMain.cpp
index 2f8e357..ae1a80e 100644
--- a/media/jni/mediaeditor/VideoEditorPropertiesMain.cpp
+++ b/media/jni/mediaeditor/VideoEditorPropertiesMain.cpp
@@ -26,7 +26,6 @@
#include <VideoEditorOsal.h>
#include <VideoEditorLogging.h>
#include <VideoEditorOsal.h>
-#include <marker.h>
extern "C" {
#include <M4OSA_Clock.h>
@@ -107,9 +106,6 @@
ANDROID_LOG_INFO, "VIDEO_EDITOR_PROPERTIES",
"videoEditProp_getProperties()");
- // Add a text marker (the condition must always be true).
- ADD_TEXT_MARKER_FUN(NULL != pEnv)
-
// Initialize the classes.
videoEditPropClass_init(&initialized, (JNIEnv*)pEnv);
@@ -192,9 +188,6 @@
// dereferencing of pClipProperties).
if (gotten)
{
- // Add a code marker (the condition must always be true).
- ADD_CODE_MARKER_FUN(NULL != pClipProperties)
-
// Log the API call.
VIDEOEDIT_LOG_API(
ANDROID_LOG_INFO, "VIDEO_EDITOR_PROPERTIES",
@@ -316,9 +309,6 @@
videoEditOsal_free(pFile);
pFile = M4OSA_NULL;
- // Add a text marker (the condition must always be true).
- ADD_TEXT_MARKER_FUN(NULL != pEnv)
-
// Return the Properties object.
return(properties);
}
diff --git a/rs/java/android/renderscript/ScriptIntrinsicResize.java b/rs/java/android/renderscript/ScriptIntrinsicResize.java
new file mode 100644
index 0000000..cc37120
--- /dev/null
+++ b/rs/java/android/renderscript/ScriptIntrinsicResize.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript;
+
+/**
+ * Intrinsic for performing a resize of a 2D allocation.
+ * @hide
+ */
+public final class ScriptIntrinsicResize extends ScriptIntrinsic {
+ private Allocation mInput;
+
+ private ScriptIntrinsicResize(long id, RenderScript rs) {
+ super(id, rs);
+ }
+
+ /**
+ * Supported elements types are {@link Element#U8}, {@link
+ * Element#U8_2}, {@link Element#U8_3}, {@link Element#U8_4}
+ *
+ * @param rs The RenderScript context
+ *
+ * @return ScriptIntrinsicResize
+ */
+ public static ScriptIntrinsicResize create(RenderScript rs) {
+ long id = rs.nScriptIntrinsicCreate(12, 0);
+ ScriptIntrinsicResize si = new ScriptIntrinsicResize(id, rs);
+ return si;
+
+ }
+
+ /**
+ * Set the input of the resize.
+ * Must match the element type supplied during create.
+ *
+ * @param ain The input allocation.
+ */
+ public void setInput(Allocation ain) {
+ Element e = ain.getElement();
+ if (!e.isCompatible(Element.U8(mRS)) &&
+ !e.isCompatible(Element.U8_2(mRS)) &&
+ !e.isCompatible(Element.U8_3(mRS)) &&
+ !e.isCompatible(Element.U8_4(mRS))) {
+ throw new RSIllegalArgumentException("Unsuported element type.");
+ }
+
+ mInput = ain;
+ setVar(0, ain);
+ }
+
+ /**
+ * Get a FieldID for the input field of this intrinsic.
+ *
+ * @return Script.FieldID The FieldID object.
+ */
+ public Script.FieldID getFieldID_Input() {
+ return createFieldID(0, null);
+ }
+
+
+ /**
+ * Resize copy the input allocation to the output specified. The
+ * Allocation is rescaled if necessary using bi-cubic
+ * interpolation.
+ *
+ * @param aout Output allocation. Element type must match
+ * current input. Must not be same as input.
+ */
+ public void forEach_bicubic(Allocation aout) {
+ if (aout == mInput) {
+ throw new RSIllegalArgumentException("Output cannot be same as Input.");
+ }
+ forEach_bicubic(aout, null);
+ }
+
+ /**
+ * Resize copy the input allocation to the output specified. The
+ * Allocation is rescaled if necessary using bi-cubic
+ * interpolation.
+ *
+ * @param aout Output allocation. Element type must match
+ * current input.
+ * @param opt LaunchOptions for clipping
+ */
+ public void forEach_bicubic(Allocation aout, Script.LaunchOptions opt) {
+ forEach(0, null, aout, null, opt);
+ }
+
+ /**
+ * Get a KernelID for this intrinsic kernel.
+ *
+ * @return Script.KernelID The KernelID object.
+ */
+ public Script.KernelID getKernelID_bicubic() {
+ return createKernelID(0, 2, null, null);
+ }
+
+
+}
+
diff --git a/rs/jni/android_renderscript_RenderScript.cpp b/rs/jni/android_renderscript_RenderScript.cpp
index 9b89eb9..0d75f4c 100644
--- a/rs/jni/android_renderscript_RenderScript.cpp
+++ b/rs/jni/android_renderscript_RenderScript.cpp
@@ -50,24 +50,29 @@
using namespace android;
-#define PER_ARRAY_TYPE(flag, fnc, ...) { \
+#define PER_ARRAY_TYPE(flag, fnc, readonly, ...) { \
jint len = 0; \
void *ptr = NULL; \
size_t typeBytes = 0; \
+ jint relFlag = 0; \
+ if (readonly) { \
+ /* The on-release mode should only be JNI_ABORT for read-only accesses. */ \
+ relFlag = JNI_ABORT; \
+ } \
switch(dataType) { \
case RS_TYPE_FLOAT_32: \
len = _env->GetArrayLength((jfloatArray)data); \
ptr = _env->GetFloatArrayElements((jfloatArray)data, flag); \
typeBytes = 4; \
fnc(__VA_ARGS__); \
- _env->ReleaseFloatArrayElements((jfloatArray)data, (jfloat *)ptr, JNI_ABORT); \
+ _env->ReleaseFloatArrayElements((jfloatArray)data, (jfloat *)ptr, relFlag); \
return; \
case RS_TYPE_FLOAT_64: \
len = _env->GetArrayLength((jdoubleArray)data); \
ptr = _env->GetDoubleArrayElements((jdoubleArray)data, flag); \
typeBytes = 8; \
fnc(__VA_ARGS__); \
- _env->ReleaseDoubleArrayElements((jdoubleArray)data, (jdouble *)ptr, JNI_ABORT);\
+ _env->ReleaseDoubleArrayElements((jdoubleArray)data, (jdouble *)ptr, relFlag); \
return; \
case RS_TYPE_SIGNED_8: \
case RS_TYPE_UNSIGNED_8: \
@@ -75,7 +80,7 @@
ptr = _env->GetByteArrayElements((jbyteArray)data, flag); \
typeBytes = 1; \
fnc(__VA_ARGS__); \
- _env->ReleaseByteArrayElements((jbyteArray)data, (jbyte*)ptr, JNI_ABORT); \
+ _env->ReleaseByteArrayElements((jbyteArray)data, (jbyte*)ptr, relFlag); \
return; \
case RS_TYPE_SIGNED_16: \
case RS_TYPE_UNSIGNED_16: \
@@ -83,7 +88,7 @@
ptr = _env->GetShortArrayElements((jshortArray)data, flag); \
typeBytes = 2; \
fnc(__VA_ARGS__); \
- _env->ReleaseShortArrayElements((jshortArray)data, (jshort *)ptr, JNI_ABORT); \
+ _env->ReleaseShortArrayElements((jshortArray)data, (jshort *)ptr, relFlag); \
return; \
case RS_TYPE_SIGNED_32: \
case RS_TYPE_UNSIGNED_32: \
@@ -91,7 +96,7 @@
ptr = _env->GetIntArrayElements((jintArray)data, flag); \
typeBytes = 4; \
fnc(__VA_ARGS__); \
- _env->ReleaseIntArrayElements((jintArray)data, (jint *)ptr, JNI_ABORT); \
+ _env->ReleaseIntArrayElements((jintArray)data, (jint *)ptr, relFlag); \
return; \
case RS_TYPE_SIGNED_64: \
case RS_TYPE_UNSIGNED_64: \
@@ -99,7 +104,7 @@
ptr = _env->GetLongArrayElements((jlongArray)data, flag); \
typeBytes = 8; \
fnc(__VA_ARGS__); \
- _env->ReleaseLongArrayElements((jlongArray)data, (jlong *)ptr, JNI_ABORT); \
+ _env->ReleaseLongArrayElements((jlongArray)data, (jlong *)ptr, relFlag); \
return; \
default: \
break; \
@@ -675,6 +680,7 @@
}
+// Copies from the Java object data into the Allocation pointed to by _alloc.
static void
nAllocationData1D(JNIEnv *_env, jobject _this, jlong con, jlong _alloc, jint offset, jint lod,
jint count, jobject data, jint sizeBytes, jint dataType)
@@ -682,9 +688,10 @@
RsAllocation *alloc = (RsAllocation *)_alloc;
LOG_API("nAllocation1DData, con(%p), adapter(%p), offset(%i), count(%i), sizeBytes(%i), dataType(%i)",
(RsContext)con, (RsAllocation)alloc, offset, count, sizeBytes, dataType);
- PER_ARRAY_TYPE(NULL, rsAllocation1DData, (RsContext)con, alloc, offset, lod, count, ptr, sizeBytes);
+ PER_ARRAY_TYPE(NULL, rsAllocation1DData, true, (RsContext)con, alloc, offset, lod, count, ptr, sizeBytes);
}
+// Copies from the Java array data into the Allocation pointed to by alloc.
static void
// native void rsnAllocationElementData1D(long con, long id, int xoff, int compIdx, byte[] d, int sizeBytes);
nAllocationElementData1D(JNIEnv *_env, jobject _this, jlong con, jlong alloc, jint offset, jint lod, jint compIdx, jbyteArray data, jint sizeBytes)
@@ -696,6 +703,7 @@
_env->ReleaseByteArrayElements(data, ptr, JNI_ABORT);
}
+// Copies from the Java object data into the Allocation pointed to by _alloc.
static void
nAllocationData2D(JNIEnv *_env, jobject _this, jlong con, jlong _alloc, jint xoff, jint yoff, jint lod, jint _face,
jint w, jint h, jobject data, jint sizeBytes, jint dataType)
@@ -704,9 +712,11 @@
RsAllocationCubemapFace face = (RsAllocationCubemapFace)_face;
LOG_API("nAllocation2DData, con(%p), adapter(%p), xoff(%i), yoff(%i), w(%i), h(%i), len(%i) type(%i)",
(RsContext)con, alloc, xoff, yoff, w, h, sizeBytes, dataType);
- PER_ARRAY_TYPE(NULL, rsAllocation2DData, (RsContext)con, alloc, xoff, yoff, lod, face, w, h, ptr, sizeBytes, 0);
+ PER_ARRAY_TYPE(NULL, rsAllocation2DData, true, (RsContext)con, alloc, xoff, yoff, lod, face, w, h, ptr, sizeBytes, 0);
}
+// Copies from the Allocation pointed to by srcAlloc into the Allocation
+// pointed to by dstAlloc.
static void
nAllocationData2D_alloc(JNIEnv *_env, jobject _this, jlong con,
jlong dstAlloc, jint dstXoff, jint dstYoff,
@@ -731,6 +741,7 @@
srcMip, srcFace);
}
+// Copies from the Java object data into the Allocation pointed to by _alloc.
static void
nAllocationData3D(JNIEnv *_env, jobject _this, jlong con, jlong _alloc, jint xoff, jint yoff, jint zoff, jint lod,
jint w, jint h, jint d, jobject data, int sizeBytes, int dataType)
@@ -738,9 +749,11 @@
RsAllocation *alloc = (RsAllocation *)_alloc;
LOG_API("nAllocation3DData, con(%p), alloc(%p), xoff(%i), yoff(%i), zoff(%i), lod(%i), w(%i), h(%i), d(%i), sizeBytes(%i)",
(RsContext)con, (RsAllocation)alloc, xoff, yoff, zoff, lod, w, h, d, sizeBytes);
- PER_ARRAY_TYPE(NULL, rsAllocation3DData, (RsContext)con, alloc, xoff, yoff, zoff, lod, w, h, d, ptr, sizeBytes, 0);
+ PER_ARRAY_TYPE(NULL, rsAllocation3DData, true, (RsContext)con, alloc, xoff, yoff, zoff, lod, w, h, d, ptr, sizeBytes, 0);
}
+// Copies from the Allocation pointed to by srcAlloc into the Allocation
+// pointed to by dstAlloc.
static void
nAllocationData3D_alloc(JNIEnv *_env, jobject _this, jlong con,
jlong dstAlloc, jint dstXoff, jint dstYoff, jint dstZoff,
@@ -764,14 +777,16 @@
}
+// Copies from the Allocation pointed to by _alloc into the Java object data.
static void
nAllocationRead(JNIEnv *_env, jobject _this, jlong con, jlong _alloc, jobject data, int dataType)
{
RsAllocation *alloc = (RsAllocation *)_alloc;
LOG_API("nAllocationRead, con(%p), alloc(%p)", (RsContext)con, (RsAllocation)alloc);
- PER_ARRAY_TYPE(0, rsAllocationRead, (RsContext)con, alloc, ptr, len * typeBytes);
+ PER_ARRAY_TYPE(0, rsAllocationRead, false, (RsContext)con, alloc, ptr, len * typeBytes);
}
+// Copies from the Allocation pointed to by _alloc into the Java object data.
static void
nAllocationRead1D(JNIEnv *_env, jobject _this, jlong con, jlong _alloc, jint offset, jint lod,
jint count, jobject data, int sizeBytes, int dataType)
@@ -779,9 +794,10 @@
RsAllocation *alloc = (RsAllocation *)_alloc;
LOG_API("nAllocation1DRead, con(%p), adapter(%p), offset(%i), count(%i), sizeBytes(%i), dataType(%i)",
(RsContext)con, alloc, offset, count, sizeBytes, dataType);
- PER_ARRAY_TYPE(0, rsAllocation1DRead, (RsContext)con, alloc, offset, lod, count, ptr, sizeBytes);
+ PER_ARRAY_TYPE(0, rsAllocation1DRead, false, (RsContext)con, alloc, offset, lod, count, ptr, sizeBytes);
}
+// Copies from the Allocation pointed to by _alloc into the Java object data.
static void
nAllocationRead2D(JNIEnv *_env, jobject _this, jlong con, jlong _alloc, jint xoff, jint yoff, jint lod, jint _face,
jint w, jint h, jobject data, int sizeBytes, int dataType)
@@ -790,7 +806,7 @@
RsAllocationCubemapFace face = (RsAllocationCubemapFace)_face;
LOG_API("nAllocation2DRead, con(%p), adapter(%p), xoff(%i), yoff(%i), w(%i), h(%i), len(%i) type(%i)",
(RsContext)con, alloc, xoff, yoff, w, h, sizeBytes, dataType);
- PER_ARRAY_TYPE(0, rsAllocation2DRead, (RsContext)con, alloc, xoff, yoff, lod, face, w, h, ptr, sizeBytes, 0);
+ PER_ARRAY_TYPE(0, rsAllocation2DRead, false, (RsContext)con, alloc, xoff, yoff, lod, face, w, h, ptr, sizeBytes, 0);
}
static jlong
@@ -1026,7 +1042,7 @@
jint len = _env->GetArrayLength(data);
jbyte *ptr = _env->GetByteArrayElements(data, NULL);
rsScriptGetVarV((RsContext)con, (RsScript)script, slot, ptr, len);
- _env->ReleaseByteArrayElements(data, ptr, JNI_ABORT);
+ _env->ReleaseByteArrayElements(data, ptr, 0);
}
static void