1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 06:48:16 +00:00

fix(core): revert bad renderer lifetime changes

[no changelog]
This commit is contained in:
matejcik 2024-05-29 16:07:32 +02:00 committed by TychoVrahe
parent f793e6d509
commit 4e1e3bc550
126 changed files with 286 additions and 218 deletions

View File

@ -41,7 +41,7 @@ impl Component for Bar {
display::rect_fill_rounded(self.area, self.color, self.bg_color, self.radius as u8); 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) shape::Bar::new(self.area)
.with_bg(self.color) .with_bg(self.color)
.with_radius(self.radius) .with_radius(self.radius)

View File

@ -63,7 +63,7 @@ pub trait Component {
/// the `Child` wrapper. /// the `Child` wrapper.
fn paint(&mut self); 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")] #[cfg(feature = "ui_bounds")]
/// Report current paint bounds of this component. Used for debugging. /// 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); self.component.render(target);
} }
@ -279,7 +279,7 @@ where
self.inner.paint(); 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); self.inner().render(target);
} }
@ -321,7 +321,7 @@ where
self.1.paint(); 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.0.render(target);
self.1.render(target); self.1.render(target);
} }
@ -375,7 +375,7 @@ where
self.2.paint(); 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.0.render(target);
self.1.render(target); self.1.render(target);
self.2.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 { if let Some(ref c) = self {
c.render(target) c.render(target)
} }

View File

@ -42,7 +42,7 @@ where
self.inner.paint() 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); self.inner.render(target);
} }

View File

@ -41,7 +41,7 @@ impl<T: Component> Component for OneButtonRequest<T> {
self.inner.paint() 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) self.inner.render(target)
} }
} }

View File

@ -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; let font = Font::NORMAL;
self.bg.render(target); self.bg.render(target);

View File

@ -17,7 +17,7 @@ impl Component for Empty {
fn paint(&mut self) {} 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")] #[cfg(feature = "ui_debug")]

View File

@ -50,7 +50,7 @@ impl Component for Image {
self.draw(self.area.center(), Alignment2D::CENTER); 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) shape::ToifImage::new(self.area.center(), self.toif)
.with_align(Alignment2D::CENTER) .with_align(Alignment2D::CENTER)
.render(target); .render(target);
@ -138,7 +138,7 @@ impl Component for BlendedImage {
self.paint_image(); 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) shape::ToifImage::new(self.bg_top_left, self.bg.toif)
.with_fg(self.bg_color) .with_fg(self.bg_color)
.render(target); .render(target);

View File

@ -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) shape::JpegImage::new_image(self.area.center(), self.image)
.with_align(Alignment2D::CENTER) .with_align(Alignment2D::CENTER)
.with_scale(self.scale) .with_scale(self.scale)

View File

@ -136,7 +136,7 @@ impl Component for Label<'_> {
self.text.map(|c| self.layout.render_text(c)); 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)); self.text.map(|c| self.layout.render_text2(c, target));
} }

View File

@ -31,7 +31,7 @@ where
self.inner.paint() 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); self.inner.render(target);
} }
@ -102,7 +102,7 @@ where
self.inner.paint() 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); self.inner.render(target);
} }

View File

@ -124,7 +124,7 @@ impl Marquee {
.map(|t| display::marquee(self.area, t, offset, self.font, self.fg, self.bg)); .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| { target.in_window(self.area, &|target| {
let text_height = self.font.text_height(); let text_height = self.font.text_height();
let pos = self.area.top_left() + Offset::new(offset, text_height - 1); 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(); let now = Instant::now();
match self.state { match self.state {

View File

@ -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); self.pad.render(target);
if self.visible { if self.visible {
self.inner.render(target); self.inner.render(target);

View File

@ -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) shape::Bar::new(self.area)
.with_bg(self.color) .with_bg(self.color)
.render(target); .render(target);

View File

@ -65,7 +65,7 @@ where
self.inner.paint() 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); self.inner.render(target);
} }
} }
@ -112,7 +112,7 @@ where
self.inner.paint() 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); self.inner.render(target);
} }
} }
@ -188,7 +188,7 @@ where
self.inner.paint() 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); self.inner.render(target);
} }
} }
@ -283,7 +283,7 @@ where
self.second.paint(); 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.first.render(target);
self.second.render(target); self.second.render(target);
} }

View File

@ -143,7 +143,7 @@ impl Component for Qr {
Self::draw(&qr, area, self.border, scale); 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 outbuffer = [0u8; QR_MAX_VERSION.buffer_len()];
let mut tempbuffer = [0u8; QR_MAX_VERSION.buffer_len()]; let mut tempbuffer = [0u8; QR_MAX_VERSION.buffer_len()];

View File

@ -155,5 +155,5 @@ impl Component for Swipe {
fn paint(&mut self) {} fn paint(&mut self) {}
fn render<'s>(&self, _target: &mut impl Renderer<'s>) {} fn render<'s>(&'s self, _target: &mut impl Renderer<'s>) {}
} }

View File

@ -134,7 +134,7 @@ impl Component for FormattedText {
self.layout_content(&mut TextRenderer); 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)); self.layout_content(&mut TextRenderer2::new(target));
} }

View File

@ -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::foreach_visible(
&self.source, &self.source,
&self.visible, &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.paragraphs.render(target);
self.render_left_column(target); self.render_left_column(target);
} }

View File

@ -47,7 +47,7 @@ impl Component for Timeout {
fn paint(&mut self) {} 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")] #[cfg(feature = "ui_debug")]

View File

@ -67,7 +67,11 @@ impl<T: Component + Paginate + Clone> SwipePage<T> {
finished finished
} }
fn render_transition<'s>(&self, transition: &Transition<T>, target: &mut impl Renderer<'s>) { fn render_transition<'s>(
&'s self,
transition: &'s Transition<T>,
target: &mut impl Renderer<'s>,
) {
target.in_clip(self.bounds, &|target| { target.in_clip(self.bounds, &|target| {
util::render_slide( util::render_slide(
|target| transition.cloned.render(target), |target| transition.cloned.render(target),
@ -106,7 +110,7 @@ impl<T: Component + Paginate + Clone> Component for SwipePage<T> {
self.inner.paint() 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 { if let Some(t) = &self.transition {
return self.render_transition(t, target); return self.render_transition(t, target);
} }
@ -197,7 +201,7 @@ impl<T: Component> Component for IgnoreSwipe<T> {
self.0.paint() 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) self.0.render(target)
} }
} }

View File

@ -22,7 +22,7 @@ pub trait FlowStore {
fn event(&mut self, i: usize, ctx: &mut EventCtx, event: Event) -> Option<FlowMsg>; fn event(&mut self, i: usize, ctx: &mut EventCtx, event: Event) -> Option<FlowMsg>;
/// Call `Component::render` on i-th element. /// 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")] #[cfg(feature = "ui_debug")]
/// Call `Trace::trace` on i-th element. /// Call `Trace::trace` on i-th element.
@ -62,7 +62,7 @@ impl FlowStore for FlowEmpty {
panic!() 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!() 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 { if i == 0 {
self.as_ref().render(target) self.as_ref().render(target)
} else { } else {

View File

@ -80,12 +80,12 @@ impl<Q: FlowState, S: FlowStore> SwipeFlow<Q, S> {
ctx.request_paint(); 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) self.store.render(state.index(), target)
} }
fn render_transition<'s>( fn render_transition<'s>(
&self, &'s self,
prev_state: &Q, prev_state: &Q,
animation: &Animation<f32>, animation: &Animation<f32>,
direction: &SwipeDirection, direction: &SwipeDirection,
@ -188,7 +188,7 @@ impl<Q: FlowState, S: FlowStore> Component for SwipeFlow<Q, S> {
fn paint(&mut self) {} 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 { match &self.transition {
Transition::None | Transition::Internal => self.render_state(self.state, target), Transition::None | Transition::Internal => self.render_state(self.state, target),
Transition::External { Transition::External {

View File

@ -107,7 +107,7 @@ impl<'a> Component for Intro<'a> {
self.menu.paint(); 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.bg.render(target);
self.title.render(target); self.title.render(target);
self.text.render(target); self.text.render(target);

View File

@ -109,7 +109,7 @@ impl Component for Menu {
self.reset.paint(); 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.bg.render(target);
self.title.render(target); self.title.render(target);
self.close.render(target); self.close.render(target);

View File

@ -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); self.bg.render(target);
shape::Text::new(TEXT_ORIGIN, "Get started") shape::Text::new(TEXT_ORIGIN, "Get started")

View File

@ -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 { match self.current_page {
0 => self.details.render(target), 0 => self.details.render(target),
_ => self.xpub_view.render(target), _ => self.xpub_view.render(target),

View File

@ -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.bg.render(target);
self.content_pad.render(target); self.content_pad.render(target);

View File

@ -408,7 +408,7 @@ impl Component for Button {
self.paint_content(style); 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(); let style = self.style();
self.render_background(target, style, 0xFF); self.render_background(target, style, 0xFF);
self.render_content(target, style, 0xFF); self.render_content(target, style, 0xFF);

View File

@ -124,7 +124,7 @@ where
self.label.paint(); 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); self.content.render(target);
let center = constant::screen().center() + Offset::y(LOADER_OFFSET); let center = constant::screen().center() + Offset::y(LOADER_OFFSET);

View File

@ -72,7 +72,7 @@ where
self.controls.paint(); 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.content.render(target);
self.controls.render(target); self.controls.render(target);
} }
@ -202,7 +202,7 @@ where
self.controls.paint(); 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.image.render(target);
self.paragraphs.render(target); self.paragraphs.render(target);
self.controls.render(target); self.controls.render(target);

View File

@ -92,7 +92,7 @@ impl<'a> Component for ErrorScreen<'a> {
self.footer.paint(); 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.bg.render(target);
let icon = ICON_WARNING40; let icon = ICON_WARNING40;

View File

@ -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.icon.render(target);
self.controls.render(target); self.controls.render(target);
self.app_name.render(target); self.app_name.render(target);

View File

@ -94,7 +94,7 @@ impl<'a> Component for Footer<'a> {
todo!() 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 // show description only if there is space for it
if self.area.height() == Footer::HEIGHT_DEFAULT { if self.area.height() == Footer::HEIGHT_DEFAULT {
if let Some(description) = self.text_description { if let Some(description) = self.text_description {

View File

@ -218,7 +218,7 @@ where
self.footer.paint(); self.footer.paint();
self.content.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.title.render(target);
self.subtitle.render(target); self.subtitle.render(target);
self.button.render(target); self.button.render(target);

View File

@ -245,7 +245,7 @@ impl Component for HoldToConfirm {
unimplemented!() 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(); let elapsed = self.anim.eval();
shape::Bar::new(screen()) shape::Bar::new(screen())

View File

@ -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| { TR::progress__locking_device.map_translated(|t| {
shape::Text::new(TOP_CENTER + Offset::y(HOLD_Y), t) shape::Text::new(TOP_CENTER + Offset::y(HOLD_Y), t)
.with_align(Alignment::Center) .with_align(Alignment::Center)
@ -188,7 +188,7 @@ impl Component for Homescreen {
todo!() 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()) { if self.loader.is_animating() || self.loader.is_completely_grown(Instant::now()) {
self.render_loader(target); self.render_loader(target);
} else { } else {
@ -353,15 +353,14 @@ impl Component for Lockscreen {
todo!() 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_SIZE: i16 = 170;
const OVERLAY_BORDER: i16 = (AREA.height() - OVERLAY_SIZE) / 2; const OVERLAY_BORDER: i16 = (AREA.height() - OVERLAY_SIZE) / 2;
const OVERLAY_OFFSET: i16 = 9; const OVERLAY_OFFSET: i16 = 9;
let center = AREA.center(); let center = AREA.center();
// shape::RawImage::new(AREA, self.bg_image.view()) shape::RawImage::new(AREA, self.bg_image.view()).render(target);
// .render(target);
cshape::UnlockOverlay::new(center + Offset::y(OVERLAY_OFFSET), self.anim.eval()) cshape::UnlockOverlay::new(center + Offset::y(OVERLAY_OFFSET), self.anim.eval())
.render(target); .render(target);

View File

@ -107,7 +107,7 @@ impl Component for Bip39Input {
todo!("remove when ui-t3t1 done"); 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 area = self.button.area();
let style = self.button.style(); let style = self.button.style();

View File

@ -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() { if self.input.inner().inner().is_empty() {
self.prompt.render(target); self.prompt.render(target);
if self.can_go_back { if self.can_go_back {

View File

@ -372,7 +372,7 @@ impl Component for PassphraseKeyboard {
todo!("remove when ui-t3t1 done") 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.input.render(target);
self.next_btn.render(target); self.next_btn.render(target);
self.erase_btn.render(target); self.erase_btn.render(target);
@ -436,7 +436,7 @@ impl Component for Input {
todo!("remove when ui-t3t1 done"); 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 style = theme::label_keyboard();
let text_baseline = self.area.top_left() + Offset::y(style.text_font.text_height()) let text_baseline = self.area.top_left() + Offset::y(style.text_font.text_height())

View File

@ -237,7 +237,7 @@ impl Component for PinKeyboard<'_> {
todo!("remove when ui-t3t1 done"); 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.erase_btn.render(target);
self.textbox_pad.render(target); self.textbox_pad.render(target);
@ -433,7 +433,7 @@ impl Component for PinDots {
// TODO: remove when ui-t3t1 done // 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); let dot_area = self.area.inset(HEADER_PADDING);
self.pad.render(target); self.pad.render(target);
if self.display_digits { if self.display_digits {

View File

@ -127,7 +127,7 @@ impl Component for Slip39Input {
todo!("remove when ui-t3t1 done") 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 area = self.button.area();
let style = self.button.style(); let style = self.button.style();

View File

@ -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() { for btn in self.button.iter() {
btn.render(target) btn.render(target)
} }

View File

@ -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, // TODO: Consider passing the current instant along with the event -- that way,
// we could synchronize painting across the component tree. Also could be useful // we could synchronize painting across the component tree. Also could be useful
// in automated tests. // in automated tests.

View File

@ -97,7 +97,7 @@ where
todo!("remove when ui-t3t1 done"); 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.input.render(target);
self.paragraphs_pad.render(target); self.paragraphs_pad.render(target);
self.paragraphs.render(target); self.paragraphs.render(target);
@ -212,7 +212,7 @@ impl Component for NumberInput {
todo!("remove when ui-t3t1 done"); 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]; let mut buf = [0u8; 10];
if let Some(text) = strutil::format_i64(self.value as i64, &mut buf) { if let Some(text) = strutil::format_i64(self.value as i64, &mut buf) {

View File

@ -92,7 +92,7 @@ impl Component for NumberInputSliderDialog {
self.confirm_button.paint(); 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.input.render(target);
let mut str = ShortString::new(); 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 _); 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); let val_pct = (100 * (self.value - self.min)) / (self.max - self.min);
shape::Bar::new(self.area) shape::Bar::new(self.area)

View File

@ -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); self.pad.render(target);
match &self.loader { match &self.loader {
Some(l) if l.is_animating() => self.loader.render(target), Some(l) if l.is_animating() => self.loader.render(target),

View File

@ -110,7 +110,7 @@ impl Component for Progress {
self.description.paint(); 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); self.title.render(target);
let center = constant::screen().center() + Offset::y(self.loader_y_offset); let center = constant::screen().center() + Offset::y(self.loader_y_offset);

View File

@ -60,7 +60,7 @@ impl Component for PromptScreen {
todo!() todo!()
} }
fn render<'s>(&self, target: &mut impl Renderer<'s>) { fn render<'s>(&'s self, target: &mut impl Renderer<'s>) {
match self { match self {
PromptScreen::Tap(t) => t.render(target), PromptScreen::Tap(t) => t.render(target),
PromptScreen::Hold(h) => h.render(target), PromptScreen::Hold(h) => h.render(target),

View File

@ -97,7 +97,7 @@ impl Component for ResultFooter<'_> {
self.text.paint(); self.text.paint();
} }
fn render<'s>(&self, target: &mut impl Renderer<'s>) { fn render<'s>(&'s self, target: &mut impl Renderer<'s>) {
// divider line // divider line
let bar = Rect::from_center_and_size( let bar = Rect::from_center_and_size(
Point::new(self.area.center().x, self.area.y0), Point::new(self.area.center().x, self.area.y0),
@ -182,7 +182,7 @@ impl<'a> Component for ResultScreen<'a> {
self.footer.paint(); 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.bg.render(target);
self.footer_pad.render(target); self.footer_pad.render(target);

View File

@ -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 { fn dotsize(distance: usize, nhidden: usize) -> Icon {
match (nhidden.saturating_sub(distance)).min(2 - distance) { match (nhidden.saturating_sub(distance)).min(2 - distance) {
0 => theme::DOT_INACTIVE, 0 => theme::DOT_INACTIVE,

View File

@ -55,7 +55,7 @@ impl Component for SetBrightnessDialog {
self.0.paint() 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); self.0.render(target);
} }

View File

@ -110,7 +110,7 @@ impl<'a> Component for ShareWords<'a> {
// TODO: remove when ui-t3t1 done // 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 // corner highlights
let (_, top_right_shape, bot_left_shape, bot_right_shape) = let (_, top_right_shape, bot_left_shape, bot_right_shape) =
shape::CornerHighlight::from_rect(self.area_word, theme::GREY_DARK, theme::BG); shape::CornerHighlight::from_rect(self.area_word, theme::GREY_DARK, theme::BG);

View File

@ -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.pad.render(target);
self.content.render(target); self.content.render(target);
if self.scrollbar.has_pages() { if self.scrollbar.has_pages() {

View File

@ -194,7 +194,7 @@ impl Component for StatusScreen {
todo!() 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(); let t = self.anim.eval();
shape::Circle::new(self.area.center(), self.anim.get_circle_radius(t)) shape::Circle::new(self.area.center(), self.anim.get_circle_radius(t))

View File

@ -52,7 +52,7 @@ where
todo!() todo!()
} }
fn render<'s>(&self, target: &mut impl Renderer<'s>) { fn render<'s>(&'s self, target: &mut impl Renderer<'s>) {
self.content.render(target); self.content.render(target);
} }

View File

@ -196,7 +196,7 @@ impl Component for TapToConfirm {
unimplemented!() 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_RADIUS: i16 = 70;
const PAD_THICKNESS: i16 = 20; const PAD_THICKNESS: i16 = 20;
const CIRCLE_RADIUS: i16 = 50; const CIRCLE_RADIUS: i16 = 50;

View File

@ -119,7 +119,7 @@ impl Component for VerticalMenu {
// TODO remove when ui-t3t1 done // 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 // render buttons separated by thin bars
for button in &self.buttons { for button in &self.buttons {
button.render(target); button.render(target);

View File

@ -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( shape::ToifImage::new(
self.area.top_center() + Offset::y(ICON_TOP_MARGIN), self.area.top_center() + Offset::y(ICON_TOP_MARGIN),
theme::ICON_LOGO.toif, theme::ICON_LOGO.toif,

View File

@ -106,7 +106,7 @@ impl<'a> Component for Intro<'a> {
self.buttons.paint(); 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.bg.render(target);
self.title.render(target); self.title.render(target);

View File

@ -184,7 +184,7 @@ impl Component for Menu {
self.choice_page.paint(); 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.pad.render(target);
self.choice_page.render(target); self.choice_page.render(target);
} }

View File

@ -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); self.bg.render(target);
let top_center = self.bg.area.top_center(); let top_center = self.bg.area.top_center();

View File

@ -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.pad.render(target);
self.buttons.render(target); self.buttons.render(target);
match self.current_page { match self.current_page {

View File

@ -218,7 +218,7 @@ impl Component for Confirm<'_> {
self.buttons.paint(); 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.bg.render(target);
let mut display_top_left = |text: TString| { let mut display_top_left = |text: TString| {

View File

@ -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 style = self.style();
let fg_color = style.text_color; let fg_color = style.text_color;
let bg_color = fg_color.negate(); let bg_color = fg_color.negate();

View File

@ -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 { match self {
Self::Button(button) => { Self::Button(button) => {
button.render(target); button.render(target);
@ -167,7 +167,7 @@ impl ButtonContainer {
self.button_type.paint(); 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); self.button_type.render(target);
} }
@ -592,7 +592,7 @@ impl Component for ButtonController {
self.right_btn.paint(); 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.pad.render(target);
self.left_btn.render(target); self.left_btn.render(target);
self.middle_btn.render(target); self.middle_btn.render(target);
@ -778,7 +778,7 @@ impl Component for AutomaticMover {
fn paint(&mut self) {} 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<Self::Msg> { fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> {
// Moving automatically only when we receive a TimerToken that we have // Moving automatically only when we receive a TimerToken that we have

View File

@ -111,7 +111,7 @@ where
common::display_left(baseline, &self.text, self.font); 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()); let baseline = Point::new(self.pad.area.x0, self.y_baseline());
shape::Text::new(baseline, self.text.as_ref()) shape::Text::new(baseline, self.text.as_ref())
.with_font(self.font) .with_font(self.font)
@ -123,7 +123,7 @@ where
common::display_center(baseline, &self.text, self.font); 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()); let baseline = Point::new(self.pad.area.bottom_center().x, self.y_baseline());
shape::Text::new(baseline, self.text.as_ref()) shape::Text::new(baseline, self.text.as_ref())
.with_align(Alignment::Center) .with_align(Alignment::Center)
@ -136,7 +136,7 @@ where
common::display_right(baseline, &self.text, self.font); 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()); let baseline = Point::new(self.pad.area.x1, self.y_baseline());
shape::Text::new(baseline, self.text.as_ref()) shape::Text::new(baseline, self.text.as_ref())
.with_align(Alignment::End) .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); self.pad.render(target);
if self.show_content { if self.show_content {
// In the case text cannot fit, show ellipsis and its right part // In the case text cannot fit, show ellipsis and its right part

View File

@ -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 // TOP
let center = self.area.center() + Offset::y(self.loader_y_offset); let center = self.area.center() + Offset::y(self.loader_y_offset);

View File

@ -102,7 +102,7 @@ impl Component for ErrorScreen<'_> {
self.footer.paint(); 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.bg.render(target);
if self.show_icons { if self.show_icons {

View File

@ -315,7 +315,7 @@ where
self.current_page.paint(); 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); self.pad.render(target);
// Scrollbars are painted only with a title and when requested // Scrollbars are painted only with a title and when requested
if self.title.is_some() { if self.title.is_some() {

View File

@ -122,7 +122,7 @@ impl Page {
self.formatted.paint(); 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); self.formatted.render(target);
} }

View File

@ -82,7 +82,7 @@ where
self.content.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.title.render(target);
self.content.render(target); self.content.render(target);
} }
@ -204,7 +204,7 @@ where
self.content.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.title.render(target);
self.scrollbar.render(target); self.scrollbar.render(target);
self.content.render(target); self.content.render(target);

View File

@ -124,7 +124,7 @@ impl Component for HoldToConfirm {
self.loader.paint(); 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); self.loader.render(target);
} }
} }

View File

@ -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 { if let Some(image) = self.custom_image {
shape::ToifImage::new_image(TOP_CENTER, image) shape::ToifImage::new_image(TOP_CENTER, image)
.with_align(Alignment2D::TOP_CENTER) .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()); let baseline = TOP_CENTER + Offset::y(NOTIFICATION_FONT.line_height());
if !usb_configured() { if !usb_configured() {
shape::Bar::new(AREA.split_top(NOTIFICATION_HEIGHT).0) shape::Bar::new(AREA.split_top(NOTIFICATION_HEIGHT).0)
@ -214,7 +214,7 @@ impl Homescreen {
self.label.paint(); 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 // paint black background to place the label
let mut outset = Insets::uniform(LABEL_OUTSET); let mut outset = Insets::uniform(LABEL_OUTSET);
// the margin at top is bigger (caused by text-height vs line-height?) // 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) // Redraw the whole screen when the screen changes (loader vs homescreen)
if self.show_loader { if self.show_loader {
self.loader.render(target); self.loader.render(target);
@ -329,8 +329,8 @@ impl Component for Homescreen {
} }
} }
pub struct Lockscreen { pub struct Lockscreen<'a> {
label: Child<Label<'static>>, label: Child<Label<'a>>,
instruction: Child<Label<'static>>, instruction: Child<Label<'static>>,
/// Used for unlocking the device from lockscreen /// Used for unlocking the device from lockscreen
invisible_buttons: Child<ButtonController>, invisible_buttons: Child<ButtonController>,
@ -340,8 +340,8 @@ pub struct Lockscreen {
screensaver: bool, screensaver: bool,
} }
impl Lockscreen { impl<'a> Lockscreen<'a> {
pub fn new(label: TString<'static>, bootscreen: bool, coinjoin_authorized: bool) -> Self { 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, // Buttons will not be visible, we only need all three of them to be present,
// so that even middle-click triggers the event. // so that even middle-click triggers the event.
let invisible_btn_layout = ButtonLayout::arrow_armed_arrow("".into()); 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 = (); type Msg = ();
fn place(&mut self, bounds: Rect) -> Rect { 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 { if self.screensaver {
// keep screen blank // keep screen blank
return; return;
@ -484,7 +484,7 @@ impl Component for ConfirmHomescreen {
self.buttons.paint(); 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() { if self.image.is_empty() {
render_default_image(target); render_default_image(target);
} else { } else {
@ -537,7 +537,7 @@ impl crate::trace::Trace for Homescreen {
} }
#[cfg(feature = "ui_debug")] #[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) { fn trace(&self, t: &mut dyn crate::trace::Tracer) {
t.component("Lockscreen"); t.component("Lockscreen");
t.child("label", &self.label); t.child("label", &self.label);

View File

@ -257,7 +257,7 @@ where
/// Display current, previous and next choices according to /// Display current, previous and next choices according to
/// the current ChoiceItem. /// 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 // Getting the row area for the choices - so that displaying
// items in the used font will show them in the middle vertically. // items in the used font will show them in the middle vertically.
let area_height_half = self.pad.area.height() / 2; let area_height_half = self.pad.area.height() / 2;
@ -341,7 +341,7 @@ where
} }
/// Display the current choice in the middle. /// 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() self.get_current_item()
.render_center(target, area, self.inverse_selected_item); .render_center(target, area, self.inverse_selected_item);
} }
@ -390,7 +390,7 @@ where
/// Display all the choices fitting on the left side. /// Display all the choices fitting on the left side.
/// Going as far as possible. /// 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 // 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 page_index = self.page_counter as i16 - 1;
let mut current_area = area.split_right(self.items_distance).0; 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. /// Display all the choices fitting on the right side.
/// Going as far as possible. /// 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 page_index = self.page_counter + 1;
let mut current_area = area.split_left(self.items_distance).1; let mut current_area = area.split_left(self.items_distance).1;
while current_area.width() > 0 { while current_area.width() > 0 {
@ -720,7 +720,7 @@ where
self.paint_choices(); 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.pad.render(target);
self.buttons.render(target); self.buttons.render(target);
self.render_choices(target); self.render_choices(target);

View File

@ -83,7 +83,7 @@ impl Component for NumberInput {
self.choice_page.paint(); 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); self.choice_page.render(target);
} }
} }

View File

@ -450,7 +450,7 @@ impl Component for PassphraseEntry {
self.choice_page.paint(); 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.passphrase_dots.render(target);
self.choice_page.render(target); self.choice_page.render(target);
} }

View File

@ -325,7 +325,7 @@ impl Component for PinEntry<'_> {
self.choice_page.paint(); 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.header_line.render(target);
self.pin_line.render(target); self.pin_line.render(target);
self.choice_page.render(target); self.choice_page.render(target);

View File

@ -117,7 +117,7 @@ impl Component for SimpleChoice {
self.choice_page.paint(); 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); self.choice_page.render(target);
} }
} }

View File

@ -316,7 +316,7 @@ impl Component for WordlistEntry {
self.choice_page.paint(); 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.chosen_letters.render(target);
self.choice_page.render(target); self.choice_page.render(target);
} }

View File

@ -168,7 +168,7 @@ impl Loader {
} }
pub fn render_loader<'s>( pub fn render_loader<'s>(
&self, &'s self,
target: &mut impl Renderer<'s>, target: &mut impl Renderer<'s>,
style: &LoaderStyle, style: &LoaderStyle,
done: i32, 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, // TODO: Consider passing the current instant along with the event -- that way,
// we could synchronize painting across the component tree. Also could be useful // we could synchronize painting across the component tree. Also could be useful
// in automated tests. // in automated tests.
@ -393,7 +393,7 @@ impl Component for ProgressLoader {
self.loader.paint(); 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); self.loader.render(target);
} }
} }

View File

@ -217,7 +217,7 @@ where
self.buttons.paint(); 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.pad.render(target);
self.content.render(target); self.content.render(target);
self.buttons.render(target); self.buttons.render(target);

View File

@ -154,7 +154,7 @@ impl Component for Progress {
self.description.paint(); 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); self.title.render(target);
let area = constant::screen(); let area = constant::screen();

View File

@ -110,7 +110,7 @@ impl Component for ResultScreen<'_> {
self.message_bottom.paint(); 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.bg.render(target);
self.small_pad.render(target); self.small_pad.render(target);

View File

@ -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(); let mut top_right = self.pad.area.top_right();
for dot in self.get_drawable_dots().iter().rev() { for dot in self.get_drawable_dots().iter().rev() {
self.render_dot(target, dot, top_right); self.render_dot(target, dot, top_right);
@ -274,7 +274,7 @@ impl Component for ScrollBar {
} }
/// Displaying one dot for each page. /// 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 // Not showing the scrollbar dot when there is only one page
if self.page_count <= 1 { if self.page_count <= 1 {
return; return;

View File

@ -99,7 +99,7 @@ where
} }
/// Display the final page with user confirmation. /// 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(); let final_text = self.get_final_text();
text_multiline2( text_multiline2(
target, target,
@ -131,7 +131,7 @@ where
} }
/// Display current set of recovery words. /// 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; let mut y_offset = 0;
// Showing the word index and the words itself // Showing the word index and the words itself
for i in 0..WORDS_PER_PAGE { 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 // Showing scrollbar in all cases
// Individual pages are responsible for not colliding with it // Individual pages are responsible for not colliding with it
self.scrollbar.render(target); self.scrollbar.render(target);

View File

@ -79,7 +79,7 @@ where
self.buttons.paint(); 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.content.render(target);
self.buttons.render(target); self.buttons.render(target);
} }

View File

@ -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 { if self.needs_marquee {
self.marquee.render(target); self.marquee.render(target);
} else if self.centered { } else if self.centered {

View File

@ -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( shape::ToifImage::new(
self.area.bottom_center() - Offset::y(5), self.area.bottom_center() - Offset::y(5),
theme::ICON_DEVICE_NAME.toif, theme::ICON_DEVICE_NAME.toif,

View File

@ -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<Obj, Error> { fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
Ok(CANCELLED.as_obj()) Ok(CANCELLED.as_obj())
} }

View File

@ -106,7 +106,7 @@ impl<'a> Component for Intro<'a> {
self.menu.paint(); 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.bg.render(target);
self.title.render(target); self.title.render(target);
self.text.render(target); self.text.render(target);

View File

@ -109,7 +109,7 @@ impl Component for Menu {
self.reset.paint(); 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.bg.render(target);
self.title.render(target); self.title.render(target);
self.close.render(target); self.close.render(target);

View File

@ -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); self.bg.render(target);
shape::Text::new(screen().top_center() + Offset::y(102), "Get started with") shape::Text::new(screen().top_center() + Offset::y(102), "Get started with")

View File

@ -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 { match self.current_page {
0 => self.qr_code.render(target), 0 => self.qr_code.render(target),
1 => self.details.render(target), 1 => self.details.render(target),

View File

@ -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.bg.render(target);
self.content_pad.render(target); self.content_pad.render(target);

View File

@ -377,7 +377,7 @@ impl Component for Button {
self.paint_content(style); 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(); let style = self.style();
self.render_background(target, style); self.render_background(target, style);
self.render_content(target, style); self.render_content(target, style);

View File

@ -125,7 +125,7 @@ where
self.label.paint(); 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); self.content.render(target);
let center = constant::screen().center() + Offset::y(LOADER_OFFSET); let center = constant::screen().center() + Offset::y(LOADER_OFFSET);

View File

@ -72,7 +72,7 @@ where
self.controls.paint(); 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.content.render(target);
self.controls.render(target); self.controls.render(target);
} }
@ -202,7 +202,7 @@ where
self.controls.paint(); 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.image.render(target);
self.paragraphs.render(target); self.paragraphs.render(target);
self.controls.render(target); self.controls.render(target);

View File

@ -92,7 +92,7 @@ impl<'a> Component for ErrorScreen<'a> {
self.footer.paint(); 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.bg.render(target);
let icon = ICON_WARNING40; let icon = ICON_WARNING40;

View File

@ -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.icon.render(target);
self.controls.render(target); self.controls.render(target);
self.app_name.render(target); self.app_name.render(target);

View File

@ -176,7 +176,7 @@ where
self.content.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.title.render(target);
self.subtitle.render(target); self.subtitle.render(target);
self.button.render(target); self.button.render(target);

Some files were not shown because too many files have changed in this diff Show More