From 474484d249ffca0d2b0a19f14cd2bc212bb430be Mon Sep 17 00:00:00 2001 From: cepetr Date: Mon, 19 Feb 2024 11:41:42 +0100 Subject: [PATCH] feat(core): introduce new toif functions [no changelog] --- core/embed/rust/src/ui/display/toif.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/embed/rust/src/ui/display/toif.rs b/core/embed/rust/src/ui/display/toif.rs index b39dd94eed..1f2bcff8d6 100644 --- a/core/embed/rust/src/ui/display/toif.rs +++ b/core/embed/rust/src/ui/display/toif.rs @@ -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..] }