Commit c58b2ea4 authored by Roman Sedaikin's avatar Roman Sedaikin

Fixed multi-window DPI support.

parent 19edb05e
...@@ -36,6 +36,7 @@ fun createWindow(title: String) { ...@@ -36,6 +36,7 @@ fun createWindow(title: String) {
val window = SkiaWindow() val window = SkiaWindow()
window.defaultCloseOperation = WindowConstants.EXIT_ON_CLOSE window.defaultCloseOperation = WindowConstants.EXIT_ON_CLOSE
window.title = title
// Create menu. // Create menu.
val menuBar = JMenuBar() val menuBar = JMenuBar()
...@@ -73,9 +74,9 @@ fun createWindow(title: String) { ...@@ -73,9 +74,9 @@ fun createWindow(title: String) {
} }
}) })
window.setVisible(true) // MANDATORY: set window size before calling setVisible(true)
// MANDATORY: set window size after calling setVisible(true)
window.setSize(800, 600) window.setSize(800, 600)
window.setVisible(true)
} }
class Renderer(val displayScene: (Renderer, Int, Int) -> Unit): SkiaRenderer { class Renderer(val displayScene: (Renderer, Int, Int) -> Unit): SkiaRenderer {
......
...@@ -70,7 +70,7 @@ open class SkiaLayer() : HardwareLayer() { ...@@ -70,7 +70,7 @@ open class SkiaLayer() : HardwareLayer() {
} }
private fun initSkija() { private fun initSkija() {
val dpi = contentScale val dpi = graphicsConfiguration.defaultTransform.scaleX.toFloat()
initRenderTarget(dpi) initRenderTarget(dpi)
initSurface() initSurface()
scaleCanvas(dpi) scaleCanvas(dpi)
......
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