pub struct TileDiffPlan<'a> {
pub params: TileParams,
pub stats: TileDiffStats,
pub dirty_tiles: &'a [bool],
pub tile_counts: &'a [u32],
pub sat: &'a [u32],
}Expand description
Successful tile build with reusable buffers.
Fields§
§params: TileParams§stats: TileDiffStats§dirty_tiles: &'a [bool]§tile_counts: &'a [u32]§sat: &'a [u32]Implementations§
Source§impl TileDiffPlan<'_>
impl TileDiffPlan<'_>
Sourcepub fn tile_row_dirty(&self, ty: usize) -> u32
pub fn tile_row_dirty(&self, ty: usize) -> u32
Dirty-cell count in tile row ty, in O(1), read straight from the
summed-area table:
sat_w = tiles_x + 1
row_sum(ty) = sat[(ty + 1) * sat_w + tiles_x] - sat[ty * sat_w + tiles_x]Border column tiles_x carries the running prefix total of whole rows,
so the difference of two adjacent rows is that row’s dirty-cell count.
The SAT is monotonic (counts are non-negative), so the subtraction never
underflows; saturating_sub guards against a corrupt table anyway.
Returns 0 for an out-of-range row.
Sourcepub fn rect_dirty(&self, tx0: usize, ty0: usize, tx1: usize, ty1: usize) -> u32
pub fn rect_dirty(&self, tx0: usize, ty0: usize, tx1: usize, ty1: usize) -> u32
Dirty-cell count in the tile rectangle [tx0, tx1) x [ty0, ty1), in
O(1), via the four-corner SAT formula:
sat[ty1][tx1] - sat[ty0][tx1] - sat[ty1][tx0] + sat[ty0][tx0]This is the README’s “O(1) density of any rectangle” query. The scan
driver itself uses only tile_row_dirty; this
method exists so the claim is real and testable. Corners are clamped to
the tile grid; an empty or out-of-range rectangle returns 0. The sum is
accumulated in u64 so the two-corner addition cannot overflow before
the difference (which fits in u32) is taken.
Trait Implementations§
Source§impl<'a> Clone for TileDiffPlan<'a>
impl<'a> Clone for TileDiffPlan<'a>
Source§fn clone(&self) -> TileDiffPlan<'a>
fn clone(&self) -> TileDiffPlan<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more