summaryrefslogtreecommitdiffstats
path: root/core/jni/android_graphics_PixelFormat.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2011-04-07 19:17:57 -0700
committerElliott Hughes <enh@google.com>2011-04-07 19:17:57 -0700
commit8451b25a4422656bbd6657a5855e69c0f4d53c74 (patch)
tree522e51e0927ae75dbf893884699d86c50652a761 /core/jni/android_graphics_PixelFormat.cpp
parent62c1a92dc512ef2af1bdf296f45132fa9fae7f6b (diff)
downloadframeworks_base-8451b25a4422656bbd6657a5855e69c0f4d53c74.zip
frameworks_base-8451b25a4422656bbd6657a5855e69c0f4d53c74.tar.gz
frameworks_base-8451b25a4422656bbd6657a5855e69c0f4d53c74.tar.bz2
Use jniThrowException for exception throwing from native code.
I'll do media and the generated gl stuff separately. Otherwise, this cleans up all direct calls of ThrowNew/Throw except the one in the binder that needs to remain. Change-Id: I8f95a5f020f53b25926ad31ac0c9477ddf85d04b
Diffstat (limited to 'core/jni/android_graphics_PixelFormat.cpp')
-rw-r--r--core/jni/android_graphics_PixelFormat.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/core/jni/android_graphics_PixelFormat.cpp b/core/jni/android_graphics_PixelFormat.cpp
index 5b8363c..1fc363b 100644
--- a/core/jni/android_graphics_PixelFormat.cpp
+++ b/core/jni/android_graphics_PixelFormat.cpp
@@ -20,6 +20,7 @@
#include <ui/PixelFormat.h>
#include "jni.h"
+#include "JNIHelp.h"
#include <android_runtime/AndroidRuntime.h>
#include <utils/misc.h>
@@ -36,12 +37,6 @@ struct offsets_t {
static offsets_t offsets;
-static void doThrow(JNIEnv* env, const char* exc, const char* msg = NULL)
-{
- jclass npeClazz = env->FindClass(exc);
- env->ThrowNew(npeClazz, msg);
-}
-
// ----------------------------------------------------------------------------
static void android_graphics_getPixelFormatInfo(
@@ -72,7 +67,7 @@ static void android_graphics_getPixelFormatInfo(
err = getPixelFormatInfo(format, &info);
if (err < 0) {
- doThrow(env, "java/lang/IllegalArgumentException");
+ jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
return;
}
@@ -97,7 +92,7 @@ static JNINativeMethod gMethods[] = {
void nativeClassInit(JNIEnv* env, jclass clazz)
{
offsets.bytesPerPixel = env->GetFieldID(clazz, "bytesPerPixel", "I");
- offsets.bitsPerPixel = env->GetFieldID(clazz, "bitsPerPixel", "I");
+ offsets.bitsPerPixel = env->GetFieldID(clazz, "bitsPerPixel", "I");
}
int register_android_graphics_PixelFormat(JNIEnv* env)