1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 14:28:07 +00:00

feat(core): introduce new toif functions

[no changelog]
This commit is contained in:
cepetr 2024-02-19 11:41:42 +01:00 committed by cepetr
parent 254de49a62
commit 474484d249

View File

@ -271,6 +271,14 @@ impl<'i> Toif<'i> {
Offset::new(self.width(), self.height())
}
pub fn stride(&self) -> usize {
if self.is_grayscale() {
(self.width() + 1) as usize / 2
} else {
self.width() as usize * 2
}
}
pub fn zdata(&self) -> &'i [u8] {
&self.data[TOIF_HEADER_LENGTH..]
}