Unverified Commit c66eebc2 authored by Ivan Matkov's avatar Ivan Matkov Committed by GitHub
parent 82da8dd0
...@@ -229,8 +229,6 @@ actual open class SkiaLayer internal constructor( ...@@ -229,8 +229,6 @@ actual open class SkiaLayer internal constructor(
jComponent.add(this) jComponent.add(this)
} }
private var keyEvent: KeyEvent? = null
val clipComponents = mutableListOf<ClipRectangle>() val clipComponents = mutableListOf<ClipRectangle>()
@Volatile @Volatile
...@@ -312,13 +310,32 @@ actual open class SkiaLayer internal constructor( ...@@ -312,13 +310,32 @@ actual open class SkiaLayer internal constructor(
override fun paint(g: java.awt.Graphics) { override fun paint(g: java.awt.Graphics) {
Logger.debug { "Paint called on: $this" } Logger.debug { "Paint called on: $this" }
checkContentScale() checkContentScale()
tryRedrawImmediately()
}
override fun setBounds(x: Int, y: Int, width: Int, height: Int) {
super.setBounds(x, y, width, height)
// To avoid visual artifacts on Windows/Direct3D,
// redrawing should be performed immediately, without scheduling to "later".
// Subscribing to events instead of overriding this method won't help too.
//
// Please note that calling redraw during layout might break software renderers,
// so applying this fix only for Direct3D case.
if (renderApi == GraphicsApi.DIRECT3D) {
redrawer?.syncSize()
tryRedrawImmediately()
}
}
// `paint` can be called when we already inside `draw` method. private fun tryRedrawImmediately() {
if (!isShowing) return
// It might be called inside `renderDelegate`,
// so to avoid recursive call (not supported) just schedule redrawing.
// //
// For example if we call some AWT function inside renderer.onRender, // For example if we call some AWT function inside renderer.onRender,
// such as `jframe.isEnabled = false` on Linux // such as `jframe.isEnabled = false` on Linux
//
// To avoid recursive call of `draw` (we don't support recursive calls) we just schedule redrawing.
if (isRendering) { if (isRendering) {
redrawer?.needRedraw() redrawer?.needRedraw()
} else { } else {
......
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