feat(init,display): loader streams ELF segments (any size, kills half-built proc); window pixels RGBA8 premul (tiny-skia native), canvas mapped plain memory + pixels_mut/touch

This commit is contained in:
2026-10-28 02:57:05 +01:00
parent 864f039bc7
commit 07a0575908
4 changed files with 156 additions and 89 deletions

View File

@@ -16,6 +16,17 @@ impl Color {
pub const fn rgba(r: u8, g: u8, b: u8, a: u8) -> Self {
Self(((a as u32) << 24) | ((r as u32) << 16) | ((g as u32) << 8) | (b as u32))
}
/// As a window's pixel is stored: the bytes R, G, B, A (see
/// `window::BUFFER`).
pub const fn to_rgba(self) -> [u8; 4] {
let [b, g, r, a] = self.0.to_le_bytes();
[r, g, b, a]
}
pub const fn from_rgba([r, g, b, a]: [u8; 4]) -> Self {
Self(u32::from_le_bytes([b, g, r, a]))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
@@ -61,9 +72,10 @@ pub mod window {
/// (`pack_name`). Reply `[OK, width, height, 0]` carrying the window
/// capability, which the launcher passes on; the new window is in front.
pub const OPEN: usize = 1;
/// Through a window: reply `[OK, width, height, 0]` carrying its pixel buffer, a
/// region the holder maps read-write: `width * height` pixels, rows
/// one after another, each pixel a `Color` as a little-endian u32.
/// Through a window: reply `[OK, width, height, 0]` carrying its pixel
/// buffer, a region the holder maps read-write: `width * height`
/// pixels, rows one after another, each pixel the bytes R, G, B, A
/// (alpha premultiplied; the display shows it as opaque).
pub const BUFFER: usize = 2;
/// Through a window: the rectangle (`pack_rect`) that changed.
pub const PRESENT: usize = 3;