INNER CODE UNIT · Rust
recording_counter_bitmap
free-explorers/veshell · src/embedder/backend/render/mod.rs:542
fn recording_counter_bitmap(
chip: &crate::capture::RecordingChipData,
scale: f64,
) -> Option<(Vec<u8>, Size<i32, Buffer>)> {
let font = recording_font()?;
let seconds = chip.seconds.min(99 * 60 + 59);
let text = format!("{}:{:02}", seconds / 60, seconds % 60);
// Everything is laid out on a canvas exactly the chip's size in
// integer-scale pixels, so the element can be anchored at the chip
// rectangle and the alignment cannot drift.
let integer_scale = scale.round().max(1.0);
let canvas_width = (RECORDING_CHIP_WIDTH * integer_scale).round() as i32;
let canvas_height = (RECORDING_CHIP_HEIGHT * integer_scale).round() as i32;
// Em size to make digit caps fill most of the chip; the digits share
// identical metrics, so their common box is the layout reference and