From f54ed82d11024a19c6d8268ba226b72b6c57dfd8 Mon Sep 17 00:00:00 2001 From: Igor Demin Date: Tue, 17 Sep 2024 18:37:44 +0200 Subject: [PATCH] Revert "Remove revalidate" This reverts commit b036927a9f9d93e3503b9821443ac17f6f7c55f1. --- .../kotlin/org/jetbrains/skiko/SkiaLayer.awt.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/skiko/src/awtMain/kotlin/org/jetbrains/skiko/SkiaLayer.awt.kt b/skiko/src/awtMain/kotlin/org/jetbrains/skiko/SkiaLayer.awt.kt index d935cfb89..7949fe235 100644 --- a/skiko/src/awtMain/kotlin/org/jetbrains/skiko/SkiaLayer.awt.kt +++ b/skiko/src/awtMain/kotlin/org/jetbrains/skiko/SkiaLayer.awt.kt @@ -137,9 +137,13 @@ actual open class SkiaLayer internal constructor( @Suppress("LeakingThis") add(backedLayer) - addHierarchyBoundsListener(object : HierarchyBoundsAdapter() { - override fun ancestorMoved(e: HierarchyEvent?) { - redrawer?.syncBounds() + addAncestorListener(object : AncestorListener { + override fun ancestorAdded(event: AncestorEvent?) = Unit + + override fun ancestorRemoved(event: AncestorEvent?) = Unit + + override fun ancestorMoved(event: AncestorEvent?) { + revalidate() } }) @@ -153,7 +157,7 @@ actual open class SkiaLayer internal constructor( addPropertyChangeListener("graphicsContextScaleTransform") { Logger.debug { "graphicsContextScaleTransform changed for $this" } latestReceivedGraphicsContextScaleTransform = it.newValue as AffineTransform - redrawer?.syncBounds() + revalidate() notifyChange(PropertyKind.ContentScale) // Workaround for JBR-5259