diff options
Diffstat (limited to 'platform/android/src/bitmap_factory.cpp')
-rw-r--r-- | platform/android/src/bitmap_factory.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/platform/android/src/bitmap_factory.cpp b/platform/android/src/bitmap_factory.cpp index 7d9b068b20..79cdc913a0 100644 --- a/platform/android/src/bitmap_factory.cpp +++ b/platform/android/src/bitmap_factory.cpp @@ -4,20 +4,20 @@ namespace mbgl { namespace android { void BitmapFactory::registerNative(jni::JNIEnv& env) { - _class = *jni::Class<BitmapFactory>::Find(env).NewGlobalRef(env).release(); + jni::Class<BitmapFactory>::Singleton(env); } -jni::Class<BitmapFactory> BitmapFactory::_class; - jni::Object<Bitmap> BitmapFactory::DecodeByteArray(jni::JNIEnv& env, jni::Array<jni::jbyte> data, jni::jint offset, jni::jint length) { + static auto _class = jni::Class<BitmapFactory>::Singleton(env); // Images are loaded with ARGB_8888 config, and premultiplied by default, which is exactly // what we want, so we're not providing a BitmapFactory.Options object. - using Signature = jni::Object<Bitmap>(jni::Array<jni::jbyte>, jni::jint, jni::jint); - auto method = _class.GetStaticMethod<Signature>(env, "decodeByteArray"); + using Signature = jni::Object<Bitmap> (jni::Array<jni::jbyte>, jni::jint, jni::jint); + static auto method = _class.GetStaticMethod<Signature>(env, "decodeByteArray"); + return _class.Call(env, method, data, offset, length); } |