From 477856f5e92d20b55d749a5bbebf55298c9c0901 Mon Sep 17 00:00:00 2001 From: Shirasawa <764798966@qq.com> Date: Thu, 28 Dec 2023 03:50:47 +0800 Subject: [PATCH] Update --- .../eimsound/daw/components/utils/NativeCall.kt | 16 ++-------------- .../com/eimsound/dsp/data/AudioThumbnail.kt | 1 - 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/components/src/commonMain/kotlin/com/eimsound/daw/components/utils/NativeCall.kt b/components/src/commonMain/kotlin/com/eimsound/daw/components/utils/NativeCall.kt index 973321e..bebcfbd 100644 --- a/components/src/commonMain/kotlin/com/eimsound/daw/components/utils/NativeCall.kt +++ b/components/src/commonMain/kotlin/com/eimsound/daw/components/utils/NativeCall.kt @@ -32,18 +32,6 @@ private val nDrawRect: MethodHandle? = try { null } -/* - ptr: NativePointer, - verticesMode: Int, - vertexCount: Int, - cubics: InteropPointer, - colors: InteropPointer, - texCoords: InteropPointer, - indexCount: Int, - indices: InteropPointer, - blendMode: Int, - paintPtr: NativePointer - */ private val nDrawVertices: MethodHandle? = try { MethodHandles.lookup().unreflect(Class.forName("org.jetbrains.skia.CanvasKt") .getDeclaredMethod("_nDrawVertices", NativePointer::class.java, Int::class.java, @@ -130,11 +118,11 @@ fun NativePainter(modifier: Modifier, block: Canvas.(size: Size) -> Unit) { } onDrawBehind { val img = image - if (img == null) { + if (img == null || img.isClosed) { if (size.width != 0F && size.height != 0F) drawContext.canvas.nativeCanvas.block(size) } else { drawContext.canvas.nativeCanvas.drawImage(img, 0F, 0F) - if (!img.isClosed) img.close() + img.close() } } }) diff --git a/dsp/src/commonMain/kotlin/com/eimsound/dsp/data/AudioThumbnail.kt b/dsp/src/commonMain/kotlin/com/eimsound/dsp/data/AudioThumbnail.kt index 8a71116..866af96 100644 --- a/dsp/src/commonMain/kotlin/com/eimsound/dsp/data/AudioThumbnail.kt +++ b/dsp/src/commonMain/kotlin/com/eimsound/dsp/data/AudioThumbnail.kt @@ -150,7 +150,6 @@ class AudioThumbnail private constructor( return tempArray } - // 树状数组初始化 private fun buildTree() { repeat(channels) { val minT = minTree[it]