jvmAndroidMain.korlibs.kgl.KmlGlTools.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of korgw Show documentation
Show all versions of korgw Show documentation
Portable UI with accelerated graphics support for Kotlin
package korlibs.kgl
import korlibs.memory.*
private val smallDirectBuffer = Buffer.allocDirect(16 * 1024)
internal val Buffer.directBuffer: java.nio.ByteBuffer get() = when {
this.nioBuffer.isDirect -> this.slicedBuffer()
else -> {
if (this.sizeInBytes > smallDirectBuffer.sizeInBytes) {
this.clone(direct = true).slicedBuffer()
} else {
arraycopy(this, 0, smallDirectBuffer, 0, this.sizeInBytes)
smallDirectBuffer.slicedBuffer(0, this.sizeInBytes)
}
}
}
internal val Buffer.directIntBuffer: java.nio.IntBuffer get() = directBuffer.asIntBuffer()
internal val Buffer.directFloatBuffer: java.nio.FloatBuffer get() = directBuffer.asFloatBuffer()
© 2015 - 2025 Weber Informatics LLC | Privacy Policy