in skiko/src/commonMain/kotlin/org/jetbrains/skia/Surface.kt [301:331]
fun makeFromMTKView(
context: DirectContext,
mtkViewPtr: NativePointer,
origin: SurfaceOrigin,
sampleCount: Int,
colorFormat: SurfaceColorFormat,
colorSpace: ColorSpace?,
surfaceProps: SurfaceProps?
): Surface {
return try {
Stats.onNativeCall()
val ptr = interopScope {
_nMakeFromMTKView(
getPtr(context),
mtkViewPtr,
origin.ordinal,
sampleCount,
colorFormat.ordinal,
getPtr(colorSpace),
toInterop(surfaceProps?.packToIntArray())
)
}
require(ptr != NullPointer) {
"Failed Surface.makeFromMTKView($context, $mtkViewPtr $origin, $colorFormat, $surfaceProps)"
}
Surface(ptr, context)
} finally {
reachabilityBarrier(context)
reachabilityBarrier(colorSpace)
}
}