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