attach jni to ui thread, fix bucket bounding box

This commit is contained in:
2019-07-14 15:59:34 +02:00
parent 80b78ac0af
commit f93be10883
3 changed files with 22 additions and 2 deletions

View File

@@ -62,7 +62,7 @@ EGLContext g_context = EGL_NO_CONTEXT;
std::recursive_mutex mutex;
int mutex_count = 0;
struct engine g_engine;
JNIEnv* jni;
thread_local JNIEnv* jni;
jint JNI_OnLoad(JavaVM* vm, void* /*reserved*/)
{
@@ -118,6 +118,16 @@ int GetUnicodeChar(struct android_app* app, int eventType, int keyCode, int meta
return unicodeKey;
}
void android_attach_jni()
{
g_engine.app->activity->vm->AttachCurrentThread(&jni, nullptr);
}
void android_detach_jni()
{
g_engine.app->activity->vm->DetachCurrentThread();
}
void android_async_lock(struct engine* engine)
{
mutex.lock();