Screenshots, recording and --gfx-out keep the screen's pixels on the host
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
This commit is contained in:
Claude committed 2026-11-25 20:03:34 +00:00
1 parent 3b15248124
commit caa12058fd
13 files changed
+668 -26

No files matched your search

+8
View File
@@ -121,6 +121,12 @@ pub(all) struct ChandraCompositor {
/// Reads the screen for screenshots when the host draws it (the wasm compositor sets it);
/// None uses the software renderer's last frame.
mut frame_source : (() -> @renderer.Pixmap?)?
/// Records the screen on the host when the host draws it, so frames never cross into the
/// compositor (the wasm compositor sets it); None grabs pixels through `frame_source`.
mut frame_recorder : FrameRecorder?
/// Takes screenshots on the host when the host draws the screen (the wasm compositor sets
/// it); None crops pixels from `frame_source`.
mut frame_shots : FrameShots?
/// Screen recording (recorder.mbt): the recording running, whether it shows the pointer,
/// a press on the REC pill (its release is swallowed too) and the last video saved.
mut rec : Recording?
@@ -209,6 +215,8 @@ pub fn ChandraCompositor::new(
shot_dir: "",
last_shot: "",
frame_source: None,
frame_recorder: None,
frame_shots: None,
rec: None,
rec_pointer: true,
rec_press: false,