Skip to main content

TileDiffPlan

Struct TileDiffPlan 

Source
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<'_>

Source

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.

Source

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>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for TileDiffPlan<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for TileDiffPlan<'a>

§

impl<'a> RefUnwindSafe for TileDiffPlan<'a>

§

impl<'a> Send for TileDiffPlan<'a>

§

impl<'a> Sync for TileDiffPlan<'a>

§

impl<'a> Unpin for TileDiffPlan<'a>

§

impl<'a> UnsafeUnpin for TileDiffPlan<'a>

§

impl<'a> UnwindSafe for TileDiffPlan<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.