Unverified Commit 9c46d5cc authored by Alexander Maryanovsky's avatar Alexander Maryanovsky Committed by GitHub

Rename `SkiaLayer.awt.updateAndDrawImmediately` to `renderImmediately` (#1116)

parent afcd9e54
...@@ -432,13 +432,6 @@ actual open class SkiaLayer internal constructor( ...@@ -432,13 +432,6 @@ actual open class SkiaLayer internal constructor(
} }
} }
/**
* Updates the layer and redraws synchronously.
*/
fun updateAndDrawImmediately() {
redrawer?.renderImmediately()
}
// We need to delegate all event listeners to the Canvas (so and focus/input) // We need to delegate all event listeners to the Canvas (so and focus/input)
// Canvas is heavyweight AWT component, JPanel is lightweight Swing component // Canvas is heavyweight AWT component, JPanel is lightweight Swing component
// Event handling doesn't properly work when we mix heavyweight and lightweight components. // Event handling doesn't properly work when we mix heavyweight and lightweight components.
...@@ -557,8 +550,19 @@ actual open class SkiaLayer internal constructor( ...@@ -557,8 +550,19 @@ actual open class SkiaLayer internal constructor(
redrawer?.needRender(throttledToVsync) redrawer?.needRender(throttledToVsync)
} }
@Deprecated(
message = "Use needRender() instead",
replaceWith = ReplaceWith("needRender()")
)
actual fun needRedraw() = needRender() actual fun needRedraw() = needRender()
/**
* Updates the layer and redraws synchronously.
*/
fun renderImmediately() {
redrawer?.renderImmediately()
}
internal fun update(nanoTime: Long) { internal fun update(nanoTime: Long) {
check(isEventDispatchThread()) { "Method should be called from AWT event dispatch thread" } check(isEventDispatchThread()) { "Method should be called from AWT event dispatch thread" }
check(!isDisposed) { "SkiaLayer is disposed" } check(!isDisposed) { "SkiaLayer is disposed" }
......
...@@ -1285,7 +1285,7 @@ class SkiaLayerTest { ...@@ -1285,7 +1285,7 @@ class SkiaLayerTest {
} }
@Test @Test
fun `updateAndDrawImmediately updates and draws synchronously`() = uiTest { fun `renderImmediately updates and draws synchronously`() = uiTest {
// Check that calling both needRender(true) and needRender(false) causes only one render and one draw call // Check that calling both needRender(true) and needRender(false) causes only one render and one draw call
var renderCalls = 0 var renderCalls = 0
val renderChannel = Channel<Unit>(Channel.CONFLATED) val renderChannel = Channel<Unit>(Channel.CONFLATED)
...@@ -1322,7 +1322,7 @@ class SkiaLayerTest { ...@@ -1322,7 +1322,7 @@ class SkiaLayerTest {
val initRenderCalls = renderCalls val initRenderCalls = renderCalls
val initDrawCalls = drawCalls val initDrawCalls = drawCalls
window.layer.updateAndDrawImmediately() window.layer.renderImmediately()
// Can't check renderCalls == initRenderCalls+1 because if drawing fails, render will be called again with // Can't check renderCalls == initRenderCalls+1 because if drawing fails, render will be called again with
// the fallback renderer. // the fallback renderer.
assertTrue(renderCalls > initRenderCalls) assertTrue(renderCalls > initRenderCalls)
......
...@@ -64,8 +64,8 @@ expect open class SkiaLayer { ...@@ -64,8 +64,8 @@ expect open class SkiaLayer {
fun needRender(throttledToVsync: Boolean = true) fun needRender(throttledToVsync: Boolean = true)
@Deprecated( @Deprecated(
"Use needRender(throttledToVsync) instead", message = "Use needRender() instead",
replaceWith = ReplaceWith("needRender(throttledToVsync)") replaceWith = ReplaceWith("needRender()")
) )
fun needRedraw() // TODO: Remove this sometime after 2026-07 fun needRedraw() // TODO: Remove this sometime after 2026-07
......
...@@ -20,6 +20,10 @@ actual open class SkiaLayer { ...@@ -20,6 +20,10 @@ actual open class SkiaLayer {
actual fun needRender(throttledToVsync: Boolean) { actual fun needRender(throttledToVsync: Boolean) {
TODO("unimplemented") TODO("unimplemented")
} }
@Deprecated(
message = "Use needRender() instead",
replaceWith = ReplaceWith("needRender()")
)
actual fun needRedraw() = needRender() actual fun needRedraw() = needRender()
actual fun attachTo(container: Any) { actual fun attachTo(container: Any) {
TODO("unimplemented") TODO("unimplemented")
......
...@@ -144,6 +144,10 @@ actual open class SkiaLayer { ...@@ -144,6 +144,10 @@ actual open class SkiaLayer {
redrawer?.needRender(throttledToVsync) redrawer?.needRender(throttledToVsync)
} }
@Deprecated(
message = "Use needRender() instead",
replaceWith = ReplaceWith("needRender()")
)
actual fun needRedraw() = needRender() actual fun needRedraw() = needRender()
/** /**
......
...@@ -27,6 +27,10 @@ actual open class SkiaLayer { ...@@ -27,6 +27,10 @@ actual open class SkiaLayer {
needRedrawCallback.invoke() needRedrawCallback.invoke()
} }
@Deprecated(
message = "Use needRender() instead",
replaceWith = ReplaceWith("needRender()")
)
actual fun needRedraw() = needRender() actual fun needRedraw() = needRender()
actual val component: Any? actual val component: Any?
......
...@@ -52,6 +52,10 @@ actual open class SkiaLayer { ...@@ -52,6 +52,10 @@ actual open class SkiaLayer {
state?.needRedraw() state?.needRedraw()
} }
@Deprecated(
message = "Use needRender() instead",
replaceWith = ReplaceWith("needRender()")
)
actual fun needRedraw() = needRender() actual fun needRedraw() = needRender()
/** /**
......
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