pub struct PixelProvenanceFrame { /* private fields */ }Expand description
One frame of PixelProvenance, indexed by y * SCREEN_W + x.
Overwritten in place every frame, exactly like the framebuffer it shadows, so
a query after run_frame describes the frame the user is looking at.
Implementations§
Source§impl PixelProvenanceFrame
impl PixelProvenanceFrame
Sourcepub const HEAP_BYTES: usize
pub const HEAP_BYTES: usize
Heap cost of one armed frame, in bytes.
Sourcepub fn get(&self, x: usize, y: usize) -> Option<PixelProvenance>
pub fn get(&self, x: usize, y: usize) -> Option<PixelProvenance>
The record for screen pixel (x, y), or None if either coordinate is
off-screen. Returning None rather than clamping matters: a clamped
query would answer confidently about a pixel the caller did not ask for.
Sourcepub fn set(&mut self, x: usize, y: usize, rec: PixelProvenance)
pub fn set(&mut self, x: usize, y: usize, rec: PixelProvenance)
Record a pixel. Out-of-range coordinates are dropped rather than wrapping into an unrelated pixel.
Sourcepub fn pixels(&self) -> &[PixelProvenance]
pub fn pixels(&self) -> &[PixelProvenance]
The whole frame, row-major.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Forget every recorded pixel, keeping the allocation.
Called on power-cycle and on save-state restore for the same reason
WriteAttribution::clear is: the records describe a timeline the
restore replaced. The framebuffer analogy does NOT excuse keeping them —
the framebuffer is serialized and comes back consistent with the restored
state, whereas this frame is not, so a restore landing mid-frame would
leave pre-restore addresses for every pixel above the current scanline
with nothing marking them stale.
Trait Implementations§
Source§impl Clone for PixelProvenanceFrame
impl Clone for PixelProvenanceFrame
Source§fn clone(&self) -> PixelProvenanceFrame
fn clone(&self) -> PixelProvenanceFrame
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more