#[derive(Copy, Clone)]
pub(crate) struct BufferPage<const WIDTH: usize> {
pub data: [u8; WIDTH],
pub dirty: Option<(usize, usize)>,
}
#[derive(Clone)]
pub struct GraphicsPageBuffer<const WIDTH: usize, const PAGES: usize> {
pub(crate) pages: [BufferPage<WIDTH>; PAGES],
}
impl<const WIDTH: usize, const PAGES: usize> GraphicsPageBuffer<WIDTH, PAGES> {
pub const fn new() -> Self {
Self {
pages: [BufferPage {
data: [0; WIDTH],
dirty: Some((0, WIDTH)),
}; PAGES],
}
}
pub fn mark_dirty(&mut self) {
for page in &mut self.pages {
page.dirty = Some((0, WIDTH));
}
}
}
impl<const WIDTH: usize, const PAGES: usize> Default for GraphicsPageBuffer<WIDTH, PAGES> {
fn default() -> Self {
Self::new()
}
}