mirror of
https://github.com/bend-n/fimg.git
synced 2024-12-22 02:28:19 -06:00
shrug
This commit is contained in:
parent
9210b2500f
commit
0e49a8066c
|
@ -438,7 +438,7 @@ impl<T, const CHANNELS: usize> Image<T, CHANNELS> {
|
||||||
T: AsRef<[U]>,
|
T: AsRef<[U]>,
|
||||||
{
|
{
|
||||||
// SAFETY: 0 sized images illegal
|
// SAFETY: 0 sized images illegal
|
||||||
unsafe { assert_unchecked(self.len() > CHANNELS) };
|
unsafe { assert_unchecked(self.len() >= CHANNELS) };
|
||||||
// SAFETY: no half pixels!
|
// SAFETY: no half pixels!
|
||||||
unsafe { assert_unchecked(self.len() % CHANNELS == 0) };
|
unsafe { assert_unchecked(self.len() % CHANNELS == 0) };
|
||||||
self.buffer().as_ref().array_chunks::<CHANNELS>()
|
self.buffer().as_ref().array_chunks::<CHANNELS>()
|
||||||
|
@ -529,7 +529,7 @@ impl<T: AsMut<[u8]> + AsRef<[u8]>, const CHANNELS: usize> Image<T, CHANNELS> {
|
||||||
/// Returns a iterator over every pixel, mutably
|
/// Returns a iterator over every pixel, mutably
|
||||||
pub fn chunked_mut(&mut self) -> impl Iterator<Item = &mut [u8; CHANNELS]> {
|
pub fn chunked_mut(&mut self) -> impl Iterator<Item = &mut [u8; CHANNELS]> {
|
||||||
// SAFETY: 0 sized images are not allowed
|
// SAFETY: 0 sized images are not allowed
|
||||||
unsafe { assert_unchecked(self.len() > CHANNELS) };
|
unsafe { assert_unchecked(self.len() >= CHANNELS) };
|
||||||
// SAFETY: buffer cannot have half pixels
|
// SAFETY: buffer cannot have half pixels
|
||||||
unsafe { assert_unchecked(self.len() % CHANNELS == 0) };
|
unsafe { assert_unchecked(self.len() % CHANNELS == 0) };
|
||||||
self.buffer.as_mut().array_chunks_mut::<CHANNELS>()
|
self.buffer.as_mut().array_chunks_mut::<CHANNELS>()
|
||||||
|
|
Loading…
Reference in a new issue