euv_core/render/buffer/struct.rs
1use super::*;
2
3/// Contiguous RGBA8 pixel framebuffer handed directly to OS surfaces or GPU upload paths.
4#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
5pub struct Framebuffer {
6 /// Physical width in pixels.
7 #[get(type(copy))]
8 pub(crate) width: u32,
9 /// Physical height in pixels.
10 #[get(type(copy))]
11 pub(crate) height: u32,
12 /// Packed RGBA8 pixel data (`width * height * 4` bytes).
13 pub(crate) pixels: Vec<u8>,
14}
15
16/// Zero-copy borrowed horizontal row band of a `Framebuffer` enabling safe multi-threaded parallel rasterization.
17#[derive(Debug, Eq, PartialEq)]
18pub struct PixelBand<'a> {
19 /// Full framebuffer physical width in pixels.
20 pub(crate) width: u32,
21 /// Starting physical Y row coordinate of this band inside the full framebuffer.
22 pub(crate) y_offset: u32,
23 /// Number of physical rows owned by this band.
24 pub(crate) height: u32,
25 /// Contiguous mutable RGBA8 byte slice for rows `[y_offset, y_offset + height)`.
26 pub(crate) pixels: &'a mut [u8],
27}
28
29/// Dirty bounding region tracking damaged screen areas between frames.
30#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
31pub struct DamageRegion {
32 /// Whether the entire surface must be redrawn.
33 #[get(type(copy))]
34 pub(crate) full_damage: bool,
35 /// Accumulated dirty bounding box in physical pixels.
36 #[get(skip)]
37 pub(crate) rect: Option<Rect>,
38}