pub struct GridWriter<'a, T> { /* private fields */ }Expand description
Concurrent writer for a buffer partitioned into a regular tile grid.
Tiles of a grid share buffer rows, so chunks_mut cannot hand them out to
threads. GridWriter lets each thread claim a tile and
write its rows directly into the final image. Soundness rests on two checked
invariants: (1) every claim is recorded in an atomic flag, so a tile can be
claimed at most once; (2) grid tiles cover pairwise-disjoint rectangles, and
every row slice handed out is clipped to its tile, so no two claims alias.
The buffer may cover a sub-rectangle (origin, width x height) of the grid’s
coordinate space, which is how region decoding writes only intersecting tiles.
Implementations§
Source§impl<'a, T: Send> GridWriter<'a, T>
impl<'a, T: Send> GridWriter<'a, T>
Sourcepub fn new(
buf: &'a mut [T],
width: u32,
height: u32,
cpp: u32,
origin: (u32, u32),
tile_w: u32,
tile_h: u32,
grid_w: u32,
grid_h: u32,
) -> Option<Self>
pub fn new( buf: &'a mut [T], width: u32, height: u32, cpp: u32, origin: (u32, u32), tile_w: u32, tile_h: u32, grid_w: u32, grid_h: u32, ) -> Option<Self>
buf holds width x height pixels of cpp samples, covering grid coordinates
starting at origin. The grid has tile_w x tile_h tiles anchored at (0, 0) and
spans grid_w x grid_h pixels.
pub fn tiles_x(&self) -> u32
pub fn tiles_y(&self) -> u32
Trait Implementations§
impl<T: Send> Send for GridWriter<'_, T>
impl<T: Send> Sync for GridWriter<'_, T>
Auto Trait Implementations§
impl<'a, T> !UnwindSafe for GridWriter<'a, T>
impl<'a, T> Freeze for GridWriter<'a, T>
impl<'a, T> RefUnwindSafe for GridWriter<'a, T>
impl<'a, T> Unpin for GridWriter<'a, T>
impl<'a, T> UnsafeUnpin for GridWriter<'a, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more