Commit 87c5f605 authored by Roman Sedaikin's avatar Roman Sedaikin

Revert "Fixed some performance issues in Windows OS."

This reverts commit 3ade5832.
parent 3ade5832
...@@ -22,7 +22,6 @@ public: ...@@ -22,7 +22,6 @@ public:
jobject windowRef; jobject windowRef;
HGLRC context; HGLRC context;
HWND handler; HWND handler;
HDC device;
void update() void update()
{ {
...@@ -33,7 +32,6 @@ public: ...@@ -33,7 +32,6 @@ public:
{ {
context = NULL; context = NULL;
handler = NULL; handler = NULL;
device = NULL;
} }
private: private:
...@@ -43,8 +41,33 @@ private: ...@@ -43,8 +41,33 @@ private:
{ {
JNIEnv *env; JNIEnv *env;
jvm->GetEnv((void **)&env, JNI_VERSION_10); jvm->GetEnv((void **)&env, JNI_VERSION_10);
JAWT awt;
JAWT_DrawingSurface *ds = NULL;
JAWT_DrawingSurfaceInfo *dsi = NULL;
jboolean result = JNI_FALSE;
jint lock = 0;
JAWT_Win32DrawingSurfaceInfo *dsi_win;
awt.version = (jint)JAWT_VERSION_9;
result = Skiko_GetAWT(env, &awt);
if (result == JNI_FALSE)
{
fprintf(stderr, "JAWT_GetAWT failed! Result is JNI_FALSE\n");
return;
}
ds = awt.GetDrawingSurface(env, windowRef);
lock = ds->Lock(ds);
dsi = ds->GetDrawingSurfaceInfo(ds);
dsi_win = (JAWT_Win32DrawingSurfaceInfo *)dsi->platformInfo;
HWND hwnd = dsi_win->hwnd;
HDC hdc = GetDC(hwnd);
if (dsi != NULL)
{
jvm->AttachCurrentThread((void **)&env, NULL);
wglMakeCurrent(hdc, context);
wglMakeCurrent(device, context);
jclass wndClass = env->GetObjectClass(windowRef); jclass wndClass = env->GetObjectClass(windowRef);
jmethodID drawMethod = env->GetMethodID(wndClass, "draw", "()V"); jmethodID drawMethod = env->GetMethodID(wndClass, "draw", "()V");
if (NULL == drawMethod) if (NULL == drawMethod)
...@@ -54,8 +77,11 @@ private: ...@@ -54,8 +77,11 @@ private:
} }
env->CallVoidMethod(windowRef, drawMethod); env->CallVoidMethod(windowRef, drawMethod);
glFinish(); glFinish();
wglMakeCurrent(device, NULL); SwapBuffers(hdc);
SwapBuffers(device); }
ds->FreeDrawingSurfaceInfo(dsi);
ds->Unlock(ds);
awt.FreeDrawingSurface(ds);
} }
} }
}; };
...@@ -171,7 +197,7 @@ extern "C" ...@@ -171,7 +197,7 @@ extern "C"
dsi_win = (JAWT_Win32DrawingSurfaceInfo *)dsi->platformInfo; dsi_win = (JAWT_Win32DrawingSurfaceInfo *)dsi->platformInfo;
HWND hwnd = dsi_win->hwnd; HWND hwnd = dsi_win->hwnd;
HDC device = GetDC(hwnd); HDC wndHandler = GetDC(hwnd);
if (dsi != NULL) if (dsi != NULL)
{ {
...@@ -182,10 +208,10 @@ extern "C" ...@@ -182,10 +208,10 @@ extern "C"
pixFormatDscr.iPixelType = PFD_TYPE_RGBA; pixFormatDscr.iPixelType = PFD_TYPE_RGBA;
pixFormatDscr.cColorBits = 32; pixFormatDscr.cColorBits = 32;
int iPixelFormat = ChoosePixelFormat(device, &pixFormatDscr); int iPixelFormat = ChoosePixelFormat(wndHandler, &pixFormatDscr);
SetPixelFormat(device, iPixelFormat, &pixFormatDscr); SetPixelFormat(wndHandler, iPixelFormat, &pixFormatDscr);
DescribePixelFormat(device, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pixFormatDscr); DescribePixelFormat(wndHandler, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pixFormatDscr);
context = wglCreateContext(device); context = wglCreateContext(wndHandler);
LayersSet *layer = new LayersSet(); LayersSet *layer = new LayersSet();
windowsSet->insert(layer); windowsSet->insert(layer);
...@@ -195,7 +221,6 @@ extern "C" ...@@ -195,7 +221,6 @@ extern "C"
layer->windowRef = windowRef; layer->windowRef = windowRef;
layer->context = context; layer->context = context;
layer->handler = hwnd; layer->handler = hwnd;
layer->device = device;
} }
ds->FreeDrawingSurfaceInfo(dsi); ds->FreeDrawingSurfaceInfo(dsi);
......
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