Skip to main content

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 using zero-allocation inline stack storage.
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    /// Normalized non-overlapping stack-allocated damage rectangles (`0..rect_count` active).
39    #[get(skip)]
40    #[get_mut(skip)]
41    #[set(skip)]
42    pub(crate) rects: [Rect; 8],
43    /// Number of active normalized rectangles stored in `rects` (`0..=8`).
44    #[get(skip)]
45    #[get_mut(skip)]
46    #[set(skip)]
47    pub(crate) rect_count: u8,
48}