perf: fast display (row runs, bulk fills, pixel scroll), terminal draws changed cells only + scrolls pixels, print! batched (was IPC per fmt fragment), snake sleeps on timer

This commit is contained in:
2026-10-27 22:09:33 +01:00
parent 7b8258b231
commit c8056ddac6
17 changed files with 308 additions and 40 deletions

View File

@@ -10,6 +10,7 @@ pub struct MockFramebuffer {
pixels: [(ScreenCoord, ScreenCoord, Color); 4096],
pixel_count: usize,
flushed: bool,
scrolls: usize,
}
impl MockFramebuffer {
@@ -20,6 +21,7 @@ impl MockFramebuffer {
pixels: [(ScreenCoord::new(0), ScreenCoord::new(0), Color::from_raw(0)); 4096],
pixel_count: 0,
flushed: false,
scrolls: 0,
}
}
@@ -27,6 +29,11 @@ impl MockFramebuffer {
self.pixel_count
}
/// How many times the screen was scrolled.
pub fn scrolls(&self) -> usize {
self.scrolls
}
pub fn was_flushed(&self) -> bool {
self.flushed
}
@@ -62,4 +69,8 @@ impl Framebuffer for MockFramebuffer {
fn flush(&mut self) {
self.flushed = true;
}
fn scroll_up(&mut self, _top: ScreenCoord, _height: Dimension, _by: Dimension, _fill: Color) {
self.scrolls += 1;
}
}