diff --git a/core/embed/rust/src/ui/shape/cache/drawing_cache.rs b/core/embed/rust/src/ui/shape/cache/drawing_cache.rs index 1890234b15..a442ddd56e 100644 --- a/core/embed/rust/src/ui/shape/cache/drawing_cache.rs +++ b/core/embed/rust/src/ui/shape/cache/drawing_cache.rs @@ -27,6 +27,7 @@ pub type ImageBuffRef<'a> = RefMut<'a, ImageBuff>; pub type RenderBuffRef<'a> = RefMut<'a, RenderBuff>; pub struct DrawingCache<'a> { + image_buff: &'a RefCell, zlib_cache: RefCell>, #[cfg(feature = "ui_jpeg_decoder")] @@ -37,18 +38,13 @@ pub struct DrawingCache<'a> { #[cfg(not(feature = "xframebuff"))] render_buff: &'a RefCell, - image_buff: &'a RefCell, } fn alloc_buf<'a, const S: usize, B>(bump: &'a B) -> Option<&'a RefCell<[u8; S]>> where B: LocalAllocLeakExt<'a>, { - Some( - bump.alloc_t()? - .uninit - .init(RefCell::new([0; S])), - ) + Some(bump.alloc_t()?.uninit.init(RefCell::new([0; S]))) } impl<'a> DrawingCache<'a> { @@ -58,6 +54,7 @@ impl<'a> DrawingCache<'a> { TB: LocalAllocLeakExt<'a>, { Self { + image_buff: unwrap!(alloc_buf(bump_b), "Toif buff alloc"), zlib_cache: RefCell::new(unwrap!( ZlibCache::new(bump_a, ZLIB_CACHE_SLOTS), "ZLIB cache alloc" @@ -72,7 +69,6 @@ impl<'a> DrawingCache<'a> { #[cfg(not(feature = "xframebuff"))] render_buff: unwrap!(alloc_buf(bump_b), "Render buff alloc"), - image_buff: unwrap!(alloc_buf(bump_b), "Toif buff alloc"), } }