Commit 53de0626 authored by Igor Demin's avatar Igor Demin Committed by Igor Demin

JNI refactoring. Extract reinterpret_cast/static_cast to helper functions

parent 44e81329
#include <cstdint> #include <cstdint>
#include <jawt_md.h> #include <jawt_md.h>
#include "jni_helpers.h"
extern "C" jboolean Skiko_GetAWT(JNIEnv *env, JAWT *awt); extern "C" jboolean Skiko_GetAWT(JNIEnv *env, JAWT *awt);
...@@ -17,53 +18,53 @@ extern "C" ...@@ -17,53 +18,53 @@ extern "C"
} }
else else
{ {
return static_cast<jlong>(reinterpret_cast<uintptr_t>(awt)); return toJavaPointer(awt);
} }
} }
JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_AWTKt_getDrawingSurface(JNIEnv *env, jobject obj, jlong awtPtr, jobject layer) JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_AWTKt_getDrawingSurface(JNIEnv *env, jobject obj, jlong awtPtr, jobject layer)
{ {
JAWT *awt = reinterpret_cast<JAWT *>(static_cast<uintptr_t>(awtPtr)); JAWT *awt = fromJavaPointer<JAWT *>(awtPtr);
JAWT_DrawingSurface *ds = awt->GetDrawingSurface(env, layer); JAWT_DrawingSurface *ds = awt->GetDrawingSurface(env, layer);
return static_cast<jlong>(reinterpret_cast<uintptr_t>(ds)); return toJavaPointer(ds);
} }
JNIEXPORT void JNICALL Java_org_jetbrains_skiko_AWTKt_freeDrawingSurface(JNIEnv *env, jobject obj, jlong awtPtr, jlong drawingSurfacePtr) JNIEXPORT void JNICALL Java_org_jetbrains_skiko_AWTKt_freeDrawingSurface(JNIEnv *env, jobject obj, jlong awtPtr, jlong drawingSurfacePtr)
{ {
JAWT *awt = reinterpret_cast<JAWT *>(static_cast<uintptr_t>(awtPtr)); JAWT *awt = fromJavaPointer<JAWT *>(awtPtr);
JAWT_DrawingSurface *ds = reinterpret_cast<JAWT_DrawingSurface *>(static_cast<uintptr_t>(drawingSurfacePtr)); JAWT_DrawingSurface *ds = fromJavaPointer<JAWT_DrawingSurface *>(drawingSurfacePtr);
awt->FreeDrawingSurface(ds); awt->FreeDrawingSurface(ds);
} }
JNIEXPORT void JNICALL Java_org_jetbrains_skiko_AWTKt_lockDrawingSurface(JNIEnv *env, jobject obj, jlong drawingSurfacePtr) JNIEXPORT void JNICALL Java_org_jetbrains_skiko_AWTKt_lockDrawingSurface(JNIEnv *env, jobject obj, jlong drawingSurfacePtr)
{ {
JAWT_DrawingSurface *ds = reinterpret_cast<JAWT_DrawingSurface *>(static_cast<uintptr_t>(drawingSurfacePtr)); JAWT_DrawingSurface *ds = fromJavaPointer<JAWT_DrawingSurface *>(drawingSurfacePtr);
ds->Lock(ds); ds->Lock(ds);
} }
JNIEXPORT void JNICALL Java_org_jetbrains_skiko_AWTKt_unlockDrawingSurface(JNIEnv *env, jobject obj, jlong drawingSurfacePtr) JNIEXPORT void JNICALL Java_org_jetbrains_skiko_AWTKt_unlockDrawingSurface(JNIEnv *env, jobject obj, jlong drawingSurfacePtr)
{ {
JAWT_DrawingSurface *ds = reinterpret_cast<JAWT_DrawingSurface *>(static_cast<uintptr_t>(drawingSurfacePtr)); JAWT_DrawingSurface *ds = fromJavaPointer<JAWT_DrawingSurface *>(drawingSurfacePtr);
ds->Unlock(ds); ds->Unlock(ds);
} }
JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_AWTKt_getDrawingSurfaceInfo(JNIEnv *env, jobject obj, jlong drawingSurfacePtr) JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_AWTKt_getDrawingSurfaceInfo(JNIEnv *env, jobject obj, jlong drawingSurfacePtr)
{ {
JAWT_DrawingSurface *ds = reinterpret_cast<JAWT_DrawingSurface *>(static_cast<uintptr_t>(drawingSurfacePtr)); JAWT_DrawingSurface *ds = fromJavaPointer<JAWT_DrawingSurface *>(drawingSurfacePtr);
JAWT_DrawingSurfaceInfo *dsi = ds->GetDrawingSurfaceInfo(ds); JAWT_DrawingSurfaceInfo *dsi = ds->GetDrawingSurfaceInfo(ds);
return static_cast<jlong>(reinterpret_cast<uintptr_t>(dsi)); return toJavaPointer(dsi);
} }
JNIEXPORT void JNICALL Java_org_jetbrains_skiko_AWTKt_freeDrawingSurfaceInfo(JNIEnv *env, jobject obj, jlong drawingSurfacePtr, jlong drawingSurfaceInfoPtr) JNIEXPORT void JNICALL Java_org_jetbrains_skiko_AWTKt_freeDrawingSurfaceInfo(JNIEnv *env, jobject obj, jlong drawingSurfacePtr, jlong drawingSurfaceInfoPtr)
{ {
JAWT_DrawingSurface *ds = reinterpret_cast<JAWT_DrawingSurface *>(static_cast<uintptr_t>(drawingSurfacePtr)); JAWT_DrawingSurface *ds = fromJavaPointer<JAWT_DrawingSurface *>(drawingSurfacePtr);
JAWT_DrawingSurfaceInfo *dsi = reinterpret_cast<JAWT_DrawingSurfaceInfo *>(static_cast<uintptr_t>(drawingSurfaceInfoPtr)); JAWT_DrawingSurfaceInfo *dsi = fromJavaPointer<JAWT_DrawingSurfaceInfo *>(drawingSurfaceInfoPtr);
ds->FreeDrawingSurfaceInfo(dsi); ds->FreeDrawingSurfaceInfo(dsi);
} }
JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_AWTKt_getPlatformInfo(JNIEnv *env, jobject obj, jlong drawingSurfaceInfoPtr) JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_AWTKt_getPlatformInfo(JNIEnv *env, jobject obj, jlong drawingSurfaceInfoPtr)
{ {
JAWT_DrawingSurfaceInfo *dsi = reinterpret_cast<JAWT_DrawingSurfaceInfo *>(static_cast<uintptr_t>(drawingSurfaceInfoPtr)); JAWT_DrawingSurfaceInfo *dsi = fromJavaPointer<JAWT_DrawingSurfaceInfo *>(drawingSurfaceInfoPtr);
return static_cast<jlong>(reinterpret_cast<uintptr_t>(dsi->platformInfo)); return toJavaPointer(dsi->platformInfo);
} }
} }
\ No newline at end of file
#pragma once
template<typename T>
T fromJavaPointer(jlong ptr) { return reinterpret_cast<T>(static_cast<uintptr_t>(ptr)); }
template<typename T>
jlong toJavaPointer(T ptr) { return static_cast<jlong>(reinterpret_cast<uintptr_t>(ptr)); }
\ No newline at end of file
...@@ -7,11 +7,10 @@ ...@@ -7,11 +7,10 @@
#include <cstdlib> #include <cstdlib>
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include "../common/jni_helpers.h"
typedef GLXContext (*glXCreateContextAttribsARBProc)(Display *, GLXFBConfig, GLXContext, Bool, const int *); typedef GLXContext (*glXCreateContextAttribsARBProc)(Display *, GLXFBConfig, GLXContext, Bool, const int *);
extern "C" jboolean Skiko_GetAWT(JNIEnv *env, JAWT *awt);
extern "C" extern "C"
{ {
JNIEXPORT void JNICALL Java_org_jetbrains_skiko_HardwareLayer_nativeInit(JNIEnv *env, jobject canvas, jlong platformInfoPtr) JNIEXPORT void JNICALL Java_org_jetbrains_skiko_HardwareLayer_nativeInit(JNIEnv *env, jobject canvas, jlong platformInfoPtr)
...@@ -24,7 +23,7 @@ extern "C" ...@@ -24,7 +23,7 @@ extern "C"
JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_HardwareLayer_getWindowHandle(JNIEnv *env, jobject canvas, jlong platformInfoPtr) JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_HardwareLayer_getWindowHandle(JNIEnv *env, jobject canvas, jlong platformInfoPtr)
{ {
JAWT_X11DrawingSurfaceInfo *dsi_x11 = reinterpret_cast<JAWT_X11DrawingSurfaceInfo *>(static_cast<uintptr_t>(platformInfoPtr)); JAWT_X11DrawingSurfaceInfo *dsi_x11 = fromJavaPointer<JAWT_X11DrawingSurfaceInfo *>(platformInfoPtr);
return (jlong) dsi_x11->drawable; return (jlong) dsi_x11->drawable;
} }
...@@ -52,7 +51,7 @@ extern "C" ...@@ -52,7 +51,7 @@ extern "C"
JNIEXPORT jfloat JNICALL Java_org_jetbrains_skiko_PlatformOperationsKt_linuxGetDpiScaleNative(JNIEnv *env, jobject properties, jlong platformInfoPtr) JNIEXPORT jfloat JNICALL Java_org_jetbrains_skiko_PlatformOperationsKt_linuxGetDpiScaleNative(JNIEnv *env, jobject properties, jlong platformInfoPtr)
{ {
JAWT_X11DrawingSurfaceInfo *dsi_x11 = reinterpret_cast<JAWT_X11DrawingSurfaceInfo *>(static_cast<uintptr_t>(platformInfoPtr)); JAWT_X11DrawingSurfaceInfo *dsi_x11 = fromJavaPointer<JAWT_X11DrawingSurfaceInfo *>(platformInfoPtr);
return (float) getDpiScaleByDisplay(dsi_x11->display); return (float) getDpiScaleByDisplay(dsi_x11->display);
} }
} // extern "C" } // extern "C"
\ No newline at end of file
...@@ -7,31 +7,30 @@ ...@@ -7,31 +7,30 @@
#include <cstdlib> #include <cstdlib>
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include "../common/jni_helpers.h"
typedef GLXContext (*glXCreateContextAttribsARBProc)(Display *, GLXFBConfig, GLXContext, Bool, const int *); typedef GLXContext (*glXCreateContextAttribsARBProc)(Display *, GLXFBConfig, GLXContext, Bool, const int *);
extern "C" jboolean Skiko_GetAWT(JNIEnv *env, JAWT *awt);
extern "C" extern "C"
{ {
JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_LinuxOpenGLRedrawerKt_getDisplay(JNIEnv *env, jobject redrawer, jlong platformInfoPtr) JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_LinuxOpenGLRedrawerKt_getDisplay(JNIEnv *env, jobject redrawer, jlong platformInfoPtr)
{ {
JAWT_X11DrawingSurfaceInfo *dsi_x11 = reinterpret_cast<JAWT_X11DrawingSurfaceInfo *>(static_cast<uintptr_t>(platformInfoPtr)); JAWT_X11DrawingSurfaceInfo *dsi_x11 = fromJavaPointer<JAWT_X11DrawingSurfaceInfo *>(platformInfoPtr);
Display *display = dsi_x11->display; Display *display = dsi_x11->display;
return static_cast<jlong>(reinterpret_cast<uintptr_t>(display)); return toJavaPointer(display);
} }
JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_LinuxOpenGLRedrawerKt_getWindow(JNIEnv *env, jobject redrawer, jlong platformInfoPtr) JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_LinuxOpenGLRedrawerKt_getWindow(JNIEnv *env, jobject redrawer, jlong platformInfoPtr)
{ {
JAWT_X11DrawingSurfaceInfo *dsi_x11 = reinterpret_cast<JAWT_X11DrawingSurfaceInfo *>(static_cast<uintptr_t>(platformInfoPtr)); JAWT_X11DrawingSurfaceInfo *dsi_x11 = fromJavaPointer<JAWT_X11DrawingSurfaceInfo *>(platformInfoPtr);
Window window = dsi_x11->drawable; Window window = dsi_x11->drawable;
return static_cast<jlong>(reinterpret_cast<uintptr_t>(window)); return toJavaPointer(window);
} }
JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_LinuxOpenGLRedrawerKt_setSwapInterval(JNIEnv *env, jobject redrawer, jlong displayPtr, jlong windowPtr, jint interval) JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_LinuxOpenGLRedrawerKt_setSwapInterval(JNIEnv *env, jobject redrawer, jlong displayPtr, jlong windowPtr, jint interval)
{ {
Display *display = reinterpret_cast<Display *>(static_cast<uintptr_t>(displayPtr)); Display *display = fromJavaPointer<Display *>(displayPtr);
Window window = reinterpret_cast<Window>(static_cast<uintptr_t>(windowPtr)); Window window = fromJavaPointer<Window>(windowPtr);
// according to: // according to:
// https://opengl.gpuinfo.org/listreports.php?extension=GLX_EXT_swap_control // https://opengl.gpuinfo.org/listreports.php?extension=GLX_EXT_swap_control
...@@ -63,35 +62,35 @@ extern "C" ...@@ -63,35 +62,35 @@ extern "C"
JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_LinuxOpenGLRedrawerKt_swapBuffers(JNIEnv *env, jobject redrawer, jlong displayPtr, jlong windowPtr) JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_LinuxOpenGLRedrawerKt_swapBuffers(JNIEnv *env, jobject redrawer, jlong displayPtr, jlong windowPtr)
{ {
Display *display = reinterpret_cast<Display *>(static_cast<uintptr_t>(displayPtr)); Display *display = fromJavaPointer<Display *>(displayPtr);
Window window = reinterpret_cast<Window>(static_cast<uintptr_t>(windowPtr)); Window window = fromJavaPointer<Window>(windowPtr);
glXSwapBuffers(display, window); glXSwapBuffers(display, window);
} }
JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_LinuxOpenGLRedrawerKt_makeCurrent(JNIEnv *env, jobject redrawer, jlong displayPtr, jlong windowPtr, jlong contextPtr) JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_LinuxOpenGLRedrawerKt_makeCurrent(JNIEnv *env, jobject redrawer, jlong displayPtr, jlong windowPtr, jlong contextPtr)
{ {
Display *display = reinterpret_cast<Display *>(static_cast<uintptr_t>(displayPtr)); Display *display = fromJavaPointer<Display *>(displayPtr);
Window window = reinterpret_cast<Window>(static_cast<uintptr_t>(windowPtr)); Window window = fromJavaPointer<Window>(windowPtr);
GLXContext *context = reinterpret_cast<GLXContext *>(static_cast<uintptr_t>(contextPtr)); GLXContext *context = fromJavaPointer<GLXContext *>(contextPtr);
glXMakeCurrent(display, window, *context); glXMakeCurrent(display, window, *context);
} }
JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_LinuxOpenGLRedrawerKt_createContext(JNIEnv *env, jobject redrawer, jlong displayPtr) JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_LinuxOpenGLRedrawerKt_createContext(JNIEnv *env, jobject redrawer, jlong displayPtr)
{ {
Display *display = reinterpret_cast<Display *>(static_cast<uintptr_t>(displayPtr)); Display *display = fromJavaPointer<Display *>(displayPtr);
GLint att[] = {GLX_RGBA, GLX_DOUBLEBUFFER, True, None}; GLint att[] = {GLX_RGBA, GLX_DOUBLEBUFFER, True, None};
XVisualInfo *vi = glXChooseVisual(display, 0, att); XVisualInfo *vi = glXChooseVisual(display, 0, att);
GLXContext *context = new GLXContext(glXCreateContext(display, vi, NULL, GL_TRUE)); GLXContext *context = new GLXContext(glXCreateContext(display, vi, NULL, GL_TRUE));
return static_cast<jlong>(reinterpret_cast<uintptr_t>(context)); return toJavaPointer(context);
} }
JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_LinuxOpenGLRedrawerKt_destroyContext(JNIEnv *env, jobject redrawer, jlong displayPtr, jlong contextPtr) JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_LinuxOpenGLRedrawerKt_destroyContext(JNIEnv *env, jobject redrawer, jlong displayPtr, jlong contextPtr)
{ {
Display *display = reinterpret_cast<Display *>(static_cast<uintptr_t>(displayPtr)); Display *display = fromJavaPointer<Display *>(displayPtr);
GLXContext *context = reinterpret_cast<GLXContext *>(static_cast<uintptr_t>(contextPtr)); GLXContext *context = fromJavaPointer<GLXContext *>(contextPtr);
glXDestroyContext(display, *context); glXDestroyContext(display, *context);
delete context; delete context;
......
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <jawt_md.h> #include <jawt_md.h>
#include "../common/jni_helpers.h"
extern "C" jboolean Skiko_GetAWT(JNIEnv *env, JAWT *awt);
extern "C" extern "C"
{ {
...@@ -15,7 +14,7 @@ extern "C" ...@@ -15,7 +14,7 @@ extern "C"
JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_HardwareLayer_getWindowHandle(JNIEnv *env, jobject canvas, jlong platformInfoPtr) JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_HardwareLayer_getWindowHandle(JNIEnv *env, jobject canvas, jlong platformInfoPtr)
{ {
JAWT_Win32DrawingSurfaceInfo* dsi_win = reinterpret_cast<JAWT_Win32DrawingSurfaceInfo *>(static_cast<uintptr_t>(platformInfoPtr)); JAWT_Win32DrawingSurfaceInfo* dsi_win = fromJavaPointer<JAWT_Win32DrawingSurfaceInfo *>(platformInfoPtr);
return (jlong) dsi_win->hwnd; return (jlong) dsi_win->hwnd;
} }
} // extern "C" } // extern "C"
\ No newline at end of file
...@@ -3,14 +3,13 @@ ...@@ -3,14 +3,13 @@
#include <gl/GL.h> #include <gl/GL.h>
#include <jawt_md.h> #include <jawt_md.h>
#include <dwmapi.h> #include <dwmapi.h>
#include "../common/jni_helpers.h"
extern "C" jboolean Skiko_GetAWT(JNIEnv *env, JAWT *awt);
extern "C" extern "C"
{ {
JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_WindowsOpenGLRedrawerKt_getDevice(JNIEnv *env, jobject redrawer, jlong platformInfoPtr) JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_WindowsOpenGLRedrawerKt_getDevice(JNIEnv *env, jobject redrawer, jlong platformInfoPtr)
{ {
JAWT_Win32DrawingSurfaceInfo* dsi_win = reinterpret_cast<JAWT_Win32DrawingSurfaceInfo *>(static_cast<uintptr_t>(platformInfoPtr)); JAWT_Win32DrawingSurfaceInfo* dsi_win = fromJavaPointer<JAWT_Win32DrawingSurfaceInfo *>(platformInfoPtr);
HWND hwnd = dsi_win->hwnd; HWND hwnd = dsi_win->hwnd;
HDC device = GetDC(hwnd); HDC device = GetDC(hwnd);
...@@ -27,7 +26,7 @@ extern "C" ...@@ -27,7 +26,7 @@ extern "C"
SetPixelFormat(device, iPixelFormat, &pixFormatDscr); SetPixelFormat(device, iPixelFormat, &pixFormatDscr);
DescribePixelFormat(device, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pixFormatDscr); DescribePixelFormat(device, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pixFormatDscr);
return static_cast<jlong>(reinterpret_cast<uintptr_t>(device)); return toJavaPointer(device);
} }
JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_WindowsOpenGLRedrawerKt_setSwapInterval(JNIEnv *env, jobject redrawer, jint interval) JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_WindowsOpenGLRedrawerKt_setSwapInterval(JNIEnv *env, jobject redrawer, jint interval)
...@@ -44,26 +43,26 @@ extern "C" ...@@ -44,26 +43,26 @@ extern "C"
JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_WindowsOpenGLRedrawerKt_swapBuffers(JNIEnv *env, jobject redrawer, jlong devicePtr) JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_WindowsOpenGLRedrawerKt_swapBuffers(JNIEnv *env, jobject redrawer, jlong devicePtr)
{ {
HDC device = reinterpret_cast<HDC>(static_cast<uintptr_t>(devicePtr)); HDC device = fromJavaPointer<HDC>(devicePtr);
SwapBuffers(device); SwapBuffers(device);
} }
JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_WindowsOpenGLRedrawerKt_makeCurrent(JNIEnv *env, jobject redrawer, jlong devicePtr, jlong contextPtr) JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_WindowsOpenGLRedrawerKt_makeCurrent(JNIEnv *env, jobject redrawer, jlong devicePtr, jlong contextPtr)
{ {
HDC device = reinterpret_cast<HDC>(static_cast<uintptr_t>(devicePtr)); HDC device = fromJavaPointer<HDC>(devicePtr);
HGLRC context = reinterpret_cast<HGLRC>(static_cast<uintptr_t>(contextPtr)); HGLRC context = fromJavaPointer<HGLRC>(contextPtr);
wglMakeCurrent(device, context); wglMakeCurrent(device, context);
} }
JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_WindowsOpenGLRedrawerKt_createContext(JNIEnv *env, jobject redrawer, jlong devicePtr) JNIEXPORT jlong JNICALL Java_org_jetbrains_skiko_redrawer_WindowsOpenGLRedrawerKt_createContext(JNIEnv *env, jobject redrawer, jlong devicePtr)
{ {
HDC device = reinterpret_cast<HDC>(static_cast<uintptr_t>(devicePtr)); HDC device = fromJavaPointer<HDC>(devicePtr);
return static_cast<jlong>(reinterpret_cast<uintptr_t>(wglCreateContext(device))); return toJavaPointer(wglCreateContext(device));
} }
JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_WindowsOpenGLRedrawerKt_deleteContext(JNIEnv *env, jobject redrawer, jlong contextPtr) JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_WindowsOpenGLRedrawerKt_deleteContext(JNIEnv *env, jobject redrawer, jlong contextPtr)
{ {
HGLRC context = reinterpret_cast<HGLRC>(static_cast<uintptr_t>(contextPtr)); HGLRC context = fromJavaPointer<HGLRC>(contextPtr);
wglDeleteContext(context); wglDeleteContext(context);
} }
......
...@@ -79,8 +79,6 @@ LayerHandler * findByObject(JNIEnv *env, jobject object) ...@@ -79,8 +79,6 @@ LayerHandler * findByObject(JNIEnv *env, jobject object)
return NULL; return NULL;
} }
extern jboolean Skiko_GetAWT(JNIEnv* env, JAWT* awt);
JNIEXPORT void JNICALL Java_org_jetbrains_skiko_HardwareLayer_nativeInit(JNIEnv *env, jobject canvas, jlong platformInfoPtr) JNIEXPORT void JNICALL Java_org_jetbrains_skiko_HardwareLayer_nativeInit(JNIEnv *env, jobject canvas, jlong platformInfoPtr)
{ {
if (layerStorage == nil) if (layerStorage == nil)
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#import <QuartzCore/QuartzCore.h> #import <QuartzCore/QuartzCore.h>
#import <OpenGL/gl3.h> #import <OpenGL/gl3.h>
extern jboolean Skiko_GetAWT(JNIEnv* env, JAWT* awt);
JavaVM *jvm = NULL; JavaVM *jvm = NULL;
@interface AWTGLLayer : CAOpenGLLayer @interface AWTGLLayer : CAOpenGLLayer
......
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