diff --git a/core/embed/rust/src/ui/component/bar.rs b/core/embed/rust/src/ui/component/bar.rs index a8127a19d7..604d382cab 100644 --- a/core/embed/rust/src/ui/component/bar.rs +++ b/core/embed/rust/src/ui/component/bar.rs @@ -41,7 +41,7 @@ impl Component for Bar { display::rect_fill_rounded(self.area, self.color, self.bg_color, self.radius as u8); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { shape::Bar::new(self.area) .with_bg(self.color) .with_radius(self.radius) diff --git a/core/embed/rust/src/ui/component/base.rs b/core/embed/rust/src/ui/component/base.rs index ce77c93bfb..6419caabba 100644 --- a/core/embed/rust/src/ui/component/base.rs +++ b/core/embed/rust/src/ui/component/base.rs @@ -63,7 +63,7 @@ pub trait Component { /// the `Child` wrapper. fn paint(&mut self); - fn render<'s>(&self, _target: &mut impl Renderer<'s>); + fn render<'s>(&'s self, _target: &mut impl Renderer<'s>); #[cfg(feature = "ui_bounds")] /// Report current paint bounds of this component. Used for debugging. @@ -159,7 +159,7 @@ where } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.component.render(target); } @@ -279,7 +279,7 @@ where self.inner.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.inner().render(target); } @@ -321,7 +321,7 @@ where self.1.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.0.render(target); self.1.render(target); } @@ -375,7 +375,7 @@ where self.2.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.0.render(target); self.1.render(target); self.2.render(target); @@ -408,7 +408,7 @@ where } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { if let Some(ref c) = self { c.render(target) } diff --git a/core/embed/rust/src/ui/component/border.rs b/core/embed/rust/src/ui/component/border.rs index 35bc3a390e..8ea403ca30 100644 --- a/core/embed/rust/src/ui/component/border.rs +++ b/core/embed/rust/src/ui/component/border.rs @@ -42,7 +42,7 @@ where self.inner.paint() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.inner.render(target); } diff --git a/core/embed/rust/src/ui/component/button_request.rs b/core/embed/rust/src/ui/component/button_request.rs index f19eca1c3f..ce99492cd0 100644 --- a/core/embed/rust/src/ui/component/button_request.rs +++ b/core/embed/rust/src/ui/component/button_request.rs @@ -41,7 +41,7 @@ impl Component for OneButtonRequest { self.inner.paint() } - fn render<'s>(&self, target: &mut impl crate::ui::shape::Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl crate::ui::shape::Renderer<'s>) { self.inner.render(target) } } diff --git a/core/embed/rust/src/ui/component/connect.rs b/core/embed/rust/src/ui/component/connect.rs index 9c5fc8ea31..3d7897bdf0 100644 --- a/core/embed/rust/src/ui/component/connect.rs +++ b/core/embed/rust/src/ui/component/connect.rs @@ -57,7 +57,7 @@ impl Component for Connect { }); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let font = Font::NORMAL; self.bg.render(target); diff --git a/core/embed/rust/src/ui/component/empty.rs b/core/embed/rust/src/ui/component/empty.rs index 2d5f92cd16..cce48b0cec 100644 --- a/core/embed/rust/src/ui/component/empty.rs +++ b/core/embed/rust/src/ui/component/empty.rs @@ -17,7 +17,7 @@ impl Component for Empty { fn paint(&mut self) {} - fn render<'s>(&self, _target: &mut impl Renderer<'s>) {} + fn render<'s>(&'s self, _target: &mut impl Renderer<'s>) {} } #[cfg(feature = "ui_debug")] diff --git a/core/embed/rust/src/ui/component/image.rs b/core/embed/rust/src/ui/component/image.rs index 300933b219..959ccf2c49 100644 --- a/core/embed/rust/src/ui/component/image.rs +++ b/core/embed/rust/src/ui/component/image.rs @@ -50,7 +50,7 @@ impl Component for Image { self.draw(self.area.center(), Alignment2D::CENTER); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { shape::ToifImage::new(self.area.center(), self.toif) .with_align(Alignment2D::CENTER) .render(target); @@ -138,7 +138,7 @@ impl Component for BlendedImage { self.paint_image(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { shape::ToifImage::new(self.bg_top_left, self.bg.toif) .with_fg(self.bg_color) .render(target); diff --git a/core/embed/rust/src/ui/component/jpeg.rs b/core/embed/rust/src/ui/component/jpeg.rs index 23f73bf3f4..e8379b67ff 100644 --- a/core/embed/rust/src/ui/component/jpeg.rs +++ b/core/embed/rust/src/ui/component/jpeg.rs @@ -48,7 +48,7 @@ impl Component for Jpeg { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { shape::JpegImage::new_image(self.area.center(), self.image) .with_align(Alignment2D::CENTER) .with_scale(self.scale) diff --git a/core/embed/rust/src/ui/component/label.rs b/core/embed/rust/src/ui/component/label.rs index 7061e659ff..087583d1f0 100644 --- a/core/embed/rust/src/ui/component/label.rs +++ b/core/embed/rust/src/ui/component/label.rs @@ -136,7 +136,7 @@ impl Component for Label<'_> { self.text.map(|c| self.layout.render_text(c)); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.text.map(|c| self.layout.render_text2(c, target)); } diff --git a/core/embed/rust/src/ui/component/map.rs b/core/embed/rust/src/ui/component/map.rs index 82087c672a..89b19b88db 100644 --- a/core/embed/rust/src/ui/component/map.rs +++ b/core/embed/rust/src/ui/component/map.rs @@ -31,7 +31,7 @@ where self.inner.paint() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.inner.render(target); } @@ -102,7 +102,7 @@ where self.inner.paint() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.inner.render(target); } diff --git a/core/embed/rust/src/ui/component/marquee.rs b/core/embed/rust/src/ui/component/marquee.rs index ed07bb74cf..d6a91386c8 100644 --- a/core/embed/rust/src/ui/component/marquee.rs +++ b/core/embed/rust/src/ui/component/marquee.rs @@ -124,7 +124,7 @@ impl Marquee { .map(|t| display::marquee(self.area, t, offset, self.font, self.fg, self.bg)); } - pub fn render_anim<'s>(&self, target: &mut impl Renderer<'s>, offset: i16) { + pub fn render_anim<'s>(&'s self, target: &mut impl Renderer<'s>, offset: i16) { target.in_window(self.area, &|target| { let text_height = self.font.text_height(); let pos = self.area.top_left() + Offset::new(offset, text_height - 1); @@ -228,7 +228,7 @@ impl Component for Marquee { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let now = Instant::now(); match self.state { diff --git a/core/embed/rust/src/ui/component/maybe.rs b/core/embed/rust/src/ui/component/maybe.rs index d5a21b7f69..bbc843bca1 100644 --- a/core/embed/rust/src/ui/component/maybe.rs +++ b/core/embed/rust/src/ui/component/maybe.rs @@ -95,7 +95,7 @@ where } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.pad.render(target); if self.visible { self.inner.render(target); diff --git a/core/embed/rust/src/ui/component/pad.rs b/core/embed/rust/src/ui/component/pad.rs index 5e8371b1ff..fa6b5b065b 100644 --- a/core/embed/rust/src/ui/component/pad.rs +++ b/core/embed/rust/src/ui/component/pad.rs @@ -55,7 +55,7 @@ impl Pad { } } - pub fn render<'s>(&self, target: &mut impl Renderer<'s>) { + pub fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { shape::Bar::new(self.area) .with_bg(self.color) .render(target); diff --git a/core/embed/rust/src/ui/component/placed.rs b/core/embed/rust/src/ui/component/placed.rs index bc2af8ffa6..18fcc1e186 100644 --- a/core/embed/rust/src/ui/component/placed.rs +++ b/core/embed/rust/src/ui/component/placed.rs @@ -65,7 +65,7 @@ where self.inner.paint() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.inner.render(target); } } @@ -112,7 +112,7 @@ where self.inner.paint() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.inner.render(target); } } @@ -188,7 +188,7 @@ where self.inner.paint() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.inner.render(target); } } @@ -283,7 +283,7 @@ where self.second.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.first.render(target); self.second.render(target); } diff --git a/core/embed/rust/src/ui/component/qr_code.rs b/core/embed/rust/src/ui/component/qr_code.rs index 7b930f3996..5786307fd9 100644 --- a/core/embed/rust/src/ui/component/qr_code.rs +++ b/core/embed/rust/src/ui/component/qr_code.rs @@ -143,7 +143,7 @@ impl Component for Qr { Self::draw(&qr, area, self.border, scale); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let mut outbuffer = [0u8; QR_MAX_VERSION.buffer_len()]; let mut tempbuffer = [0u8; QR_MAX_VERSION.buffer_len()]; diff --git a/core/embed/rust/src/ui/component/swipe.rs b/core/embed/rust/src/ui/component/swipe.rs index ecf0f1ddf0..6f69262857 100644 --- a/core/embed/rust/src/ui/component/swipe.rs +++ b/core/embed/rust/src/ui/component/swipe.rs @@ -155,5 +155,5 @@ impl Component for Swipe { fn paint(&mut self) {} - fn render<'s>(&self, _target: &mut impl Renderer<'s>) {} + fn render<'s>(&'s self, _target: &mut impl Renderer<'s>) {} } diff --git a/core/embed/rust/src/ui/component/text/formatted.rs b/core/embed/rust/src/ui/component/text/formatted.rs index 080b4fa8a1..9e881b725c 100644 --- a/core/embed/rust/src/ui/component/text/formatted.rs +++ b/core/embed/rust/src/ui/component/text/formatted.rs @@ -134,7 +134,7 @@ impl Component for FormattedText { self.layout_content(&mut TextRenderer); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.layout_content(&mut TextRenderer2::new(target)); } diff --git a/core/embed/rust/src/ui/component/text/paragraphs.rs b/core/embed/rust/src/ui/component/text/paragraphs.rs index f475698e6b..34ae7a9e0c 100644 --- a/core/embed/rust/src/ui/component/text/paragraphs.rs +++ b/core/embed/rust/src/ui/component/text/paragraphs.rs @@ -189,7 +189,7 @@ where ) } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { Self::foreach_visible( &self.source, &self.visible, @@ -713,7 +713,7 @@ where } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.paragraphs.render(target); self.render_left_column(target); } diff --git a/core/embed/rust/src/ui/component/timeout.rs b/core/embed/rust/src/ui/component/timeout.rs index 708a106aa6..8aac3ba8dd 100644 --- a/core/embed/rust/src/ui/component/timeout.rs +++ b/core/embed/rust/src/ui/component/timeout.rs @@ -47,7 +47,7 @@ impl Component for Timeout { fn paint(&mut self) {} - fn render<'s>(&self, _target: &mut impl Renderer<'s>) {} + fn render<'s>(&'s self, _target: &mut impl Renderer<'s>) {} } #[cfg(feature = "ui_debug")] diff --git a/core/embed/rust/src/ui/flow/page.rs b/core/embed/rust/src/ui/flow/page.rs index 29a766c8bf..33af2c3fbc 100644 --- a/core/embed/rust/src/ui/flow/page.rs +++ b/core/embed/rust/src/ui/flow/page.rs @@ -67,7 +67,11 @@ impl SwipePage { finished } - fn render_transition<'s>(&self, transition: &Transition, target: &mut impl Renderer<'s>) { + fn render_transition<'s>( + &'s self, + transition: &'s Transition, + target: &mut impl Renderer<'s>, + ) { target.in_clip(self.bounds, &|target| { util::render_slide( |target| transition.cloned.render(target), @@ -106,7 +110,7 @@ impl Component for SwipePage { self.inner.paint() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { if let Some(t) = &self.transition { return self.render_transition(t, target); } @@ -197,7 +201,7 @@ impl Component for IgnoreSwipe { self.0.paint() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.0.render(target) } } diff --git a/core/embed/rust/src/ui/flow/store.rs b/core/embed/rust/src/ui/flow/store.rs index 62f5444d0b..cf1bd2d60a 100644 --- a/core/embed/rust/src/ui/flow/store.rs +++ b/core/embed/rust/src/ui/flow/store.rs @@ -22,7 +22,7 @@ pub trait FlowStore { fn event(&mut self, i: usize, ctx: &mut EventCtx, event: Event) -> Option; /// Call `Component::render` on i-th element. - fn render<'s>(&self, i: usize, target: &mut impl Renderer<'s>); + fn render<'s>(&'s self, i: usize, target: &mut impl Renderer<'s>); #[cfg(feature = "ui_debug")] /// Call `Trace::trace` on i-th element. @@ -62,7 +62,7 @@ impl FlowStore for FlowEmpty { panic!() } - fn render<'s>(&self, _i: usize, _target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, _i: usize, _target: &mut impl Renderer<'s>) { panic!() } @@ -132,7 +132,7 @@ where } } - fn render<'s>(&self, i: usize, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, i: usize, target: &mut impl Renderer<'s>) { if i == 0 { self.as_ref().render(target) } else { diff --git a/core/embed/rust/src/ui/flow/swipe.rs b/core/embed/rust/src/ui/flow/swipe.rs index 627dbff1cc..70bb21c1df 100644 --- a/core/embed/rust/src/ui/flow/swipe.rs +++ b/core/embed/rust/src/ui/flow/swipe.rs @@ -80,12 +80,12 @@ impl SwipeFlow { ctx.request_paint(); } - fn render_state<'s>(&self, state: Q, target: &mut impl Renderer<'s>) { + fn render_state<'s>(&'s self, state: Q, target: &mut impl Renderer<'s>) { self.store.render(state.index(), target) } fn render_transition<'s>( - &self, + &'s self, prev_state: &Q, animation: &Animation, direction: &SwipeDirection, @@ -188,7 +188,7 @@ impl Component for SwipeFlow { fn paint(&mut self) {} - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { match &self.transition { Transition::None | Transition::Internal => self.render_state(self.state, target), Transition::External { diff --git a/core/embed/rust/src/ui/model_mercury/bootloader/intro.rs b/core/embed/rust/src/ui/model_mercury/bootloader/intro.rs index 7b7c065130..1057a732ef 100644 --- a/core/embed/rust/src/ui/model_mercury/bootloader/intro.rs +++ b/core/embed/rust/src/ui/model_mercury/bootloader/intro.rs @@ -107,7 +107,7 @@ impl<'a> Component for Intro<'a> { self.menu.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.bg.render(target); self.title.render(target); self.text.render(target); diff --git a/core/embed/rust/src/ui/model_mercury/bootloader/menu.rs b/core/embed/rust/src/ui/model_mercury/bootloader/menu.rs index 962f6a6c50..9ffccbc566 100644 --- a/core/embed/rust/src/ui/model_mercury/bootloader/menu.rs +++ b/core/embed/rust/src/ui/model_mercury/bootloader/menu.rs @@ -109,7 +109,7 @@ impl Component for Menu { self.reset.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.bg.render(target); self.title.render(target); self.close.render(target); diff --git a/core/embed/rust/src/ui/model_mercury/bootloader/welcome.rs b/core/embed/rust/src/ui/model_mercury/bootloader/welcome.rs index 2a347ac9a4..3900459163 100644 --- a/core/embed/rust/src/ui/model_mercury/bootloader/welcome.rs +++ b/core/embed/rust/src/ui/model_mercury/bootloader/welcome.rs @@ -64,7 +64,7 @@ impl Component for Welcome { ); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.bg.render(target); shape::Text::new(TEXT_ORIGIN, "Get started") diff --git a/core/embed/rust/src/ui/model_mercury/component/address_details.rs b/core/embed/rust/src/ui/model_mercury/component/address_details.rs index 2e44f4317e..79cde1c1f1 100644 --- a/core/embed/rust/src/ui/model_mercury/component/address_details.rs +++ b/core/embed/rust/src/ui/model_mercury/component/address_details.rs @@ -161,7 +161,7 @@ impl Component for AddressDetails { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { match self.current_page { 0 => self.details.render(target), _ => self.xpub_view.render(target), diff --git a/core/embed/rust/src/ui/model_mercury/component/bl_confirm.rs b/core/embed/rust/src/ui/model_mercury/component/bl_confirm.rs index 8fe2897c39..75ab740980 100644 --- a/core/embed/rust/src/ui/model_mercury/component/bl_confirm.rs +++ b/core/embed/rust/src/ui/model_mercury/component/bl_confirm.rs @@ -241,7 +241,7 @@ impl Component for Confirm<'_> { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.bg.render(target); self.content_pad.render(target); diff --git a/core/embed/rust/src/ui/model_mercury/component/button.rs b/core/embed/rust/src/ui/model_mercury/component/button.rs index 8ff864d91f..2a031d07f9 100644 --- a/core/embed/rust/src/ui/model_mercury/component/button.rs +++ b/core/embed/rust/src/ui/model_mercury/component/button.rs @@ -408,7 +408,7 @@ impl Component for Button { self.paint_content(style); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let style = self.style(); self.render_background(target, style, 0xFF); self.render_content(target, style, 0xFF); diff --git a/core/embed/rust/src/ui/model_mercury/component/coinjoin_progress.rs b/core/embed/rust/src/ui/model_mercury/component/coinjoin_progress.rs index 1977d0c19b..7fc2c7837c 100644 --- a/core/embed/rust/src/ui/model_mercury/component/coinjoin_progress.rs +++ b/core/embed/rust/src/ui/model_mercury/component/coinjoin_progress.rs @@ -124,7 +124,7 @@ where self.label.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.content.render(target); let center = constant::screen().center() + Offset::y(LOADER_OFFSET); diff --git a/core/embed/rust/src/ui/model_mercury/component/dialog.rs b/core/embed/rust/src/ui/model_mercury/component/dialog.rs index e65bef3828..0229e89051 100644 --- a/core/embed/rust/src/ui/model_mercury/component/dialog.rs +++ b/core/embed/rust/src/ui/model_mercury/component/dialog.rs @@ -72,7 +72,7 @@ where self.controls.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.content.render(target); self.controls.render(target); } @@ -202,7 +202,7 @@ where self.controls.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.image.render(target); self.paragraphs.render(target); self.controls.render(target); diff --git a/core/embed/rust/src/ui/model_mercury/component/error.rs b/core/embed/rust/src/ui/model_mercury/component/error.rs index 664a2576f9..0999a06541 100644 --- a/core/embed/rust/src/ui/model_mercury/component/error.rs +++ b/core/embed/rust/src/ui/model_mercury/component/error.rs @@ -92,7 +92,7 @@ impl<'a> Component for ErrorScreen<'a> { self.footer.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.bg.render(target); let icon = ICON_WARNING40; diff --git a/core/embed/rust/src/ui/model_mercury/component/fido.rs b/core/embed/rust/src/ui/model_mercury/component/fido.rs index f0e5a83f23..5506a24d70 100644 --- a/core/embed/rust/src/ui/model_mercury/component/fido.rs +++ b/core/embed/rust/src/ui/model_mercury/component/fido.rs @@ -211,7 +211,7 @@ where } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.icon.render(target); self.controls.render(target); self.app_name.render(target); diff --git a/core/embed/rust/src/ui/model_mercury/component/footer.rs b/core/embed/rust/src/ui/model_mercury/component/footer.rs index d21753c7e6..4161b2ba87 100644 --- a/core/embed/rust/src/ui/model_mercury/component/footer.rs +++ b/core/embed/rust/src/ui/model_mercury/component/footer.rs @@ -94,7 +94,7 @@ impl<'a> Component for Footer<'a> { todo!() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { // show description only if there is space for it if self.area.height() == Footer::HEIGHT_DEFAULT { if let Some(description) = self.text_description { diff --git a/core/embed/rust/src/ui/model_mercury/component/frame.rs b/core/embed/rust/src/ui/model_mercury/component/frame.rs index 5e49511739..c3735d2477 100644 --- a/core/embed/rust/src/ui/model_mercury/component/frame.rs +++ b/core/embed/rust/src/ui/model_mercury/component/frame.rs @@ -218,7 +218,7 @@ where self.footer.paint(); self.content.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.title.render(target); self.subtitle.render(target); self.button.render(target); diff --git a/core/embed/rust/src/ui/model_mercury/component/hold_to_confirm.rs b/core/embed/rust/src/ui/model_mercury/component/hold_to_confirm.rs index ff29ba1f26..025386be0d 100644 --- a/core/embed/rust/src/ui/model_mercury/component/hold_to_confirm.rs +++ b/core/embed/rust/src/ui/model_mercury/component/hold_to_confirm.rs @@ -245,7 +245,7 @@ impl Component for HoldToConfirm { unimplemented!() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let elapsed = self.anim.eval(); shape::Bar::new(screen()) diff --git a/core/embed/rust/src/ui/model_mercury/component/homescreen.rs b/core/embed/rust/src/ui/model_mercury/component/homescreen.rs index ea4bbe6710..1eaf07e62d 100644 --- a/core/embed/rust/src/ui/model_mercury/component/homescreen.rs +++ b/core/embed/rust/src/ui/model_mercury/component/homescreen.rs @@ -108,7 +108,7 @@ impl Homescreen { } } - fn render_loader<'s>(&self, target: &mut impl Renderer<'s>) { + fn render_loader<'s>(&'s self, target: &mut impl Renderer<'s>) { TR::progress__locking_device.map_translated(|t| { shape::Text::new(TOP_CENTER + Offset::y(HOLD_Y), t) .with_align(Alignment::Center) @@ -188,7 +188,7 @@ impl Component for Homescreen { todo!() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { if self.loader.is_animating() || self.loader.is_completely_grown(Instant::now()) { self.render_loader(target); } else { @@ -353,15 +353,14 @@ impl Component for Lockscreen { todo!() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { const OVERLAY_SIZE: i16 = 170; const OVERLAY_BORDER: i16 = (AREA.height() - OVERLAY_SIZE) / 2; const OVERLAY_OFFSET: i16 = 9; let center = AREA.center(); - // shape::RawImage::new(AREA, self.bg_image.view()) - // .render(target); + shape::RawImage::new(AREA, self.bg_image.view()).render(target); cshape::UnlockOverlay::new(center + Offset::y(OVERLAY_OFFSET), self.anim.eval()) .render(target); diff --git a/core/embed/rust/src/ui/model_mercury/component/keyboard/bip39.rs b/core/embed/rust/src/ui/model_mercury/component/keyboard/bip39.rs index c5ce0d1143..5fb9488af2 100644 --- a/core/embed/rust/src/ui/model_mercury/component/keyboard/bip39.rs +++ b/core/embed/rust/src/ui/model_mercury/component/keyboard/bip39.rs @@ -107,7 +107,7 @@ impl Component for Bip39Input { todo!("remove when ui-t3t1 done"); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let area = self.button.area(); let style = self.button.style(); diff --git a/core/embed/rust/src/ui/model_mercury/component/keyboard/mnemonic.rs b/core/embed/rust/src/ui/model_mercury/component/keyboard/mnemonic.rs index a8451149ea..058a4f606e 100644 --- a/core/embed/rust/src/ui/model_mercury/component/keyboard/mnemonic.rs +++ b/core/embed/rust/src/ui/model_mercury/component/keyboard/mnemonic.rs @@ -208,7 +208,7 @@ where } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { if self.input.inner().inner().is_empty() { self.prompt.render(target); if self.can_go_back { diff --git a/core/embed/rust/src/ui/model_mercury/component/keyboard/passphrase.rs b/core/embed/rust/src/ui/model_mercury/component/keyboard/passphrase.rs index 3332a3c098..2e4966bf8d 100644 --- a/core/embed/rust/src/ui/model_mercury/component/keyboard/passphrase.rs +++ b/core/embed/rust/src/ui/model_mercury/component/keyboard/passphrase.rs @@ -372,7 +372,7 @@ impl Component for PassphraseKeyboard { todo!("remove when ui-t3t1 done") } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.input.render(target); self.next_btn.render(target); self.erase_btn.render(target); @@ -436,7 +436,7 @@ impl Component for Input { todo!("remove when ui-t3t1 done"); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let style = theme::label_keyboard(); let text_baseline = self.area.top_left() + Offset::y(style.text_font.text_height()) diff --git a/core/embed/rust/src/ui/model_mercury/component/keyboard/pin.rs b/core/embed/rust/src/ui/model_mercury/component/keyboard/pin.rs index c5350f0dd9..600c10d452 100644 --- a/core/embed/rust/src/ui/model_mercury/component/keyboard/pin.rs +++ b/core/embed/rust/src/ui/model_mercury/component/keyboard/pin.rs @@ -237,7 +237,7 @@ impl Component for PinKeyboard<'_> { todo!("remove when ui-t3t1 done"); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.erase_btn.render(target); self.textbox_pad.render(target); @@ -433,7 +433,7 @@ impl Component for PinDots { // TODO: remove when ui-t3t1 done } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let dot_area = self.area.inset(HEADER_PADDING); self.pad.render(target); if self.display_digits { diff --git a/core/embed/rust/src/ui/model_mercury/component/keyboard/slip39.rs b/core/embed/rust/src/ui/model_mercury/component/keyboard/slip39.rs index d4de52fa91..79173a1db0 100644 --- a/core/embed/rust/src/ui/model_mercury/component/keyboard/slip39.rs +++ b/core/embed/rust/src/ui/model_mercury/component/keyboard/slip39.rs @@ -127,7 +127,7 @@ impl Component for Slip39Input { todo!("remove when ui-t3t1 done") } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let area = self.button.area(); let style = self.button.style(); diff --git a/core/embed/rust/src/ui/model_mercury/component/keyboard/word_count.rs b/core/embed/rust/src/ui/model_mercury/component/keyboard/word_count.rs index 3b5ee6473d..720336473f 100644 --- a/core/embed/rust/src/ui/model_mercury/component/keyboard/word_count.rs +++ b/core/embed/rust/src/ui/model_mercury/component/keyboard/word_count.rs @@ -67,7 +67,7 @@ impl Component for SelectWordCount { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { for btn in self.button.iter() { btn.render(target) } diff --git a/core/embed/rust/src/ui/model_mercury/component/loader.rs b/core/embed/rust/src/ui/model_mercury/component/loader.rs index cbbd5bfe03..0a0a59bf78 100644 --- a/core/embed/rust/src/ui/model_mercury/component/loader.rs +++ b/core/embed/rust/src/ui/model_mercury/component/loader.rs @@ -204,7 +204,7 @@ impl Component for Loader { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { // TODO: Consider passing the current instant along with the event -- that way, // we could synchronize painting across the component tree. Also could be useful // in automated tests. diff --git a/core/embed/rust/src/ui/model_mercury/component/number_input.rs b/core/embed/rust/src/ui/model_mercury/component/number_input.rs index 7b2f1052e0..d3ff1c18fd 100644 --- a/core/embed/rust/src/ui/model_mercury/component/number_input.rs +++ b/core/embed/rust/src/ui/model_mercury/component/number_input.rs @@ -97,7 +97,7 @@ where todo!("remove when ui-t3t1 done"); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.input.render(target); self.paragraphs_pad.render(target); self.paragraphs.render(target); @@ -212,7 +212,7 @@ impl Component for NumberInput { todo!("remove when ui-t3t1 done"); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let mut buf = [0u8; 10]; if let Some(text) = strutil::format_i64(self.value as i64, &mut buf) { diff --git a/core/embed/rust/src/ui/model_mercury/component/number_input_slider.rs b/core/embed/rust/src/ui/model_mercury/component/number_input_slider.rs index 4075f1ad23..babc01014a 100644 --- a/core/embed/rust/src/ui/model_mercury/component/number_input_slider.rs +++ b/core/embed/rust/src/ui/model_mercury/component/number_input_slider.rs @@ -92,7 +92,7 @@ impl Component for NumberInputSliderDialog { self.confirm_button.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.input.render(target); let mut str = ShortString::new(); @@ -193,7 +193,7 @@ impl Component for NumberInputSlider { display::bar_with_text_and_fill(self.area, None, theme::FG, theme::BG, 0, fill_to as _); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let val_pct = (100 * (self.value - self.min)) / (self.max - self.min); shape::Bar::new(self.area) diff --git a/core/embed/rust/src/ui/model_mercury/component/page.rs b/core/embed/rust/src/ui/model_mercury/component/page.rs index 606a56c3fb..4ab4b07178 100644 --- a/core/embed/rust/src/ui/model_mercury/component/page.rs +++ b/core/embed/rust/src/ui/model_mercury/component/page.rs @@ -420,7 +420,7 @@ where } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.pad.render(target); match &self.loader { Some(l) if l.is_animating() => self.loader.render(target), diff --git a/core/embed/rust/src/ui/model_mercury/component/progress.rs b/core/embed/rust/src/ui/model_mercury/component/progress.rs index e8d9030017..744f4cbc6b 100644 --- a/core/embed/rust/src/ui/model_mercury/component/progress.rs +++ b/core/embed/rust/src/ui/model_mercury/component/progress.rs @@ -110,7 +110,7 @@ impl Component for Progress { self.description.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.title.render(target); let center = constant::screen().center() + Offset::y(self.loader_y_offset); diff --git a/core/embed/rust/src/ui/model_mercury/component/prompt_screen.rs b/core/embed/rust/src/ui/model_mercury/component/prompt_screen.rs index c330100d94..2e63f41a6f 100644 --- a/core/embed/rust/src/ui/model_mercury/component/prompt_screen.rs +++ b/core/embed/rust/src/ui/model_mercury/component/prompt_screen.rs @@ -60,7 +60,7 @@ impl Component for PromptScreen { todo!() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { match self { PromptScreen::Tap(t) => t.render(target), PromptScreen::Hold(h) => h.render(target), diff --git a/core/embed/rust/src/ui/model_mercury/component/result.rs b/core/embed/rust/src/ui/model_mercury/component/result.rs index 3eb7e0a5d9..f5e619f18c 100644 --- a/core/embed/rust/src/ui/model_mercury/component/result.rs +++ b/core/embed/rust/src/ui/model_mercury/component/result.rs @@ -97,7 +97,7 @@ impl Component for ResultFooter<'_> { self.text.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { // divider line let bar = Rect::from_center_and_size( Point::new(self.area.center().x, self.area.y0), @@ -182,7 +182,7 @@ impl<'a> Component for ResultScreen<'a> { self.footer.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.bg.render(target); self.footer_pad.render(target); diff --git a/core/embed/rust/src/ui/model_mercury/component/scroll.rs b/core/embed/rust/src/ui/model_mercury/component/scroll.rs index d091082b57..1ea96fd960 100644 --- a/core/embed/rust/src/ui/model_mercury/component/scroll.rs +++ b/core/embed/rust/src/ui/model_mercury/component/scroll.rs @@ -124,7 +124,7 @@ impl Component for ScrollBar { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { fn dotsize(distance: usize, nhidden: usize) -> Icon { match (nhidden.saturating_sub(distance)).min(2 - distance) { 0 => theme::DOT_INACTIVE, diff --git a/core/embed/rust/src/ui/model_mercury/component/set_brightness.rs b/core/embed/rust/src/ui/model_mercury/component/set_brightness.rs index e271a12a44..ebb4c3c3a0 100644 --- a/core/embed/rust/src/ui/model_mercury/component/set_brightness.rs +++ b/core/embed/rust/src/ui/model_mercury/component/set_brightness.rs @@ -55,7 +55,7 @@ impl Component for SetBrightnessDialog { self.0.paint() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.0.render(target); } diff --git a/core/embed/rust/src/ui/model_mercury/component/share_words.rs b/core/embed/rust/src/ui/model_mercury/component/share_words.rs index 9b8fb872f8..5cc6d52585 100644 --- a/core/embed/rust/src/ui/model_mercury/component/share_words.rs +++ b/core/embed/rust/src/ui/model_mercury/component/share_words.rs @@ -110,7 +110,7 @@ impl<'a> Component for ShareWords<'a> { // TODO: remove when ui-t3t1 done } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { // corner highlights let (_, top_right_shape, bot_left_shape, bot_right_shape) = shape::CornerHighlight::from_rect(self.area_word, theme::GREY_DARK, theme::BG); diff --git a/core/embed/rust/src/ui/model_mercury/component/simple_page.rs b/core/embed/rust/src/ui/model_mercury/component/simple_page.rs index d8c898b181..5e7a799071 100644 --- a/core/embed/rust/src/ui/model_mercury/component/simple_page.rs +++ b/core/embed/rust/src/ui/model_mercury/component/simple_page.rs @@ -170,7 +170,7 @@ where } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.pad.render(target); self.content.render(target); if self.scrollbar.has_pages() { diff --git a/core/embed/rust/src/ui/model_mercury/component/status_screen.rs b/core/embed/rust/src/ui/model_mercury/component/status_screen.rs index 4c6dfba12b..cc9d50e0e7 100644 --- a/core/embed/rust/src/ui/model_mercury/component/status_screen.rs +++ b/core/embed/rust/src/ui/model_mercury/component/status_screen.rs @@ -194,7 +194,7 @@ impl Component for StatusScreen { todo!() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let t = self.anim.eval(); shape::Circle::new(self.area.center(), self.anim.get_circle_radius(t)) diff --git a/core/embed/rust/src/ui/model_mercury/component/swipe_up_screen.rs b/core/embed/rust/src/ui/model_mercury/component/swipe_up_screen.rs index fcbbaf2813..05f90bab67 100644 --- a/core/embed/rust/src/ui/model_mercury/component/swipe_up_screen.rs +++ b/core/embed/rust/src/ui/model_mercury/component/swipe_up_screen.rs @@ -52,7 +52,7 @@ where todo!() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.content.render(target); } diff --git a/core/embed/rust/src/ui/model_mercury/component/tap_to_confirm.rs b/core/embed/rust/src/ui/model_mercury/component/tap_to_confirm.rs index 4139ba0c82..0a4993a758 100644 --- a/core/embed/rust/src/ui/model_mercury/component/tap_to_confirm.rs +++ b/core/embed/rust/src/ui/model_mercury/component/tap_to_confirm.rs @@ -196,7 +196,7 @@ impl Component for TapToConfirm { unimplemented!() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { const PAD_RADIUS: i16 = 70; const PAD_THICKNESS: i16 = 20; const CIRCLE_RADIUS: i16 = 50; diff --git a/core/embed/rust/src/ui/model_mercury/component/vertical_menu.rs b/core/embed/rust/src/ui/model_mercury/component/vertical_menu.rs index 39d31a57ff..6773be7a8c 100644 --- a/core/embed/rust/src/ui/model_mercury/component/vertical_menu.rs +++ b/core/embed/rust/src/ui/model_mercury/component/vertical_menu.rs @@ -119,7 +119,7 @@ impl Component for VerticalMenu { // TODO remove when ui-t3t1 done } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { // render buttons separated by thin bars for button in &self.buttons { button.render(target); diff --git a/core/embed/rust/src/ui/model_mercury/component/welcome_screen.rs b/core/embed/rust/src/ui/model_mercury/component/welcome_screen.rs index 6317b34137..35c0ef6589 100644 --- a/core/embed/rust/src/ui/model_mercury/component/welcome_screen.rs +++ b/core/embed/rust/src/ui/model_mercury/component/welcome_screen.rs @@ -54,7 +54,7 @@ impl Component for WelcomeScreen { ); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { shape::ToifImage::new( self.area.top_center() + Offset::y(ICON_TOP_MARGIN), theme::ICON_LOGO.toif, diff --git a/core/embed/rust/src/ui/model_tr/bootloader/intro.rs b/core/embed/rust/src/ui/model_tr/bootloader/intro.rs index cbe3eda167..cf323dac41 100644 --- a/core/embed/rust/src/ui/model_tr/bootloader/intro.rs +++ b/core/embed/rust/src/ui/model_tr/bootloader/intro.rs @@ -106,7 +106,7 @@ impl<'a> Component for Intro<'a> { self.buttons.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.bg.render(target); self.title.render(target); diff --git a/core/embed/rust/src/ui/model_tr/bootloader/menu.rs b/core/embed/rust/src/ui/model_tr/bootloader/menu.rs index 16dfdbd732..6ba41fb6ea 100644 --- a/core/embed/rust/src/ui/model_tr/bootloader/menu.rs +++ b/core/embed/rust/src/ui/model_tr/bootloader/menu.rs @@ -184,7 +184,7 @@ impl Component for Menu { self.choice_page.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.pad.render(target); self.choice_page.render(target); } diff --git a/core/embed/rust/src/ui/model_tr/bootloader/welcome.rs b/core/embed/rust/src/ui/model_tr/bootloader/welcome.rs index 206312233c..ad261e3b17 100644 --- a/core/embed/rust/src/ui/model_tr/bootloader/welcome.rs +++ b/core/embed/rust/src/ui/model_tr/bootloader/welcome.rs @@ -60,7 +60,7 @@ impl Component for Welcome { ); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.bg.render(target); let top_center = self.bg.area.top_center(); diff --git a/core/embed/rust/src/ui/model_tr/component/address_details.rs b/core/embed/rust/src/ui/model_tr/component/address_details.rs index e6714e36f7..14c38e3b0d 100644 --- a/core/embed/rust/src/ui/model_tr/component/address_details.rs +++ b/core/embed/rust/src/ui/model_tr/component/address_details.rs @@ -260,7 +260,7 @@ impl Component for AddressDetails { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.pad.render(target); self.buttons.render(target); match self.current_page { diff --git a/core/embed/rust/src/ui/model_tr/component/bl_confirm.rs b/core/embed/rust/src/ui/model_tr/component/bl_confirm.rs index 8ac444980e..842c2ce224 100644 --- a/core/embed/rust/src/ui/model_tr/component/bl_confirm.rs +++ b/core/embed/rust/src/ui/model_tr/component/bl_confirm.rs @@ -218,7 +218,7 @@ impl Component for Confirm<'_> { self.buttons.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.bg.render(target); let mut display_top_left = |text: TString| { diff --git a/core/embed/rust/src/ui/model_tr/component/button.rs b/core/embed/rust/src/ui/model_tr/component/button.rs index ffa82a8f16..7e630d5d21 100644 --- a/core/embed/rust/src/ui/model_tr/component/button.rs +++ b/core/embed/rust/src/ui/model_tr/component/button.rs @@ -263,7 +263,7 @@ impl Component for Button { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let style = self.style(); let fg_color = style.text_color; let bg_color = fg_color.negate(); diff --git a/core/embed/rust/src/ui/model_tr/component/button_controller.rs b/core/embed/rust/src/ui/model_tr/component/button_controller.rs index 63d46eea41..2809388790 100644 --- a/core/embed/rust/src/ui/model_tr/component/button_controller.rs +++ b/core/embed/rust/src/ui/model_tr/component/button_controller.rs @@ -95,7 +95,7 @@ impl ButtonType { } } - pub fn render<'s>(&self, target: &mut impl Renderer<'s>) { + pub fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { match self { Self::Button(button) => { button.render(target); @@ -167,7 +167,7 @@ impl ButtonContainer { self.button_type.paint(); } - pub fn render<'s>(&self, target: &mut impl Renderer<'s>) { + pub fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.button_type.render(target); } @@ -592,7 +592,7 @@ impl Component for ButtonController { self.right_btn.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.pad.render(target); self.left_btn.render(target); self.middle_btn.render(target); @@ -778,7 +778,7 @@ impl Component for AutomaticMover { fn paint(&mut self) {} - fn render<'s>(&self, _target: &mut impl Renderer<'s>) {} + fn render<'s>(&'s self, _target: &mut impl Renderer<'s>) {} fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option { // Moving automatically only when we receive a TimerToken that we have diff --git a/core/embed/rust/src/ui/model_tr/component/changing_text.rs b/core/embed/rust/src/ui/model_tr/component/changing_text.rs index 302f2ced99..089566d10e 100644 --- a/core/embed/rust/src/ui/model_tr/component/changing_text.rs +++ b/core/embed/rust/src/ui/model_tr/component/changing_text.rs @@ -111,7 +111,7 @@ where common::display_left(baseline, &self.text, self.font); } - fn render_left<'s>(&self, target: &mut impl Renderer<'s>) { + fn render_left<'s>(&'s self, target: &mut impl Renderer<'s>) { let baseline = Point::new(self.pad.area.x0, self.y_baseline()); shape::Text::new(baseline, self.text.as_ref()) .with_font(self.font) @@ -123,7 +123,7 @@ where common::display_center(baseline, &self.text, self.font); } - fn render_center<'s>(&self, target: &mut impl Renderer<'s>) { + fn render_center<'s>(&'s self, target: &mut impl Renderer<'s>) { let baseline = Point::new(self.pad.area.bottom_center().x, self.y_baseline()); shape::Text::new(baseline, self.text.as_ref()) .with_align(Alignment::Center) @@ -136,7 +136,7 @@ where common::display_right(baseline, &self.text, self.font); } - fn render_right<'s>(&self, target: &mut impl Renderer<'s>) { + fn render_right<'s>(&'s self, target: &mut impl Renderer<'s>) { let baseline = Point::new(self.pad.area.x1, self.y_baseline()); shape::Text::new(baseline, self.text.as_ref()) .with_align(Alignment::End) @@ -201,7 +201,7 @@ where } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.pad.render(target); if self.show_content { // In the case text cannot fit, show ellipsis and its right part diff --git a/core/embed/rust/src/ui/model_tr/component/coinjoin_progress.rs b/core/embed/rust/src/ui/model_tr/component/coinjoin_progress.rs index af79043e7b..53e5892bd1 100644 --- a/core/embed/rust/src/ui/model_tr/component/coinjoin_progress.rs +++ b/core/embed/rust/src/ui/model_tr/component/coinjoin_progress.rs @@ -130,7 +130,7 @@ impl Component for CoinJoinProgress { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { // TOP let center = self.area.center() + Offset::y(self.loader_y_offset); diff --git a/core/embed/rust/src/ui/model_tr/component/error.rs b/core/embed/rust/src/ui/model_tr/component/error.rs index 6678c4f8d5..9772bc9d81 100644 --- a/core/embed/rust/src/ui/model_tr/component/error.rs +++ b/core/embed/rust/src/ui/model_tr/component/error.rs @@ -102,7 +102,7 @@ impl Component for ErrorScreen<'_> { self.footer.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.bg.render(target); if self.show_icons { diff --git a/core/embed/rust/src/ui/model_tr/component/flow.rs b/core/embed/rust/src/ui/model_tr/component/flow.rs index 2fccd204ab..eb4841673e 100644 --- a/core/embed/rust/src/ui/model_tr/component/flow.rs +++ b/core/embed/rust/src/ui/model_tr/component/flow.rs @@ -315,7 +315,7 @@ where self.current_page.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.pad.render(target); // Scrollbars are painted only with a title and when requested if self.title.is_some() { diff --git a/core/embed/rust/src/ui/model_tr/component/flow_pages.rs b/core/embed/rust/src/ui/model_tr/component/flow_pages.rs index 1ae5e85cc6..c143c74232 100644 --- a/core/embed/rust/src/ui/model_tr/component/flow_pages.rs +++ b/core/embed/rust/src/ui/model_tr/component/flow_pages.rs @@ -122,7 +122,7 @@ impl Page { self.formatted.paint(); } - pub fn render<'s>(&self, target: &mut impl Renderer<'s>) { + pub fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.formatted.render(target); } diff --git a/core/embed/rust/src/ui/model_tr/component/frame.rs b/core/embed/rust/src/ui/model_tr/component/frame.rs index 66c7bc7e7e..f47158d9e3 100644 --- a/core/embed/rust/src/ui/model_tr/component/frame.rs +++ b/core/embed/rust/src/ui/model_tr/component/frame.rs @@ -82,7 +82,7 @@ where self.content.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.title.render(target); self.content.render(target); } @@ -204,7 +204,7 @@ where self.content.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.title.render(target); self.scrollbar.render(target); self.content.render(target); diff --git a/core/embed/rust/src/ui/model_tr/component/hold_to_confirm.rs b/core/embed/rust/src/ui/model_tr/component/hold_to_confirm.rs index 1e1a18e76b..d0afb1e2cf 100644 --- a/core/embed/rust/src/ui/model_tr/component/hold_to_confirm.rs +++ b/core/embed/rust/src/ui/model_tr/component/hold_to_confirm.rs @@ -124,7 +124,7 @@ impl Component for HoldToConfirm { self.loader.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.loader.render(target); } } diff --git a/core/embed/rust/src/ui/model_tr/component/homescreen.rs b/core/embed/rust/src/ui/model_tr/component/homescreen.rs index 5a9cb4b09e..a8a5048697 100644 --- a/core/embed/rust/src/ui/model_tr/component/homescreen.rs +++ b/core/embed/rust/src/ui/model_tr/component/homescreen.rs @@ -117,7 +117,7 @@ impl Homescreen { } } - fn render_homescreen_image<'s>(&self, target: &mut impl Renderer<'s>) { + fn render_homescreen_image<'s>(&'s self, target: &mut impl Renderer<'s>) { if let Some(image) = self.custom_image { shape::ToifImage::new_image(TOP_CENTER, image) .with_align(Alignment2D::TOP_CENTER) @@ -159,7 +159,7 @@ impl Homescreen { } } - fn render_notification<'s>(&self, target: &mut impl Renderer<'s>) { + fn render_notification<'s>(&'s self, target: &mut impl Renderer<'s>) { let baseline = TOP_CENTER + Offset::y(NOTIFICATION_FONT.line_height()); if !usb_configured() { shape::Bar::new(AREA.split_top(NOTIFICATION_HEIGHT).0) @@ -214,7 +214,7 @@ impl Homescreen { self.label.paint(); } - fn render_label<'s>(&self, target: &mut impl Renderer<'s>) { + fn render_label<'s>(&'s self, target: &mut impl Renderer<'s>) { // paint black background to place the label let mut outset = Insets::uniform(LABEL_OUTSET); // the margin at top is bigger (caused by text-height vs line-height?) @@ -315,7 +315,7 @@ impl Component for Homescreen { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { // Redraw the whole screen when the screen changes (loader vs homescreen) if self.show_loader { self.loader.render(target); @@ -329,8 +329,8 @@ impl Component for Homescreen { } } -pub struct Lockscreen { - label: Child>, +pub struct Lockscreen<'a> { + label: Child>, instruction: Child>, /// Used for unlocking the device from lockscreen invisible_buttons: Child, @@ -340,8 +340,8 @@ pub struct Lockscreen { screensaver: bool, } -impl Lockscreen { - pub fn new(label: TString<'static>, bootscreen: bool, coinjoin_authorized: bool) -> Self { +impl<'a> Lockscreen<'a> { + pub fn new(label: TString<'a>, bootscreen: bool, coinjoin_authorized: bool) -> Self { // Buttons will not be visible, we only need all three of them to be present, // so that even middle-click triggers the event. let invisible_btn_layout = ButtonLayout::arrow_armed_arrow("".into()); @@ -360,7 +360,7 @@ impl Lockscreen { } } -impl Component for Lockscreen { +impl Component for Lockscreen<'_> { type Msg = (); fn place(&mut self, bounds: Rect) -> Rect { @@ -400,7 +400,7 @@ impl Component for Lockscreen { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { if self.screensaver { // keep screen blank return; @@ -484,7 +484,7 @@ impl Component for ConfirmHomescreen { self.buttons.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { if self.image.is_empty() { render_default_image(target); } else { @@ -537,7 +537,7 @@ impl crate::trace::Trace for Homescreen { } #[cfg(feature = "ui_debug")] -impl crate::trace::Trace for Lockscreen { +impl crate::trace::Trace for Lockscreen<'_> { fn trace(&self, t: &mut dyn crate::trace::Tracer) { t.component("Lockscreen"); t.child("label", &self.label); diff --git a/core/embed/rust/src/ui/model_tr/component/input_methods/choice.rs b/core/embed/rust/src/ui/model_tr/component/input_methods/choice.rs index c1d2e8d2b5..4cd681b775 100644 --- a/core/embed/rust/src/ui/model_tr/component/input_methods/choice.rs +++ b/core/embed/rust/src/ui/model_tr/component/input_methods/choice.rs @@ -257,7 +257,7 @@ where /// Display current, previous and next choices according to /// the current ChoiceItem. - fn render_choices<'s>(&self, target: &mut impl Renderer<'s>) { + fn render_choices<'s>(&'s self, target: &mut impl Renderer<'s>) { // Getting the row area for the choices - so that displaying // items in the used font will show them in the middle vertically. let area_height_half = self.pad.area.height() / 2; @@ -341,7 +341,7 @@ where } /// Display the current choice in the middle. - fn show_current_choice2<'s>(&self, target: &mut impl Renderer<'s>, area: Rect) { + fn show_current_choice2<'s>(&'s self, target: &mut impl Renderer<'s>, area: Rect) { self.get_current_item() .render_center(target, area, self.inverse_selected_item); } @@ -390,7 +390,7 @@ where /// Display all the choices fitting on the left side. /// Going as far as possible. - fn show_left_choices2<'s>(&self, target: &mut impl Renderer<'s>, area: Rect) { + fn show_left_choices2<'s>(&'s self, target: &mut impl Renderer<'s>, area: Rect) { // NOTE: page index can get negative here, so having it as i16 instead of usize let mut page_index = self.page_counter as i16 - 1; let mut current_area = area.split_right(self.items_distance).0; @@ -473,7 +473,7 @@ where /// Display all the choices fitting on the right side. /// Going as far as possible. - fn show_right_choices2<'s>(&self, target: &mut impl Renderer<'s>, area: Rect) { + fn show_right_choices2<'s>(&'s self, target: &mut impl Renderer<'s>, area: Rect) { let mut page_index = self.page_counter + 1; let mut current_area = area.split_left(self.items_distance).1; while current_area.width() > 0 { @@ -720,7 +720,7 @@ where self.paint_choices(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.pad.render(target); self.buttons.render(target); self.render_choices(target); diff --git a/core/embed/rust/src/ui/model_tr/component/input_methods/number_input.rs b/core/embed/rust/src/ui/model_tr/component/input_methods/number_input.rs index 3be90401b9..9d25e5db81 100644 --- a/core/embed/rust/src/ui/model_tr/component/input_methods/number_input.rs +++ b/core/embed/rust/src/ui/model_tr/component/input_methods/number_input.rs @@ -83,7 +83,7 @@ impl Component for NumberInput { self.choice_page.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.choice_page.render(target); } } diff --git a/core/embed/rust/src/ui/model_tr/component/input_methods/passphrase.rs b/core/embed/rust/src/ui/model_tr/component/input_methods/passphrase.rs index e818ee943d..d3f422a6ee 100644 --- a/core/embed/rust/src/ui/model_tr/component/input_methods/passphrase.rs +++ b/core/embed/rust/src/ui/model_tr/component/input_methods/passphrase.rs @@ -450,7 +450,7 @@ impl Component for PassphraseEntry { self.choice_page.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.passphrase_dots.render(target); self.choice_page.render(target); } diff --git a/core/embed/rust/src/ui/model_tr/component/input_methods/pin.rs b/core/embed/rust/src/ui/model_tr/component/input_methods/pin.rs index b6e8fff18b..e977e4ea37 100644 --- a/core/embed/rust/src/ui/model_tr/component/input_methods/pin.rs +++ b/core/embed/rust/src/ui/model_tr/component/input_methods/pin.rs @@ -325,7 +325,7 @@ impl Component for PinEntry<'_> { self.choice_page.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.header_line.render(target); self.pin_line.render(target); self.choice_page.render(target); diff --git a/core/embed/rust/src/ui/model_tr/component/input_methods/simple_choice.rs b/core/embed/rust/src/ui/model_tr/component/input_methods/simple_choice.rs index 262268a587..f322c8cf17 100644 --- a/core/embed/rust/src/ui/model_tr/component/input_methods/simple_choice.rs +++ b/core/embed/rust/src/ui/model_tr/component/input_methods/simple_choice.rs @@ -117,7 +117,7 @@ impl Component for SimpleChoice { self.choice_page.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.choice_page.render(target); } } diff --git a/core/embed/rust/src/ui/model_tr/component/input_methods/wordlist.rs b/core/embed/rust/src/ui/model_tr/component/input_methods/wordlist.rs index c6bf18da0f..27bfd4fffe 100644 --- a/core/embed/rust/src/ui/model_tr/component/input_methods/wordlist.rs +++ b/core/embed/rust/src/ui/model_tr/component/input_methods/wordlist.rs @@ -316,7 +316,7 @@ impl Component for WordlistEntry { self.choice_page.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.chosen_letters.render(target); self.choice_page.render(target); } diff --git a/core/embed/rust/src/ui/model_tr/component/loader.rs b/core/embed/rust/src/ui/model_tr/component/loader.rs index d0abd03093..799bfb19a9 100644 --- a/core/embed/rust/src/ui/model_tr/component/loader.rs +++ b/core/embed/rust/src/ui/model_tr/component/loader.rs @@ -168,7 +168,7 @@ impl Loader { } pub fn render_loader<'s>( - &self, + &'s self, target: &mut impl Renderer<'s>, style: &LoaderStyle, done: i32, @@ -271,7 +271,7 @@ impl Component for Loader { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { // TODO: Consider passing the current instant along with the event -- that way, // we could synchronize painting across the component tree. Also could be useful // in automated tests. @@ -393,7 +393,7 @@ impl Component for ProgressLoader { self.loader.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.loader.render(target); } } diff --git a/core/embed/rust/src/ui/model_tr/component/page.rs b/core/embed/rust/src/ui/model_tr/component/page.rs index 6b82d1d785..935f184c88 100644 --- a/core/embed/rust/src/ui/model_tr/component/page.rs +++ b/core/embed/rust/src/ui/model_tr/component/page.rs @@ -217,7 +217,7 @@ where self.buttons.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.pad.render(target); self.content.render(target); self.buttons.render(target); diff --git a/core/embed/rust/src/ui/model_tr/component/progress.rs b/core/embed/rust/src/ui/model_tr/component/progress.rs index c3906c4fd2..e44e39ed0e 100644 --- a/core/embed/rust/src/ui/model_tr/component/progress.rs +++ b/core/embed/rust/src/ui/model_tr/component/progress.rs @@ -154,7 +154,7 @@ impl Component for Progress { self.description.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.title.render(target); let area = constant::screen(); diff --git a/core/embed/rust/src/ui/model_tr/component/result.rs b/core/embed/rust/src/ui/model_tr/component/result.rs index c8aa604b0b..32f20f418b 100644 --- a/core/embed/rust/src/ui/model_tr/component/result.rs +++ b/core/embed/rust/src/ui/model_tr/component/result.rs @@ -110,7 +110,7 @@ impl Component for ResultScreen<'_> { self.message_bottom.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.bg.render(target); self.small_pad.render(target); diff --git a/core/embed/rust/src/ui/model_tr/component/scrollbar.rs b/core/embed/rust/src/ui/model_tr/component/scrollbar.rs index d5b11f8514..3e812ee91a 100644 --- a/core/embed/rust/src/ui/model_tr/component/scrollbar.rs +++ b/core/embed/rust/src/ui/model_tr/component/scrollbar.rs @@ -234,7 +234,7 @@ impl ScrollBar { } } - fn render_horizontal<'s>(&self, target: &mut impl Renderer<'s>) { + fn render_horizontal<'s>(&'s self, target: &mut impl Renderer<'s>) { let mut top_right = self.pad.area.top_right(); for dot in self.get_drawable_dots().iter().rev() { self.render_dot(target, dot, top_right); @@ -274,7 +274,7 @@ impl Component for ScrollBar { } /// Displaying one dot for each page. - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { // Not showing the scrollbar dot when there is only one page if self.page_count <= 1 { return; diff --git a/core/embed/rust/src/ui/model_tr/component/share_words.rs b/core/embed/rust/src/ui/model_tr/component/share_words.rs index 48a86c6043..c9ca066675 100644 --- a/core/embed/rust/src/ui/model_tr/component/share_words.rs +++ b/core/embed/rust/src/ui/model_tr/component/share_words.rs @@ -99,7 +99,7 @@ where } /// Display the final page with user confirmation. - fn render_final_page<'s>(&self, target: &mut impl Renderer<'s>) { + fn render_final_page<'s>(&'s self, target: &mut impl Renderer<'s>) { let final_text = self.get_final_text(); text_multiline2( target, @@ -131,7 +131,7 @@ where } /// Display current set of recovery words. - fn render_words<'s>(&self, target: &mut impl Renderer<'s>) { + fn render_words<'s>(&'s self, target: &mut impl Renderer<'s>) { let mut y_offset = 0; // Showing the word index and the words itself for i in 0..WORDS_PER_PAGE { @@ -191,7 +191,7 @@ where } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { // Showing scrollbar in all cases // Individual pages are responsible for not colliding with it self.scrollbar.render(target); diff --git a/core/embed/rust/src/ui/model_tr/component/show_more.rs b/core/embed/rust/src/ui/model_tr/component/show_more.rs index 60f1396715..c2a10e1b55 100644 --- a/core/embed/rust/src/ui/model_tr/component/show_more.rs +++ b/core/embed/rust/src/ui/model_tr/component/show_more.rs @@ -79,7 +79,7 @@ where self.buttons.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.content.render(target); self.buttons.render(target); } diff --git a/core/embed/rust/src/ui/model_tr/component/title.rs b/core/embed/rust/src/ui/model_tr/component/title.rs index 7b23e92164..a34e4a288d 100644 --- a/core/embed/rust/src/ui/model_tr/component/title.rs +++ b/core/embed/rust/src/ui/model_tr/component/title.rs @@ -135,7 +135,7 @@ impl Component for Title { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { if self.needs_marquee { self.marquee.render(target); } else if self.centered { diff --git a/core/embed/rust/src/ui/model_tr/component/welcome_screen.rs b/core/embed/rust/src/ui/model_tr/component/welcome_screen.rs index c97c74d79d..a824d85e77 100644 --- a/core/embed/rust/src/ui/model_tr/component/welcome_screen.rs +++ b/core/embed/rust/src/ui/model_tr/component/welcome_screen.rs @@ -55,7 +55,7 @@ impl Component for WelcomeScreen { ); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { shape::ToifImage::new( self.area.bottom_center() - Offset::y(5), theme::ICON_DEVICE_NAME.toif, diff --git a/core/embed/rust/src/ui/model_tr/layout.rs b/core/embed/rust/src/ui/model_tr/layout.rs index 29f0f4b9b9..8f4fae3882 100644 --- a/core/embed/rust/src/ui/model_tr/layout.rs +++ b/core/embed/rust/src/ui/model_tr/layout.rs @@ -204,7 +204,7 @@ impl ComponentMsgObj for Homescreen { } } -impl ComponentMsgObj for Lockscreen { +impl<'a> ComponentMsgObj for Lockscreen<'a> { fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result { Ok(CANCELLED.as_obj()) } diff --git a/core/embed/rust/src/ui/model_tt/bootloader/intro.rs b/core/embed/rust/src/ui/model_tt/bootloader/intro.rs index 97c4d32444..c52d8a6804 100644 --- a/core/embed/rust/src/ui/model_tt/bootloader/intro.rs +++ b/core/embed/rust/src/ui/model_tt/bootloader/intro.rs @@ -106,7 +106,7 @@ impl<'a> Component for Intro<'a> { self.menu.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.bg.render(target); self.title.render(target); self.text.render(target); diff --git a/core/embed/rust/src/ui/model_tt/bootloader/menu.rs b/core/embed/rust/src/ui/model_tt/bootloader/menu.rs index e97c4ebe9c..f542dea4b0 100644 --- a/core/embed/rust/src/ui/model_tt/bootloader/menu.rs +++ b/core/embed/rust/src/ui/model_tt/bootloader/menu.rs @@ -109,7 +109,7 @@ impl Component for Menu { self.reset.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.bg.render(target); self.title.render(target); self.close.render(target); diff --git a/core/embed/rust/src/ui/model_tt/bootloader/welcome.rs b/core/embed/rust/src/ui/model_tt/bootloader/welcome.rs index 7ccf6b241a..0e2e3302fb 100644 --- a/core/embed/rust/src/ui/model_tt/bootloader/welcome.rs +++ b/core/embed/rust/src/ui/model_tt/bootloader/welcome.rs @@ -59,7 +59,7 @@ impl Component for Welcome { ); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.bg.render(target); shape::Text::new(screen().top_center() + Offset::y(102), "Get started with") diff --git a/core/embed/rust/src/ui/model_tt/component/address_details.rs b/core/embed/rust/src/ui/model_tt/component/address_details.rs index a6bc1bc57d..b8ce8f9161 100644 --- a/core/embed/rust/src/ui/model_tt/component/address_details.rs +++ b/core/embed/rust/src/ui/model_tt/component/address_details.rs @@ -177,7 +177,7 @@ impl Component for AddressDetails { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { match self.current_page { 0 => self.qr_code.render(target), 1 => self.details.render(target), diff --git a/core/embed/rust/src/ui/model_tt/component/bl_confirm.rs b/core/embed/rust/src/ui/model_tt/component/bl_confirm.rs index 1684f63f51..3bd1de1616 100644 --- a/core/embed/rust/src/ui/model_tt/component/bl_confirm.rs +++ b/core/embed/rust/src/ui/model_tt/component/bl_confirm.rs @@ -239,7 +239,7 @@ impl Component for Confirm<'_> { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.bg.render(target); self.content_pad.render(target); diff --git a/core/embed/rust/src/ui/model_tt/component/button.rs b/core/embed/rust/src/ui/model_tt/component/button.rs index b3467cb589..46a11a2ae9 100644 --- a/core/embed/rust/src/ui/model_tt/component/button.rs +++ b/core/embed/rust/src/ui/model_tt/component/button.rs @@ -377,7 +377,7 @@ impl Component for Button { self.paint_content(style); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let style = self.style(); self.render_background(target, style); self.render_content(target, style); diff --git a/core/embed/rust/src/ui/model_tt/component/coinjoin_progress.rs b/core/embed/rust/src/ui/model_tt/component/coinjoin_progress.rs index 79653855cd..411c91d355 100644 --- a/core/embed/rust/src/ui/model_tt/component/coinjoin_progress.rs +++ b/core/embed/rust/src/ui/model_tt/component/coinjoin_progress.rs @@ -125,7 +125,7 @@ where self.label.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.content.render(target); let center = constant::screen().center() + Offset::y(LOADER_OFFSET); diff --git a/core/embed/rust/src/ui/model_tt/component/dialog.rs b/core/embed/rust/src/ui/model_tt/component/dialog.rs index a3523af626..c66d37a91f 100644 --- a/core/embed/rust/src/ui/model_tt/component/dialog.rs +++ b/core/embed/rust/src/ui/model_tt/component/dialog.rs @@ -72,7 +72,7 @@ where self.controls.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.content.render(target); self.controls.render(target); } @@ -202,7 +202,7 @@ where self.controls.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.image.render(target); self.paragraphs.render(target); self.controls.render(target); diff --git a/core/embed/rust/src/ui/model_tt/component/error.rs b/core/embed/rust/src/ui/model_tt/component/error.rs index 0437d57e74..12d2bf064b 100644 --- a/core/embed/rust/src/ui/model_tt/component/error.rs +++ b/core/embed/rust/src/ui/model_tt/component/error.rs @@ -92,7 +92,7 @@ impl<'a> Component for ErrorScreen<'a> { self.footer.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.bg.render(target); let icon = ICON_WARNING40; diff --git a/core/embed/rust/src/ui/model_tt/component/fido.rs b/core/embed/rust/src/ui/model_tt/component/fido.rs index 35af98f8a2..f17a2910de 100644 --- a/core/embed/rust/src/ui/model_tt/component/fido.rs +++ b/core/embed/rust/src/ui/model_tt/component/fido.rs @@ -213,7 +213,7 @@ where } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.icon.render(target); self.controls.render(target); self.app_name.render(target); diff --git a/core/embed/rust/src/ui/model_tt/component/frame.rs b/core/embed/rust/src/ui/model_tt/component/frame.rs index 4832a76cc5..a8e847f712 100644 --- a/core/embed/rust/src/ui/model_tt/component/frame.rs +++ b/core/embed/rust/src/ui/model_tt/component/frame.rs @@ -176,7 +176,7 @@ where self.content.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.title.render(target); self.subtitle.render(target); self.button.render(target); diff --git a/core/embed/rust/src/ui/model_tt/component/homescreen/mod.rs b/core/embed/rust/src/ui/model_tt/component/homescreen/mod.rs index ed6c125bf8..4874580bdf 100644 --- a/core/embed/rust/src/ui/model_tt/component/homescreen/mod.rs +++ b/core/embed/rust/src/ui/model_tt/component/homescreen/mod.rs @@ -125,7 +125,7 @@ impl Homescreen { self.loader.paint() } - fn render_loader<'s>(&self, target: &mut impl Renderer<'s>) { + fn render_loader<'s>(&'s self, target: &mut impl Renderer<'s>) { TR::progress__locking_device.map_translated(|t| { shape::Text::new(TOP_CENTER + Offset::y(HOLD_Y), t) .with_align(Alignment::Center) @@ -259,7 +259,7 @@ impl Component for Homescreen { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.pad.render(target); if self.loader.is_animating() || self.loader.is_completely_grown(Instant::now()) { self.render_loader(target); @@ -353,15 +353,15 @@ impl crate::trace::Trace for Homescreen { } } -pub struct Lockscreen { - label: TString<'static>, - image: BinaryData<'static>, +pub struct Lockscreen<'a> { + label: TString<'a>, + image: BinaryData<'a>, bootscreen: bool, coinjoin_authorized: bool, } -impl Lockscreen { - pub fn new(label: TString<'static>, bootscreen: bool, coinjoin_authorized: bool) -> Self { +impl<'a> Lockscreen<'a> { + pub fn new(label: TString<'a>, bootscreen: bool, coinjoin_authorized: bool) -> Self { Lockscreen { label, image: get_homescreen_image(), @@ -371,7 +371,7 @@ impl Lockscreen { } } -impl Component for Lockscreen { +impl Component for Lockscreen<'_> { type Msg = HomescreenMsg; fn place(&mut self, bounds: Rect) -> Rect { @@ -451,7 +451,7 @@ impl Component for Lockscreen { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let center = constant::screen().center(); match ImageInfo::parse(self.image) { @@ -572,7 +572,7 @@ fn get_homescreen_image() -> BinaryData<'static> { } #[cfg(feature = "ui_debug")] -impl crate::trace::Trace for Lockscreen { +impl crate::trace::Trace for Lockscreen<'_> { fn trace(&self, t: &mut dyn crate::trace::Tracer) { t.component("Lockscreen"); } diff --git a/core/embed/rust/src/ui/model_tt/component/keyboard/bip39.rs b/core/embed/rust/src/ui/model_tt/component/keyboard/bip39.rs index 7a92bc4f96..2f29ae6525 100644 --- a/core/embed/rust/src/ui/model_tt/component/keyboard/bip39.rs +++ b/core/embed/rust/src/ui/model_tt/component/keyboard/bip39.rs @@ -156,7 +156,7 @@ impl Component for Bip39Input { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let area = self.button.area(); let style = self.button.style(); diff --git a/core/embed/rust/src/ui/model_tt/component/keyboard/mnemonic.rs b/core/embed/rust/src/ui/model_tt/component/keyboard/mnemonic.rs index 92e954f328..6d70c89b9d 100644 --- a/core/embed/rust/src/ui/model_tt/component/keyboard/mnemonic.rs +++ b/core/embed/rust/src/ui/model_tt/component/keyboard/mnemonic.rs @@ -184,7 +184,7 @@ where } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { if self.input.inner().inner().is_empty() { self.prompt.render(target); } else { diff --git a/core/embed/rust/src/ui/model_tt/component/keyboard/passphrase.rs b/core/embed/rust/src/ui/model_tt/component/keyboard/passphrase.rs index cfc2bccedd..9b31d9fca8 100644 --- a/core/embed/rust/src/ui/model_tt/component/keyboard/passphrase.rs +++ b/core/embed/rust/src/ui/model_tt/component/keyboard/passphrase.rs @@ -301,7 +301,7 @@ impl Component for PassphraseKeyboard { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.input.render(target); self.scrollbar.render(target); self.confirm.render(target); @@ -395,7 +395,7 @@ impl Component for Input { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let style = theme::label_keyboard(); let text_baseline = self.area.top_left() + Offset::y(style.text_font.text_height()) diff --git a/core/embed/rust/src/ui/model_tt/component/keyboard/pin.rs b/core/embed/rust/src/ui/model_tt/component/keyboard/pin.rs index 1a5270cfb9..e0a27a83a2 100644 --- a/core/embed/rust/src/ui/model_tt/component/keyboard/pin.rs +++ b/core/embed/rust/src/ui/model_tt/component/keyboard/pin.rs @@ -266,7 +266,7 @@ impl Component for PinKeyboard<'_> { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.erase_btn.render(target); self.textbox_pad.render(target); if self.textbox.inner().is_empty() { @@ -530,7 +530,7 @@ impl Component for PinDots { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let dot_area = self.area.inset(HEADER_PADDING); self.pad.render(target); if self.display_digits { diff --git a/core/embed/rust/src/ui/model_tt/component/keyboard/slip39.rs b/core/embed/rust/src/ui/model_tt/component/keyboard/slip39.rs index 55bf5972b4..0794d9c280 100644 --- a/core/embed/rust/src/ui/model_tt/component/keyboard/slip39.rs +++ b/core/embed/rust/src/ui/model_tt/component/keyboard/slip39.rs @@ -187,7 +187,7 @@ impl Component for Slip39Input { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let area = self.button.area(); let style = self.button.style(); diff --git a/core/embed/rust/src/ui/model_tt/component/keyboard/word_count.rs b/core/embed/rust/src/ui/model_tt/component/keyboard/word_count.rs index 5cb2fabc9d..c6614293e3 100644 --- a/core/embed/rust/src/ui/model_tt/component/keyboard/word_count.rs +++ b/core/embed/rust/src/ui/model_tt/component/keyboard/word_count.rs @@ -58,7 +58,7 @@ impl Component for SelectWordCount { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { for btn in self.button.iter() { btn.render(target) } diff --git a/core/embed/rust/src/ui/model_tt/component/loader.rs b/core/embed/rust/src/ui/model_tt/component/loader.rs index 39933e7b95..11429ec61d 100644 --- a/core/embed/rust/src/ui/model_tt/component/loader.rs +++ b/core/embed/rust/src/ui/model_tt/component/loader.rs @@ -223,7 +223,7 @@ impl Component for Loader { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { // TODO: Consider passing the current instant along with the event -- that way, // we could synchronize painting across the component tree. Also could be useful // in automated tests. diff --git a/core/embed/rust/src/ui/model_tt/component/number_input.rs b/core/embed/rust/src/ui/model_tt/component/number_input.rs index 2954c201ed..07e855cfbe 100644 --- a/core/embed/rust/src/ui/model_tt/component/number_input.rs +++ b/core/embed/rust/src/ui/model_tt/component/number_input.rs @@ -121,7 +121,7 @@ where self.confirm_button.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.input.render(target); self.paragraphs_pad.render(target); self.paragraphs.render(target); @@ -236,7 +236,7 @@ impl Component for NumberInput { self.inc.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let mut buf = [0u8; 10]; if let Some(text) = strutil::format_i64(self.value as i64, &mut buf) { diff --git a/core/embed/rust/src/ui/model_tt/component/number_input_slider.rs b/core/embed/rust/src/ui/model_tt/component/number_input_slider.rs index 8af13045ad..c0a650f72a 100644 --- a/core/embed/rust/src/ui/model_tt/component/number_input_slider.rs +++ b/core/embed/rust/src/ui/model_tt/component/number_input_slider.rs @@ -78,7 +78,7 @@ impl Component for NumberInputSliderDialog { self.confirm_button.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.input.render(target); self.cancel_button.render(target); self.confirm_button.render(target); @@ -167,7 +167,7 @@ impl Component for NumberInputSlider { display::bar_with_text_and_fill(self.area, None, theme::FG, theme::BG, 0, fill_to as _); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let val_pct = (100 * (self.value - self.min)) / (self.max - self.min); shape::Bar::new(self.area) diff --git a/core/embed/rust/src/ui/model_tt/component/page.rs b/core/embed/rust/src/ui/model_tt/component/page.rs index 83ba81652f..075269a094 100644 --- a/core/embed/rust/src/ui/model_tt/component/page.rs +++ b/core/embed/rust/src/ui/model_tt/component/page.rs @@ -419,7 +419,7 @@ where } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.pad.render(target); match &self.loader { Some(l) if l.is_animating() => self.loader.render(target), diff --git a/core/embed/rust/src/ui/model_tt/component/progress.rs b/core/embed/rust/src/ui/model_tt/component/progress.rs index 2cc2ab1578..1d4f133279 100644 --- a/core/embed/rust/src/ui/model_tt/component/progress.rs +++ b/core/embed/rust/src/ui/model_tt/component/progress.rs @@ -108,7 +108,7 @@ impl Component for Progress { self.description.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.title.render(target); let center = constant::screen().center() + Offset::y(self.loader_y_offset); diff --git a/core/embed/rust/src/ui/model_tt/component/result.rs b/core/embed/rust/src/ui/model_tt/component/result.rs index 8eb5456a7e..e14d82c31e 100644 --- a/core/embed/rust/src/ui/model_tt/component/result.rs +++ b/core/embed/rust/src/ui/model_tt/component/result.rs @@ -98,7 +98,7 @@ impl Component for ResultFooter<'_> { self.text.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { // divider line let bar = Rect::from_center_and_size( Point::new(self.area.center().x, self.area.y0), @@ -183,7 +183,7 @@ impl<'a> Component for ResultScreen<'a> { self.footer.paint(); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.bg.render(target); self.footer_pad.render(target); diff --git a/core/embed/rust/src/ui/model_tt/component/scroll.rs b/core/embed/rust/src/ui/model_tt/component/scroll.rs index d091082b57..1ea96fd960 100644 --- a/core/embed/rust/src/ui/model_tt/component/scroll.rs +++ b/core/embed/rust/src/ui/model_tt/component/scroll.rs @@ -124,7 +124,7 @@ impl Component for ScrollBar { } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { fn dotsize(distance: usize, nhidden: usize) -> Icon { match (nhidden.saturating_sub(distance)).min(2 - distance) { 0 => theme::DOT_INACTIVE, diff --git a/core/embed/rust/src/ui/model_tt/component/set_brightness.rs b/core/embed/rust/src/ui/model_tt/component/set_brightness.rs index e271a12a44..ebb4c3c3a0 100644 --- a/core/embed/rust/src/ui/model_tt/component/set_brightness.rs +++ b/core/embed/rust/src/ui/model_tt/component/set_brightness.rs @@ -55,7 +55,7 @@ impl Component for SetBrightnessDialog { self.0.paint() } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.0.render(target); } diff --git a/core/embed/rust/src/ui/model_tt/component/simple_page.rs b/core/embed/rust/src/ui/model_tt/component/simple_page.rs index aa851a0055..b14f9f7bea 100644 --- a/core/embed/rust/src/ui/model_tt/component/simple_page.rs +++ b/core/embed/rust/src/ui/model_tt/component/simple_page.rs @@ -167,7 +167,7 @@ where } } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { self.pad.render(target); self.content.render(target); if self.scrollbar.has_pages() { diff --git a/core/embed/rust/src/ui/model_tt/component/swipe.rs b/core/embed/rust/src/ui/model_tt/component/swipe.rs index 541cb87793..3539900d45 100644 --- a/core/embed/rust/src/ui/model_tt/component/swipe.rs +++ b/core/embed/rust/src/ui/model_tt/component/swipe.rs @@ -160,5 +160,5 @@ impl Component for Swipe { fn paint(&mut self) {} - fn render<'s>(&self, _target: &mut impl Renderer<'s>) {} + fn render<'s>(&'s self, _target: &mut impl Renderer<'s>) {} } diff --git a/core/embed/rust/src/ui/model_tt/component/welcome_screen.rs b/core/embed/rust/src/ui/model_tt/component/welcome_screen.rs index 5e1cbfad75..2a359ede10 100644 --- a/core/embed/rust/src/ui/model_tt/component/welcome_screen.rs +++ b/core/embed/rust/src/ui/model_tt/component/welcome_screen.rs @@ -76,7 +76,7 @@ impl Component for WelcomeScreen { ); } - fn render<'s>(&self, target: &mut impl Renderer<'s>) { + fn render<'s>(&'s self, target: &mut impl Renderer<'s>) { let logo = if self.empty_lock { theme::ICON_LOGO_EMPTY } else { diff --git a/core/embed/rust/src/ui/model_tt/layout.rs b/core/embed/rust/src/ui/model_tt/layout.rs index bcce7c6edc..494d68d42d 100644 --- a/core/embed/rust/src/ui/model_tt/layout.rs +++ b/core/embed/rust/src/ui/model_tt/layout.rs @@ -245,7 +245,7 @@ impl ComponentMsgObj for Homescreen { } } -impl ComponentMsgObj for Lockscreen { +impl ComponentMsgObj for Lockscreen<'_> { fn msg_try_into_obj(&self, msg: Self::Msg) -> Result { match msg { HomescreenMsg::Dismissed => Ok(CANCELLED.as_obj()), diff --git a/core/embed/rust/src/ui/shape/display/direct_canvas.rs b/core/embed/rust/src/ui/shape/display/direct_canvas.rs index b59b5e2e6a..c4350ae7c1 100644 --- a/core/embed/rust/src/ui/shape/display/direct_canvas.rs +++ b/core/embed/rust/src/ui/shape/display/direct_canvas.rs @@ -1,6 +1,6 @@ use crate::ui::{ display::Color, - shape::{Canvas, DirectRenderer, DrawingCache}, + shape::{render::ScopedRenderer, Canvas, DirectRenderer, DrawingCache}, }; use super::bumps::run_with_bumps; @@ -12,13 +12,13 @@ use super::bumps::run_with_bumps; /// `bg_color` specifies a background color with which the canvas is filled /// before the drawing starts. If the background color is None, the background /// is undefined, and the user has to fill it themselves. -pub fn render_on_canvas(canvas: &mut C, bg_color: Option, func: F) +pub fn render_on_canvas<'env, C: Canvas, F>(canvas: &mut C, bg_color: Option, func: F) where - F: for<'a> FnOnce(&mut DirectRenderer<'_, 'a, C>), + F: for<'alloc> FnOnce(&mut ScopedRenderer<'alloc, 'env, DirectRenderer<'_, 'alloc, C>>), { run_with_bumps(|bump_a, bump_b| { let cache = DrawingCache::new(bump_a, bump_b); - let mut target = DirectRenderer::new(canvas, bg_color, &cache); + let mut target = ScopedRenderer::new(DirectRenderer::new(canvas, bg_color, &cache)); func(&mut target); }); } diff --git a/core/embed/rust/src/ui/shape/display/fake_display.rs b/core/embed/rust/src/ui/shape/display/fake_display.rs index f7309b0f78..99a4dcd6f2 100644 --- a/core/embed/rust/src/ui/shape/display/fake_display.rs +++ b/core/embed/rust/src/ui/shape/display/fake_display.rs @@ -1,11 +1,13 @@ use crate::ui::{ display::Color, - shape::{DirectRenderer, Mono8Canvas, Viewport}, + shape::{render::ScopedRenderer, DirectRenderer, Mono8Canvas, Viewport}, }; -pub fn render_on_display(_viewport: Option, _bg_color: Option, _func: F) +type ConcreteRenderer<'a, 'alloc> = DirectRenderer<'a, 'alloc, Mono8Canvas<'alloc>>; + +pub fn render_on_display<'env, F>(_viewport: Option, _bg_color: Option, _func: F) where - F: for<'a> FnOnce(&mut DirectRenderer<'_, 'a, Mono8Canvas<'a>>), + F: for<'alloc> FnOnce(&mut ScopedRenderer<'alloc, 'env, ConcreteRenderer<'_, 'alloc>>), { unimplemented!(); } diff --git a/core/embed/rust/src/ui/shape/display/fb_mono8.rs b/core/embed/rust/src/ui/shape/display/fb_mono8.rs index de638ef2af..713978f3db 100644 --- a/core/embed/rust/src/ui/shape/display/fb_mono8.rs +++ b/core/embed/rust/src/ui/shape/display/fb_mono8.rs @@ -1,13 +1,17 @@ use crate::ui::{ display::Color, geometry::Offset, - shape::{BasicCanvas, DirectRenderer, DrawingCache, Mono8Canvas, Viewport}, + shape::{ + render::ScopedRenderer, BasicCanvas, DirectRenderer, DrawingCache, Mono8Canvas, Viewport, + }, }; use crate::trezorhal::display; use static_alloc::Bump; +type ConcreteRenderer<'a, 'alloc> = DirectRenderer<'a, 'alloc, Mono8Canvas<'alloc>>; + /// Creates the `Renderer` object for drawing on a display and invokes a /// user-defined function that takes a single argument `target`. The user's /// function can utilize the `target` for drawing on the display. @@ -18,9 +22,9 @@ use static_alloc::Bump; /// `bg_color` specifies a background color with which the clip is filled before /// the drawing starts. If the background color is None, the background /// is undefined, and the user has to fill it themselves. -pub fn render_on_display(viewport: Option, bg_color: Option, func: F) +pub fn render_on_display<'env, F>(viewport: Option, bg_color: Option, func: F) where - F: for<'a> FnOnce(&mut DirectRenderer<'_, 'a, Mono8Canvas<'a>>), + F: for<'alloc> FnOnce(&mut ScopedRenderer<'alloc, 'env, ConcreteRenderer<'_, 'alloc>>), { const BUMP_SIZE: usize = DrawingCache::get_bump_a_size() + DrawingCache::get_bump_b_size(); @@ -48,7 +52,7 @@ where canvas.set_viewport(viewport); } - let mut target = DirectRenderer::new(&mut canvas, bg_color, &cache); + let mut target = ScopedRenderer::new(DirectRenderer::new(&mut canvas, bg_color, &cache)); func(&mut target); } diff --git a/core/embed/rust/src/ui/shape/display/fb_rgb565.rs b/core/embed/rust/src/ui/shape/display/fb_rgb565.rs index f6756e4af5..8af5ebd79a 100644 --- a/core/embed/rust/src/ui/shape/display/fb_rgb565.rs +++ b/core/embed/rust/src/ui/shape/display/fb_rgb565.rs @@ -1,13 +1,17 @@ use crate::ui::{ display::Color, geometry::Offset, - shape::{BasicCanvas, DirectRenderer, DrawingCache, Rgb565Canvas, Viewport}, + shape::{ + render::ScopedRenderer, BasicCanvas, DirectRenderer, DrawingCache, Rgb565Canvas, Viewport, + }, }; use super::bumps; use crate::trezorhal::display; +type ConcreteRenderer<'a, 'alloc> = DirectRenderer<'a, 'alloc, Rgb565Canvas<'alloc>>; + /// Creates the `Renderer` object for drawing on a display and invokes a /// user-defined function that takes a single argument `target`. The user's /// function can utilize the `target` for drawing on the display. @@ -18,9 +22,9 @@ use crate::trezorhal::display; /// `bg_color` specifies a background color with which the clip is filled before /// the drawing starts. If the background color is None, the background /// is undefined, and the user has to fill it themselves. -pub fn render_on_display(viewport: Option, bg_color: Option, func: F) +pub fn render_on_display<'env, F>(viewport: Option, bg_color: Option, func: F) where - F: for<'a> FnOnce(&mut DirectRenderer<'_, 'a, Rgb565Canvas<'a>>), + F: for<'alloc> FnOnce(&mut ScopedRenderer<'alloc, 'env, ConcreteRenderer<'_, 'alloc>>), { bumps::run_with_bumps(|bump_a, bump_b| { let width = display::DISPLAY_RESX as i16; @@ -41,7 +45,7 @@ where canvas.set_viewport(viewport); } - let mut target = DirectRenderer::new(&mut canvas, bg_color, &cache); + let mut target = ScopedRenderer::new(DirectRenderer::new(&mut canvas, bg_color, &cache)); func(&mut target); }); diff --git a/core/embed/rust/src/ui/shape/display/fb_rgba8888.rs b/core/embed/rust/src/ui/shape/display/fb_rgba8888.rs index e54afe5475..e75941aadc 100644 --- a/core/embed/rust/src/ui/shape/display/fb_rgba8888.rs +++ b/core/embed/rust/src/ui/shape/display/fb_rgba8888.rs @@ -1,13 +1,17 @@ use crate::ui::{ display::Color, geometry::Offset, - shape::{BasicCanvas, DirectRenderer, DrawingCache, Rgba8888Canvas, Viewport}, + shape::{ + render::ScopedRenderer, BasicCanvas, DirectRenderer, DrawingCache, Rgba8888Canvas, Viewport, + }, }; use super::bumps; use crate::trezorhal::display; +type ConcreteRenderer<'a, 'alloc> = DirectRenderer<'a, 'alloc, Rgba8888Canvas<'alloc>>; + /// Creates the `Renderer` object for drawing on a display and invokes a /// user-defined function that takes a single argument `target`. The user's /// function can utilize the `target` for drawing on the display. @@ -18,9 +22,9 @@ use crate::trezorhal::display; /// `bg_color` specifies a background color with which the clip is filled before /// the drawing starts. If the background color is None, the background /// is undefined, and the user has to fill it themselves. -pub fn render_on_display(viewport: Option, bg_color: Option, func: F) +pub fn render_on_display<'env, F>(viewport: Option, bg_color: Option, func: F) where - F: for<'a> FnOnce(&mut DirectRenderer<'_, 'a, Rgba8888Canvas<'a>>), + F: for<'alloc> FnOnce(&mut ScopedRenderer<'alloc, 'env, ConcreteRenderer<'_, 'alloc>>), { bumps::run_with_bumps(|bump_a, bump_b| { let width = display::DISPLAY_RESX as i16; @@ -41,7 +45,7 @@ where canvas.set_viewport(viewport); } - let mut target = DirectRenderer::new(&mut canvas, bg_color, &cache); + let mut target = ScopedRenderer::new(DirectRenderer::new(&mut canvas, bg_color, &cache)); func(&mut target); }); diff --git a/core/embed/rust/src/ui/shape/display/nofb_rgb565.rs b/core/embed/rust/src/ui/shape/display/nofb_rgb565.rs index 4ac7f7360b..b2d372e6d8 100644 --- a/core/embed/rust/src/ui/shape/display/nofb_rgb565.rs +++ b/core/embed/rust/src/ui/shape/display/nofb_rgb565.rs @@ -1,6 +1,9 @@ -use crate::trezorhal::{ - bitblt::{BitBltCopy, BitBltFill}, - display, +use crate::{ + trezorhal::{ + bitblt::{BitBltCopy, BitBltFill}, + display, + }, + ui::shape::render::ScopedRenderer, }; use crate::ui::{ @@ -14,6 +17,9 @@ use super::bumps; use static_alloc::Bump; +type ConcreteRenderer<'a, 'alloc> = + ProgressiveRenderer<'a, 'alloc, Bump<[u8; bumps::BUMP_A_SIZE]>, DisplayCanvas>; + /// Creates the `Renderer` object for drawing on a display and invokes a /// user-defined function that takes a single argument `target`. The user's /// function can utilize the `target` for drawing on the display. @@ -24,11 +30,9 @@ use static_alloc::Bump; /// `bg_color` specifies a background color with which the clip is filled before /// the drawing starts. If the background color is None, the background /// is undefined, and the user has to fill it themselves. -pub fn render_on_display(viewport: Option, bg_color: Option, func: F) +pub fn render_on_display<'env, F>(viewport: Option, bg_color: Option, func: F) where - F: for<'a> FnOnce( - &mut ProgressiveRenderer<'_, 'a, Bump<[u8; bumps::BUMP_A_SIZE]>, DisplayCanvas>, - ), + F: for<'alloc> FnOnce(&mut ScopedRenderer<'alloc, 'env, ConcreteRenderer<'_, 'alloc>>), { bumps::run_with_bumps(|bump_a, bump_b| { let cache = DrawingCache::new(bump_a, bump_b); @@ -38,17 +42,17 @@ where canvas.set_viewport(viewport); } - let mut target = ProgressiveRenderer::new( + let mut target = ScopedRenderer::new(ProgressiveRenderer::new( &mut canvas, bg_color, &cache, bump_a, bumps::SHAPE_MAX_COUNT, - ); + )); func(&mut target); - target.render(16); + target.into_inner().render(16); }); } diff --git a/core/embed/rust/src/ui/shape/render.rs b/core/embed/rust/src/ui/shape/render.rs index a9658fc425..7551febc09 100644 --- a/core/embed/rust/src/ui/shape/render.rs +++ b/core/embed/rust/src/ui/shape/render.rs @@ -252,3 +252,50 @@ where } } } + +pub struct ScopedRenderer<'alloc, 'env, T> +where + 'env: 'alloc, + T: Renderer<'alloc>, +{ + pub renderer: T, + _env: core::marker::PhantomData<&'env mut &'env ()>, + _alloc: core::marker::PhantomData<&'alloc ()>, +} + +impl<'alloc, T> ScopedRenderer<'alloc, '_, T> +where + T: Renderer<'alloc>, +{ + pub fn new(renderer: T) -> Self { + Self { + renderer, + _env: core::marker::PhantomData, + _alloc: core::marker::PhantomData, + } + } + + pub fn into_inner(self) -> T { + self.renderer + } +} + +impl<'alloc, T> Renderer<'alloc> for ScopedRenderer<'alloc, '_, T> +where + T: Renderer<'alloc>, +{ + fn viewport(&self) -> Viewport { + self.renderer.viewport() + } + + fn set_viewport(&mut self, viewport: Viewport) { + self.renderer.set_viewport(viewport); + } + + fn render_shape(&mut self, shape: S) + where + S: Shape<'alloc> + ShapeClone<'alloc>, + { + self.renderer.render_shape(shape); + } +}