* commit '59595f7a3e8efcefc62bbcf8e085b6da6d8ea339': Use exceptionCheck after VMRuntime.newNonMovableArray/addressOf.
This commit is contained in:
@@ -547,16 +547,20 @@ jbyteArray GraphicsJNI::allocateJavaPixelRef(JNIEnv* env, SkBitmap* bitmap,
|
|||||||
jbyteArray arrayObj = (jbyteArray) env->CallObjectMethod(gVMRuntime,
|
jbyteArray arrayObj = (jbyteArray) env->CallObjectMethod(gVMRuntime,
|
||||||
gVMRuntime_newNonMovableArray,
|
gVMRuntime_newNonMovableArray,
|
||||||
gByte_class, size);
|
gByte_class, size);
|
||||||
if (arrayObj) {
|
if (env->ExceptionCheck() != 0) {
|
||||||
jbyte* addr = (jbyte*) env->CallLongMethod(gVMRuntime, gVMRuntime_addressOf, arrayObj);
|
return NULL;
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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;
|
return arrayObj;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user