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
09d549dc
Commit
09d549dc
authored
Feb 18, 2021
by
Roman Sedaikin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed stretching policy when resizing window.
parent
87b52db4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
9 deletions
+34
-9
directXRedrawer.cc
skiko/src/jvmMain/cpp/windows/directXRedrawer.cc
+1
-0
PlatformOperations.kt
.../jvmMain/kotlin/org/jetbrains/skiko/PlatformOperations.kt
+18
-6
Direct3DRedrawer.kt
...n/kotlin/org/jetbrains/skiko/redrawer/Direct3DRedrawer.kt
+15
-3
No files found.
skiko/src/jvmMain/cpp/windows/directXRedrawer.cc
View file @
09d549dc
...
@@ -270,6 +270,7 @@ HRESULT D3DCompile(
...
@@ -270,6 +270,7 @@ HRESULT D3DCompile(
swapChainDesc
.
BufferUsage
=
DXGI_USAGE_RENDER_TARGET_OUTPUT
;
swapChainDesc
.
BufferUsage
=
DXGI_USAGE_RENDER_TARGET_OUTPUT
;
swapChainDesc
.
SwapEffect
=
DXGI_SWAP_EFFECT_FLIP_DISCARD
;
swapChainDesc
.
SwapEffect
=
DXGI_SWAP_EFFECT_FLIP_DISCARD
;
swapChainDesc
.
SampleDesc
.
Count
=
1
;
swapChainDesc
.
SampleDesc
.
Count
=
1
;
swapChainDesc
.
Scaling
=
DXGI_SCALING_NONE
;
DXGI_SWAP_CHAIN_FULLSCREEN_DESC
swapChainFSDesc
=
{};
DXGI_SWAP_CHAIN_FULLSCREEN_DESC
swapChainFSDesc
=
{};
swapChainFSDesc
.
Windowed
=
TRUE
;
swapChainFSDesc
.
Windowed
=
TRUE
;
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/PlatformOperations.kt
View file @
09d549dc
...
@@ -32,7 +32,11 @@ internal val platformOperations: PlatformOperations by lazy {
...
@@ -32,7 +32,11 @@ internal val platformOperations: PlatformOperations by lazy {
return
component
.
graphicsConfiguration
.
defaultTransform
.
scaleX
.
toFloat
()
return
component
.
graphicsConfiguration
.
defaultTransform
.
scaleX
.
toFloat
()
}
}
override
fun
createRedrawer
(
layer
:
HardwareLayer
,
renderApi
:
GraphicsApi
,
properties
:
SkiaLayerProperties
)
=
when
(
renderApi
)
{
override
fun
createRedrawer
(
layer
:
HardwareLayer
,
renderApi
:
GraphicsApi
,
properties
:
SkiaLayerProperties
)
=
when
(
renderApi
)
{
GraphicsApi
.
SOFTWARE
->
SoftwareRedrawer
(
layer
)
GraphicsApi
.
SOFTWARE
->
SoftwareRedrawer
(
layer
)
else
->
MacOsOpenGLRedrawer
(
layer
,
properties
)
else
->
MacOsOpenGLRedrawer
(
layer
,
properties
)
}
}
...
@@ -55,7 +59,11 @@ internal val platformOperations: PlatformOperations by lazy {
...
@@ -55,7 +59,11 @@ internal val platformOperations: PlatformOperations by lazy {
return
component
.
graphicsConfiguration
.
defaultTransform
.
scaleX
.
toFloat
()
return
component
.
graphicsConfiguration
.
defaultTransform
.
scaleX
.
toFloat
()
}
}
override
fun
createRedrawer
(
layer
:
HardwareLayer
,
renderApi
:
GraphicsApi
,
properties
:
SkiaLayerProperties
)
=
when
(
renderApi
)
{
override
fun
createRedrawer
(
layer
:
HardwareLayer
,
renderApi
:
GraphicsApi
,
properties
:
SkiaLayerProperties
)
=
when
(
renderApi
)
{
GraphicsApi
.
SOFTWARE
->
SoftwareRedrawer
(
layer
)
GraphicsApi
.
SOFTWARE
->
SoftwareRedrawer
(
layer
)
GraphicsApi
.
DIRECT3D
->
Direct3DRedrawer
(
layer
)
GraphicsApi
.
DIRECT3D
->
Direct3DRedrawer
(
layer
)
else
->
WindowsOpenGLRedrawer
(
layer
,
properties
)
else
->
WindowsOpenGLRedrawer
(
layer
,
properties
)
...
@@ -81,18 +89,22 @@ internal val platformOperations: PlatformOperations by lazy {
...
@@ -81,18 +89,22 @@ internal val platformOperations: PlatformOperations by lazy {
// TODO doesn't work well because java doesn't scale windows (content has offset with 200% scale)
// TODO doesn't work well because java doesn't scale windows (content has offset with 200% scale)
//
//
// Two solutions:
// Two solutions:
// 1. dynamically change sun.java2d.uiScale (it is global property, so we have to be careful) and update all windows
// 1. dynamically change sun.java2d.uiScale (it is global property,
// so we have to be careful) and update all windows
//
//
// 2. apply contentScale manually to all windows
// 2. apply contentScale manually to all windows
// (it is not good, because on different platform windows will have different size.
// (it is not good, because on different platform windows will have different size.
// Maybe we will apply contentScale manually on all platforms?)
// Maybe we will apply contentScale manually on all platforms?)
// see also comment for HardwareLayer.checkContentScale
// see also comment for HardwareLayer.checkContentScale
// return component.useDrawingSurfacePlatformInfo(::linuxGetDpiScaleNative)
// return component.useDrawingSurfacePlatformInfo(::linuxGetDpiScaleNative)
}
}
override
fun
createRedrawer
(
layer
:
HardwareLayer
,
renderApi
:
GraphicsApi
,
properties
:
SkiaLayerProperties
)
=
when
(
renderApi
)
{
override
fun
createRedrawer
(
layer
:
HardwareLayer
,
renderApi
:
GraphicsApi
,
properties
:
SkiaLayerProperties
)
=
when
(
renderApi
)
{
GraphicsApi
.
SOFTWARE
->
SoftwareRedrawer
(
layer
)
GraphicsApi
.
SOFTWARE
->
SoftwareRedrawer
(
layer
)
else
->
LinuxOpenGLRedrawer
(
layer
,
properties
)
else
->
LinuxOpenGLRedrawer
(
layer
,
properties
)
}
}
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/redrawer/Direct3DRedrawer.kt
View file @
09d549dc
...
@@ -11,24 +11,36 @@ internal class Direct3DRedrawer(
...
@@ -11,24 +11,36 @@ internal class Direct3DRedrawer(
private
val
layer
:
HardwareLayer
private
val
layer
:
HardwareLayer
)
:
Redrawer
{
)
:
Redrawer
{
private
var
isDisposed
=
false
private
var
device
:
Long
=
0
private
var
device
:
Long
=
0
private
val
frameDispatcher
=
FrameDispatcher
(
Dispatchers
.
Swing
)
{
private
val
frameDispatcher
=
FrameDispatcher
(
Dispatchers
.
Swing
)
{
layer
.
update
(
System
.
nanoTime
())
update
(
System
.
nanoTime
())
layer
.
draw
()
draw
()
}
}
override
fun
dispose
()
{
override
fun
dispose
()
{
frameDispatcher
.
cancel
()
frameDispatcher
.
cancel
()
disposeDevice
(
device
)
disposeDevice
(
device
)
isDisposed
=
true
}
}
override
fun
needRedraw
()
{
override
fun
needRedraw
()
{
check
(!
isDisposed
)
frameDispatcher
.
scheduleFrame
()
frameDispatcher
.
scheduleFrame
()
}
}
override
fun
redrawImmediately
()
{
override
fun
redrawImmediately
()
{
layer
.
update
(
System
.
nanoTime
())
check
(!
isDisposed
)
update
(
System
.
nanoTime
())
draw
()
}
private
fun
update
(
nanoTime
:
Long
)
{
layer
.
update
(
nanoTime
)
}
private
fun
draw
()
{
layer
.
draw
()
layer
.
draw
()
}
}
...
...
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