CI / test (push) Failing after 17s
New chandra:host/raster functions, on both hosts: write-frame-png (--gfx-out), grab-recording-frame / send-recording-frame (the recorder streams frames from the host to ffmpeg) and snapshot-frame / snapshot-png / snapshot-pixels (screenshots freeze, crop and encode the screen there; the magnifier and the notification's thumbnail read small scaled copies). The wasm compositor sets them up through frame_recorder and frame_shots; the native compositor keeps its pixel path. Moving whole frames as list<u8> is cheap for the Rust host but costs about 0.4 s a 720p frame through the wasmtime C API. A full-screen screenshot now takes 45 ms on the MoonBit host (was 472) and 8 ms on the Rust host (was 112); recording runs at 30 fps on both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hiNfjrw2edja7LiRLB
66 lines
1.9 KiB
MoonBit
66 lines
1.9 KiB
MoonBit
///| The native build draws with the software renderer (`@renderer.render_scene`); there is no host
|
|
/// to send a scene to.
|
|
|
|
///|
|
|
pub fn submit(_scene : @scene.SceneGraph) -> Unit {
|
|
abort("the host rasteriser is only available to the wasm compositor")
|
|
}
|
|
|
|
///|
|
|
pub fn read_frame(_width : Int, _height : Int) -> @renderer.Pixmap {
|
|
abort("the host rasteriser is only available to the wasm compositor")
|
|
}
|
|
|
|
///|
|
|
pub fn write_frame_png(_path : String) -> Bool {
|
|
abort("the host rasteriser is only available to the wasm compositor")
|
|
}
|
|
|
|
///|
|
|
pub fn grab_recording_frame(_r : @scene.Rect, _pointer : Bool, _px : Int, _py : Int) -> Bool {
|
|
abort("the host rasteriser is only available to the wasm compositor")
|
|
}
|
|
|
|
///|
|
|
pub fn send_recording_frame(_fd : Int) -> Int {
|
|
abort("the host rasteriser is only available to the wasm compositor")
|
|
}
|
|
|
|
///|
|
|
pub fn snapshot_frame() -> Bool {
|
|
abort("the host rasteriser is only available to the wasm compositor")
|
|
}
|
|
|
|
///|
|
|
pub fn snapshot_png(_r : @scene.Rect) -> Bytes {
|
|
abort("the host rasteriser is only available to the wasm compositor")
|
|
}
|
|
|
|
///|
|
|
pub fn snapshot_pixels(_r : @scene.Rect, _w : Int, _h : Int) -> @renderer.Pixmap {
|
|
abort("the host rasteriser is only available to the wasm compositor")
|
|
}
|
|
|
|
///| Images already loaded, by path (0: it failed, don't try again).
|
|
let loaded_images : Map[String, UInt] = {}
|
|
|
|
///| Load the image file at `path` for `Image` draw ops: a handle, or 0 when it can't be decoded.
|
|
/// The software renderer only reads PNG (an SVG icon gets 0, and the caller's fallback).
|
|
pub fn load_image(path : String) -> UInt {
|
|
match loaded_images.get(path) {
|
|
Some(h) => h
|
|
None => {
|
|
let h = if path.has_suffix(".png") {
|
|
match @renderer.decode_png(@sys.read_file_bytes(path)) {
|
|
Some(p) => @renderer.add_image(p)
|
|
None => 0U
|
|
}
|
|
} else {
|
|
0U
|
|
}
|
|
loaded_images.set(path, h)
|
|
h
|
|
}
|
|
}
|
|
}
|