Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
skiko
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liuqiang
skiko
Commits
87c5f605
Commit
87c5f605
authored
Aug 20, 2020
by
Roman Sedaikin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Fixed some performance issues in Windows OS."
This reverts commit
3ade5832
.
parent
3ade5832
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
18 deletions
+43
-18
drawlayer.cc
skiko/src/jvmMain/cpp/windows/drawlayer.cc
+43
-18
No files found.
skiko/src/jvmMain/cpp/windows/drawlayer.cc
View file @
87c5f605
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment