in experimental/cef/src/main/kotlin/org/jetbrains/compose/desktop/browser/BrowserView.kt [203:239]
fun view(bitmap: Bitmap, recomposer: MutableState<Any>) {
val focusRequester = FocusRequester()
Box (
modifier = Modifier.background(color = Color.White)
.fillMaxSize()
.layout { measurable, constraints ->
val placeable = measurable.measure(constraints)
handler.size = IntSize(placeable.width, placeable.height)
handler.updateBounds()
layout(placeable.width, placeable.height) {
placeable.placeRelative(0, 0)
}
}
.onGloballyPositioned { coordinates ->
handler.location = IntOffset(
coordinates.globalPosition.x.toInt(),
coordinates.globalPosition.y.toInt()
)
}
.focusRequester(focusRequester)
.focus()
.clickable(indication = null) { focusRequester.requestFocus() }
) {
Canvas(
modifier = Modifier.size(handler.size.width.dp, handler.size.height.dp)
) {
drawIntoCanvas { canvas ->
recomposer.value
canvas.nativeCanvas.drawBitmapRect(
bitmap,
IRect(0, 0, handler.size.width.toInt(), handler.size.height.toInt()).toRect()
)
}
}
}
}