summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Brian Carlstrom <bdc@google.com> 2013-12-05 15:29:41 +0000
committer Android Git Automerger <android-git-automerger@android.com> 2013-12-05 15:29:41 +0000
commit4a657244b3de44cf28aae952b8dc76f8598c61cb (patch)
treeba64822bdaf5166b338bafc0c23a7934b4c78da4
parent66a9ebfd2fba0b94d84c6bf7bf98b9db7f9fb3b3 (diff)
parent59595f7a3e8efcefc62bbcf8e085b6da6d8ea339 (diff)
am 59595f7a: am 8026b2ce: Merge "Use exceptionCheck after VMRuntime.newNonMovableArray/addressOf."
* commit '59595f7a3e8efcefc62bbcf8e085b6da6d8ea339': Use exceptionCheck after VMRuntime.newNonMovableArray/addressOf.
-rw-r--r--core/jni/android/graphics/Graphics.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/core/jni/android/graphics/Graphics.cpp b/core/jni/android/graphics/Graphics.cpp
index 0a8eeab86ae2..38a9ba32781a 100644
--- a/core/jni/android/graphics/Graphics.cpp
+++ b/core/jni/android/graphics/Graphics.cpp
@@ -547,16 +547,20 @@ jbyteArray GraphicsJNI::allocateJavaPixelRef(JNIEnv* env, SkBitmap* bitmap,
jbyteArray arrayObj = (jbyteArray) env->CallObjectMethod(gVMRuntime,
gVMRuntime_newNonMovableArray,
gByte_class, size);
- if (arrayObj) {
- jbyte* addr = (jbyte*) env->CallLongMethod(gVMRuntime, gVMRuntime_addressOf, arrayObj);
- if (addr) {
- SkPixelRef* pr = new AndroidPixelRef(env, (void*) addr, size, arrayObj, ctable);
- bitmap->setPixelRef(pr)->unref();
- // since we're already allocated, we lockPixels right away
- // HeapAllocator behaves this way too
- bitmap->lockPixels();
- }
+ if (env->ExceptionCheck() != 0) {
+ return NULL;
+ }
+ SkASSERT(arrayObj);
+ jbyte* addr = (jbyte*) env->CallLongMethod(gVMRuntime, gVMRuntime_addressOf, arrayObj);
+ if (env->ExceptionCheck() != 0) {
+ return NULL;
}
+ SkASSERT(addr);
+ SkPixelRef* pr = new AndroidPixelRef(env, (void*) addr, size, arrayObj, ctable);
+ bitmap->setPixelRef(pr)->unref();
+ // since we're already allocated, we lockPixels right away
+ // HeapAllocator behaves this way too
+ bitmap->lockPixels();
return arrayObj;
}