fast image operations
Diffstat (limited to 'src/term/bloc.rs')
| -rw-r--r-- | src/term/bloc.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/term/bloc.rs b/src/term/bloc.rs index 7bafd78..58c8655 100644 --- a/src/term/bloc.rs +++ b/src/term/bloc.rs @@ -50,16 +50,17 @@ where let (w, h) = fit((self.width(), self.height())); macro_rules! n { ($n:literal) => { - transmute::<Image<Box<[u8]>, $n>, Image<Box<[u8]>, N>>( - transmute::<Image<&[u8], N>, Image<&[u8], $n>>(self.as_ref()) - .scale::<scale::Nearest>(w, h), - ) + self.as_ref() + .trans::<$n>() + .scale::<scale::Nearest>(w, h) + .trans::<N>() }; (o $n:literal) => { - transmute::<Image<Box<[u8]>, 1>, Image<Box<[u8]>, N>>( - transmute::<Image<Vec<u8>, N>, Image<Vec<u8>, 1>>(self.as_ref().to_owned()) - .scale::<scale::Nearest>(w, h), - ) + self.as_ref() + .to_owned() + .trans::<1>() + .scale::<scale::Nearest>(w, h) + .trans::<N>() }; } // SAFETY: #[allow(clippy::undocumented_unsafe_blocks)] |