Commit 44e81329 authored by Igor Demin's avatar Igor Demin

AWT.kt, awt_jni.cc. Refactoring

parent 07d5e63f
......@@ -14,7 +14,9 @@ extern "C"
if (result == JNI_FALSE)
{
return 0;
} else {
}
else
{
return static_cast<jlong>(reinterpret_cast<uintptr_t>(awt));
}
}
......
......@@ -25,9 +25,11 @@ internal fun Component.getDrawingSurface() = DrawingSurface(this)
internal class DrawingSurface(
component: Component
) : AutoCloseable {
val ptr = getDrawingSurface(awt, component).also {
check(it != 0L)
}
var ptr =
getDrawingSurface(awt, component).also {
check(it != 0L)
}
private set
fun lock() = lockDrawingSurface(ptr)
......@@ -46,20 +48,24 @@ internal class DrawingSurface(
override fun close() {
freeDrawingSurface(awt, ptr)
ptr = 0
}
}
internal class DrawingSurfaceInfo(
private val drawingSurface: Long
) : AutoCloseable {
val ptr = getDrawingSurfaceInfo(drawingSurface).also {
check(it != 0L)
}
var ptr =
getDrawingSurfaceInfo(drawingSurface).also {
check(it != 0L)
}
private set
val platformInfo: Long get() = getPlatformInfo(ptr)
override fun close() {
freeDrawingSurfaceInfo(drawingSurface, ptr)
ptr = 0
}
}
......
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