Commit 17918fbc authored by Roman Sedaikin's avatar Roman Sedaikin

Fixed flickering on OpenGL/Software rendering when resizing SkiaLayer.

parent 7a9d8a69
......@@ -18,6 +18,7 @@ abstract class HardwareLayer : Canvas() {
_contentScale = getDpiScale()
}
override fun paint(g: Graphics) {}
internal open fun init() {
useDrawingSurfacePlatformInfo(::nativeInit)
......
......@@ -15,7 +15,6 @@ import java.awt.event.MouseMotionListener
import java.awt.event.MouseWheelListener
import java.awt.Graphics
import java.awt.event.HierarchyEvent
import java.awt.GridLayout
import javax.swing.JPanel
import javax.swing.SwingUtilities.invokeLater
import javax.swing.SwingUtilities.isEventDispatchThread
......@@ -34,7 +33,7 @@ open class SkiaLayer(
init {
setOpaque(false)
layout = GridLayout(1, 1)
layout = null
backedLayer = object : HardwareLayer() { }
add(backedLayer)
@Suppress("LeakingThis")
......@@ -102,6 +101,7 @@ open class SkiaLayer(
override fun setBounds(x: Int, y: Int, width: Int, height: Int) {
super.setBounds(x, y, width, height)
backedLayer.setSize(width, height)
if (backedLayer.checkContentScale()) {
contentScaleChanged()
}
......
......@@ -73,7 +73,7 @@ internal class SoftwareContextHandler(layer: SkiaLayer) : ContextHandler(layer)
null
)
image = BufferedImage(colorModel, raster!!, false, null)
layer.getGraphics()?.drawImage(image!!, 0, 0, layer.width, layer.height, null)
layer.backedLayer.getGraphics()?.drawImage(image!!, 0, 0, layer.width, layer.height, null)
}
}
......
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