Commit f9545178 authored by Nikolay Igotti's avatar Nikolay Igotti

Remove unneeded complexity.

parent 55d72a8f
...@@ -3,9 +3,6 @@ ...@@ -3,9 +3,6 @@
#import <jawt.h> #import <jawt.h>
#import <jawt_md.h> #import <jawt_md.h>
#include <dlfcn.h>
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import <QuartzCore/QuartzCore.h> #import <QuartzCore/QuartzCore.h>
#import <Metal/Metal.h> #import <Metal/Metal.h>
...@@ -113,32 +110,18 @@ JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_MetalRedrawer_makeMeta ...@@ -113,32 +110,18 @@ JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_MetalRedrawer_makeMeta
return (jlong) renderTarget; return (jlong) renderTarget;
} }
static void* objc_library() { extern "C" void* objc_autoreleasePoolPush(void);
void* result = dlopen("/usr/lib/libobjc.dylib", RTLD_LAZY | RTLD_LOCAL); extern "C" void objc_autoreleasePoolPop(void*);
return result != NULL ? result : RTLD_DEFAULT;
}
JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_MetalRedrawer_startRendering( JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_MetalRedrawer_startRendering(
JNIEnv * env, jobject redrawer) JNIEnv * env, jobject redrawer)
{ {
typedef void* (*objc_autoreleasePoolPush_t)(void);
static objc_autoreleasePoolPush_t objc_autoreleasePoolPush = NULL;
if (objc_autoreleasePoolPush == NULL) {
objc_autoreleasePoolPush = (objc_autoreleasePoolPush_t)dlsym(objc_library(), "objc_autoreleasePoolPush");
assert(objc_autoreleasePoolPush != NULL);
}
return (jlong)objc_autoreleasePoolPush(); return (jlong)objc_autoreleasePoolPush();
} }
JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_MetalRedrawer_endRendering( JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_MetalRedrawer_endRendering(
JNIEnv * env, jobject redrawer, jlong handle) JNIEnv * env, jobject redrawer, jlong handle)
{ {
typedef void (*objc_autoreleasePoolPop_t)(void*);
static objc_autoreleasePoolPop_t objc_autoreleasePoolPop = NULL;
if (objc_autoreleasePoolPop == NULL) {
objc_autoreleasePoolPop = (objc_autoreleasePoolPop_t)dlsym(objc_library(), "objc_autoreleasePoolPop");
assert(objc_autoreleasePoolPop != NULL);
}
objc_autoreleasePoolPop((void*)handle); objc_autoreleasePoolPop((void*)handle);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment