refactor(core): remove unused clearing-related API in `Pad`
What changed, and why it matters
This is a code cleanup change in the Trezor firmware's user-interface code. It removes an old 'clear' flag and related functions from a background-drawing helper called Pad, because that flag no longer did anything useful. The commit does not fix a security bug or change device behavior in a way that affects secrets or user safety.
No security action needed. Treat as a normal refactoring review; verify visually that no behavior changed beyond the intended removal of no-op clear calls.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors the Rust UI component Pad in trezor-firmware. It removes the clear boolean field and the methods with_clear(), clear(), cancel_clear(), and will_paint(), plus all call sites. It also removes the complete_draw argument from ResultScreen::new. The commit message explains that Pad::render() always fills its entire area, so the clear flag became a no-op after the legacy paint() path was removed in PR #4337. The change is purely a simplification/dead-code removal across Bolt, Caesar, and Delizia UI layouts.
Changed components
core/embed/rust/src/ui/component/pad.rscore/embed/rust/src/ui/component/connect.rscore/embed/rust/src/ui/component/maybe.rscore/embed/rust/src/ui/layout_bolt/*core/embed/rust/src/ui/layout_caesar/*core/embed/rust/src/ui/layout_delizia/*Inspect captured patch +44 / −159
### core/embed/rust/src/ui/component/connect.rs
@@ -16,15 +16,12 @@ impl Connect {
where
T: Into<TString<'static>>,
{
- let mut instance = Self {
+ Self {
fg,
bg: Pad::with_background(bg),
message: message.into(),
font,
- };
-
- instance.bg.clear();
- instance
+ }
}
}
### core/embed/rust/src/ui/component/maybe.rs
@@ -36,9 +36,6 @@ where
if self.visible != show {
self.visible = show;
- // Invalidate the pad, so either we prepare a fresh canvas for the content, or
- // paint over it.
- self.pad.clear();
if show {
// Make sure the whole inner tree is painted.
self.inner.request_complete_repaint(ctx);
### core/embed/rust/src/ui/component/pad.rs
@@ -6,45 +6,20 @@ use crate::ui::shape::Renderer;
pub struct Pad {
pub area: Rect,
pub color: Color,
- clear: bool,
}
impl Pad {
pub fn with_background(color: Color) -> Self {
Self {
color,
area: Rect::zero(),
- clear: false,
- }
- }
-
- pub fn with_clear(self) -> Self {
- Self {
- clear: true,
- ..self
}
}
pub fn place(&mut self, area: Rect) {
self.area = area;
}
- pub fn clear(&mut self) {
- self.clear = true;
- }
-
- pub fn cancel_clear(&mut self) {
- self.clear = false;
- }
-
- pub fn will_paint(&self) -> Option<(Rect, Color)> {
- if self.clear {
- Some((self.area, self.color))
- } else {
- None
- }
- }
-
pub fn render<'s>(&'s self, target: &mut impl Renderer<'s>) {
shape::Bar::new(self.area)
.with_bg(self.color)
### core/embed/rust/src/ui/layout_bolt/bootloader/connect.rs
@@ -52,17 +52,14 @@ impl Connect {
let menu = if show_menu { Some(menu_btn) } else { None };
- let mut instance = Self {
+ Self {
fg,
bg: Pad::with_background(bg),
message: message.into(),
font,
button: cancel,
menu,
- };
-
- instance.bg.clear();
- instance
+ }
}
}
### core/embed/rust/src/ui/layout_bolt/bootloader/intro.rs
@@ -31,7 +31,7 @@ pub struct Intro<'a> {
impl<'a> Intro<'a> {
pub fn new(title: TString<'a>, content: TString<'a>, fw_ok: bool) -> Self {
Self {
- bg: Pad::with_background(BLD_BG).with_clear(),
+ bg: Pad::with_background(BLD_BG),
title: Label::left_aligned(title, text_title(BLD_BG)).vertically_centered(),
menu: Button::with_icon(Icon::new(MENU32))
.styled(button_bld_menu())
### core/embed/rust/src/ui/layout_bolt/bootloader/menu.rs
@@ -40,7 +40,7 @@ impl Menu {
let content_bluetooth = IconText::new("BLUETOOTH", Icon::new(FIRE24));
let content_poweroff = IconText::new("POWER OFF", Icon::new(FIRE24));
- let mut instance = Self {
+ Self {
bg: Pad::with_background(BLD_BG),
title: Label::left_aligned("BOOTLOADER".into(), text_title(BLD_BG))
.vertically_centered(),
@@ -54,9 +54,7 @@ impl Menu {
reset: Button::with_icon_and_text(content_reset).styled(button_bld()),
bluetooth: Button::with_icon_and_text(content_bluetooth).styled(button_bld()),
poweroff: Button::with_icon_and_text(content_poweroff).styled(button_bld()),
- };
- instance.bg.clear();
- instance
+ }
}
pub fn get_button_pos(&self, i: u8) -> Rect {
### core/embed/rust/src/ui/layout_bolt/bootloader/mod.rs
@@ -111,7 +111,6 @@ impl UIBolt {
Icon::new(CHECK40),
"Firmware installed\nsuccessfully".into(),
Label::centered(msg.into(), RESULT_FW_INSTALL.title_style()).vertically_centered(),
- complete_draw,
);
show(&mut frame, complete_draw);
}
@@ -122,7 +121,6 @@ impl UIBolt {
Icon::new(CHECK40),
"Firmware installed\nsuccessfully".into(),
Label::centered(msg.into(), RESULT_INITIAL.title_style()).vertically_centered(),
- complete_draw,
);
show(&mut frame, complete_draw);
}
@@ -177,7 +175,6 @@ impl BootloaderUI for UIBolt {
"Firmware installation was not successful".into(),
Label::centered(RECONNECT_MESSAGE.into(), RESULT_FW_INSTALL.title_style())
.vertically_centered(),
- true,
);
show(&mut frame, true);
}
@@ -340,7 +337,6 @@ impl BootloaderUI for UIBolt {
"Trezor reset\nsuccessfully".into(),
Label::centered(RECONNECT_MESSAGE.into(), RESULT_WIPE.title_style())
.vertically_centered(),
- true,
);
run(&mut frame, true, false);
}
@@ -352,7 +348,6 @@ impl BootloaderUI for UIBolt {
"Trezor reset was\nnot successful".into(),
Label::centered(RECONNECT_MESSAGE.into(), RESULT_WIPE.title_style())
.vertically_centered(),
- true,
);
show(&mut frame, true);
}
### core/embed/rust/src/ui/layout_bolt/bootloader/pairing_finalization.rs
@@ -29,16 +29,13 @@ impl PairingFinalization {
where
T: Into<TString<'static>>,
{
- let mut instance = Self {
+ Self {
fg,
bg: Pad::with_background(bg),
message: message.into(),
font,
button,
- };
-
- instance.bg.clear();
- instance
+ }
}
}
### core/embed/rust/src/ui/layout_bolt/bootloader/welcome.rs
@@ -29,7 +29,7 @@ pub struct Welcome {
impl Welcome {
pub fn new() -> Self {
Self {
- bg: Pad::with_background(WELCOME_COLOR).with_clear(),
+ bg: Pad::with_background(WELCOME_COLOR),
menu: Button::with_icon(Icon::new(MENU32))
.styled(button_initial())
.with_expanded_touch_area(Insets::uniform(13)),
### core/embed/rust/src/ui/layout_bolt/component/bl_confirm.rs
@@ -63,7 +63,7 @@ impl<'a> Confirm<'a> {
message: Label<'a>,
) -> Self {
Self {
- bg: Pad::with_background(bg_color).with_clear(),
+ bg: Pad::with_background(bg_color),
content_pad: Pad::with_background(bg_color),
bg_color,
title,
@@ -173,7 +173,6 @@ impl Component for Confirm<'_> {
if self.show_info {
if let Some(Clicked) = info.close_button.event(ctx, event) {
self.show_info = false;
- self.content_pad.clear();
self.message.request_complete_repaint(ctx);
self.alert.request_complete_repaint(ctx);
return None;
@@ -182,7 +181,6 @@ impl Component for Confirm<'_> {
self.show_info = true;
info.text.request_complete_repaint(ctx);
info.title.request_complete_repaint(ctx);
- self.content_pad.clear();
return None;
}
}
### core/embed/rust/src/ui/layout_bolt/component/confirm_pairing.rs
@@ -48,7 +48,7 @@ impl<'a> ConfirmPairing<'a> {
code: u32,
) -> Self {
Self {
- bg: Pad::with_background(bg_color).with_clear(),
+ bg: Pad::with_background(bg_color),
content_pad: Pad::with_background(bg_color),
bg_color,
title,
### core/embed/rust/src/ui/layout_bolt/component/error.rs
@@ -36,7 +36,7 @@ impl<'a> ErrorScreen<'a> {
);
Self {
- bg: Pad::with_background(FATAL_ERROR_COLOR).with_clear(),
+ bg: Pad::with_background(FATAL_ERROR_COLOR),
title: Child::new(title),
message: Child::new(message),
footer: Child::new(footer),
### core/embed/rust/src/ui/layout_bolt/component/homescreen.rs
@@ -136,7 +136,6 @@ impl Homescreen {
}
}
Event::Timer(_) if self.delay.expire(event) => {
- self.pad.clear();
self.paint_notification_only = false;
self.loader.start_growing(ctx, Instant::now());
}
@@ -149,7 +148,6 @@ impl Homescreen {
}
Some(LoaderMsg::ShrunkCompletely) => {
self.loader.reset();
- self.pad.clear();
self.paint_notification_only = false;
ctx.request_paint()
}
### core/embed/rust/src/ui/layout_bolt/component/keyboard/passphrase.rs
@@ -572,13 +572,11 @@ impl Component for Input {
self.last_char_timer.stop();
self.display_style = DisplayStyle::Shown;
self.update_shown_area();
- self.pad.clear();
ctx.request_paint();
}
// Hide on touch end anywhere on the screen
Event::Touch(TouchEvent::TouchEnd(_)) if self.display_style == DisplayStyle::Shown => {
self.display_style = DisplayStyle::Hidden;
- self.pad.clear();
ctx.request_paint();
}
// Timeout for showing the last char
### core/embed/rust/src/ui/layout_bolt/component/keyboard/pin.rs
@@ -112,7 +112,6 @@ impl PinKeyboard {
let is_full = self.textbox.inner().is_full();
let is_empty = self.textbox.inner().is_empty();
- self.textbox_pad.clear();
self.textbox.request_complete_repaint(ctx);
if is_empty {
@@ -275,7 +274,6 @@ impl Component for PinKeyboard {
Event::Timer(_) if self.warning_timer.expire(event) => {
self.major_warning = None;
self.restart_prompts(ctx);
- self.textbox_pad.clear();
self.minor_prompt.request_complete_repaint(ctx);
ctx.request_paint();
}
@@ -521,15 +519,13 @@ impl Component for PinInput {
self.last_digit_timer.stop();
// Show the entire pin on the touch start
self.display_style = DisplayStyle::Shown;
- self.pad.clear();
ctx.request_paint();
None
}
Event::Touch(TouchEvent::TouchEnd(_)) => {
if mem::replace(&mut self.display_style, DisplayStyle::Hidden)
== DisplayStyle::Shown
{
- self.pad.clear();
ctx.request_paint();
};
None
### core/embed/rust/src/ui/layout_bolt/component/number_input.rs
@@ -53,7 +53,6 @@ where
p.update(text);
ctx.request_paint()
});
- self.paragraphs_pad.clear();
ctx.request_paint();
}
### core/embed/rust/src/ui/layout_bolt/component/page.rs
@@ -151,7 +151,6 @@ where
// clear the background under it.
self.content.change_page(self.scrollbar.pager().current());
self.content.request_complete_repaint(ctx);
- self.pad.clear();
// Swipe has dimmed the screen, so fade back to normal backlight after the next
// paint.
@@ -256,7 +255,6 @@ where
match button_msg {
Some(ButtonMsg::Pressed) => {
loader.start_growing(ctx, now);
- loader.pad.clear(); // Clear the remnants of the content.
}
Some(ButtonMsg::Released) => {
loader.start_shrinking(ctx, now);
### core/embed/rust/src/ui/layout_bolt/component/pairing_mode.rs
@@ -38,16 +38,13 @@ impl PairingMode {
bg: Color,
button: Button,
) -> Self {
- let mut instance = Self {
+ Self {
fg,
bg: Pad::with_background(bg),
message,
font,
button,
- };
-
- instance.bg.clear();
- instance
+ }
}
}
### core/embed/rust/src/ui/layout_bolt/component/progress.rs
@@ -74,7 +74,6 @@ impl Component for Progress {
if para.content() != &new_description {
para.update(new_description);
ctx.request_paint();
- self.description_pad.clear();
}
});
}
### core/embed/rust/src/ui/layout_bolt/component/result.rs
@@ -110,23 +110,15 @@ impl<'a> ResultScreen<'a> {
icon: Icon,
message: TString<'a>,
footer: Label<'a>,
- complete_draw: bool,
) -> Self {
- let mut instance = Self {
+ Self {
bg: Pad::with_background(style.bg_color),
footer_pad: Pad::with_background(style.bg_color),
style,
icon,
message: Child::new(Label::centered(message, style.message_style())),
footer: Child::new(ResultFooter::new(footer, style)),
- };
-
- if complete_draw {
- instance.bg.clear();
- } else {
- instance.footer_pad.clear();
}
- instance
}
}
### core/embed/rust/src/ui/layout_bolt/component/simple_page.rs
@@ -67,7 +67,6 @@ where
// clear the background under it.
self.content.change_page(self.scrollbar.pager().current());
self.content.request_complete_repaint(ctx);
- self.pad.clear();
// Swipe has dimmed the screen, so fade back to normal backlight after the next
// paint.
### core/embed/rust/src/ui/layout_bolt/prodtest/welcome.rs
@@ -29,7 +29,7 @@ impl Welcome {
};
Self {
- bg: Pad::with_background(WELCOME_COLOR).with_clear(),
+ bg: Pad::with_background(WELCOME_COLOR),
id,
id_text_pos: None,
qr,
### core/embed/rust/src/ui/layout_caesar/bootloader/buttons.rs
@@ -186,7 +186,7 @@ pub struct Buttons {
impl Buttons {
pub fn new(left: Option<Button>, middle: Option<Button>, right: Option<Button>) -> Self {
Self {
- pad: Pad::with_background(BLD_BG).with_clear(),
+ pad: Pad::with_background(BLD_BG),
left,
middle,
right,
@@ -198,7 +198,6 @@ impl Buttons {
self.left = left;
self.middle = middle;
self.right = right;
- self.pad.clear();
}
fn get(&self, pos: ButtonPos) -> Option<Button> {
### core/embed/rust/src/ui/layout_caesar/bootloader/confirm.rs
@@ -54,7 +54,7 @@ impl<'a> Confirm<'a> {
button_text: &'static str,
) -> Self {
let mut confirm = Self {
- bg: Pad::with_background(bg_color).with_clear(),
+ bg: Pad::with_background(bg_color),
title: Label::left_aligned(title, TEXT_BOLD),
message,
alert,
@@ -103,7 +103,6 @@ impl<'a> Confirm<'a> {
fn set_state(&mut self, ctx: &mut EventCtx, state: ConfirmState) {
self.state = state;
- self.bg.clear();
self.set_buttons();
self.request_complete_repaint(ctx);
}
### core/embed/rust/src/ui/layout_caesar/bootloader/connect.rs
@@ -26,16 +26,13 @@ impl Connect {
where
T: Into<TString<'static>>,
{
- let mut instance = Self {
+ Self {
fg,
bg: Pad::with_background(bg),
message: message.into(),
font,
buttons: Buttons::new(Some(Button::cancel()), None, None),
- };
-
- instance.bg.clear();
- instance
+ }
}
}
### core/embed/rust/src/ui/layout_caesar/bootloader/intro.rs
@@ -34,7 +34,7 @@ pub struct Intro<'a> {
impl<'a> Intro<'a> {
pub fn new(title: TString<'a>, content: TString<'a>, fw_ok: bool) -> Self {
Self {
- bg: Pad::with_background(BLD_BG).with_clear(),
+ bg: Pad::with_background(BLD_BG),
title: Child::new(Label::centered(title, TEXT_NORMAL).vertically_centered()),
buttons: Buttons::new(
Some(Button::menu()),
### core/embed/rust/src/ui/layout_caesar/bootloader/menu.rs
@@ -59,7 +59,7 @@ pub struct Menu<const N: usize> {
impl<const N: usize> Menu<N> {
pub fn new(items: [&'static str; N]) -> Self {
let mut menu = Self {
- pad: Pad::with_background(BLD_BG).with_clear(),
+ pad: Pad::with_background(BLD_BG),
items,
index: 0,
item_area: Rect::zero(),
@@ -82,7 +82,6 @@ impl<const N: usize> Menu<N> {
fn go_to(&mut self, ctx: &mut EventCtx, index: usize) {
self.index = index;
self.set_buttons();
- self.pad.clear();
ctx.request_paint();
}
### core/embed/rust/src/ui/layout_caesar/bootloader/mod.rs
@@ -107,7 +107,7 @@ impl BootloaderUI for UICaesar {
run(&mut frame, true, true)
}
- fn screen_install_success(restart_seconds: u8, _initial_setup: bool, complete_draw: bool) {
+ fn screen_install_success(restart_seconds: u8, _initial_setup: bool, _complete_draw: bool) {
let mut reboot_msg = BootloaderString::new();
if restart_seconds >= 1 {
@@ -124,8 +124,7 @@ impl BootloaderUI for UICaesar {
let content =
Label::centered(reboot_msg.as_str().into(), TEXT_NORMAL).vertically_centered();
- let mut frame =
- ResultScreen::new(BLD_FG, BLD_BG, ICON_SPINNER, title, content, complete_draw);
+ let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_SPINNER, title, content);
show(&mut frame, false);
}
@@ -135,7 +134,7 @@ impl BootloaderUI for UICaesar {
let content = Label::centered("Please reconnect\nthe device".into(), TEXT_NORMAL)
.vertically_centered();
- let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_ALERT, title, content, true);
+ let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_ALERT, title, content);
show(&mut frame, false);
}
@@ -215,7 +214,7 @@ impl BootloaderUI for UICaesar {
let content = Label::centered("Please reconnect the\ndevice".into(), TEXT_NORMAL)
.vertically_centered();
- let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_SPINNER, title, content, true);
+ let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_SPINNER, title, content);
run(&mut frame, true, false);
}
@@ -281,7 +280,7 @@ impl BootloaderUI for UICaesar {
let content = Label::centered("Please reconnect\nthe device".into(), TEXT_NORMAL)
.vertically_centered();
- let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_SPINNER, title, content, true);
+ let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_SPINNER, title, content);
run(&mut frame, true, false);
}
@@ -292,7 +291,7 @@ impl BootloaderUI for UICaesar {
let content = Label::centered("Please reconnect\nthe device".into(), TEXT_NORMAL)
.vertically_centered();
- let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_ALERT, title, content, true);
+ let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_ALERT, title, content);
show(&mut frame, false);
}
### core/embed/rust/src/ui/layout_caesar/bootloader/result.rs
@@ -28,24 +28,16 @@ impl<'a> ResultScreen<'a> {
icon: Icon,
title: Label<'static>,
content: Label<'a>,
- complete_draw: bool,
) -> Self {
- let mut instance = Self {
+ Self {
bg: Pad::with_background(bg_color),
small_pad: Pad::with_background(bg_color),
fg_color,
bg_color,
icon,
message_top: Child::new(title),
message_bottom: Child::new(content),
- };
-
- if complete_draw {
- instance.bg.clear();
- } else {
- instance.small_pad.clear();
}
- instance
}
}
### core/embed/rust/src/ui/layout_caesar/bootloader/welcome.rs
@@ -12,7 +12,7 @@ pub struct Welcome {
impl Welcome {
pub fn new() -> Self {
Self {
- bg: Pad::with_background(BLD_BG).with_clear(),
+ bg: Pad::with_background(BLD_BG),
}
}
}
### core/embed/rust/src/ui/layout_caesar/component/address_details.rs
@@ -22,7 +22,7 @@ impl AddressDetails {
.with_border(QR_BORDER);
Ok(Self {
qr_code,
- pad: Pad::with_background(theme::BG).with_clear(),
+ pad: Pad::with_background(theme::BG),
buttons: Child::new(ButtonController::new(ButtonLayout::new(
Some(ButtonDetails::cancel_icon()),
None,
### core/embed/rust/src/ui/layout_caesar/component/button_controller.rs
@@ -284,7 +284,7 @@ impl ButtonController {
pub fn new(btn_layout: ButtonLayout) -> Self {
let handle_middle_button = btn_layout.btn_middle.is_some();
Self {
- pad: Pad::with_background(theme::BG).with_clear(),
+ pad: Pad::with_background(theme::BG),
left_btn: ButtonContainer::new(ButtonPos::Left, btn_layout.btn_left),
middle_btn: ButtonContainer::new(ButtonPos::Middle, btn_layout.btn_middle),
right_btn: ButtonContainer::new(ButtonPos::Right, btn_layout.btn_right),
@@ -305,7 +305,6 @@ impl ButtonController {
/// Updating all the three buttons to the wanted states.
pub fn set(&mut self, btn_layout: ButtonLayout) {
self.handle_middle_button = btn_layout.btn_middle.is_some();
- self.pad.clear();
self.left_btn.set(btn_layout.btn_left, self.button_area);
self.middle_btn.set(btn_layout.btn_middle, self.button_area);
self.right_btn.set(btn_layout.btn_right, self.button_area);
### core/embed/rust/src/ui/layout_caesar/component/error.rs
@@ -25,7 +25,7 @@ impl<'a> ErrorScreen<'a> {
let footer = Label::centered(footer, theme::TEXT_NORMAL_UPPER).vertically_centered();
Self {
- bg: Pad::with_background(BG).with_clear(),
+ bg: Pad::with_background(BG),
show_icons: true,
title: Child::new(title),
message: Child::new(message),
### core/embed/rust/src/ui/layout_caesar/component/flow.rs
@@ -109,7 +109,6 @@ where
/// Clearing the whole area and requesting repaint.
fn clear_and_repaint(&mut self, ctx: &mut EventCtx) {
- self.pad.clear();
ctx.request_paint();
}
### core/embed/rust/src/ui/layout_caesar/component/input_methods/choice.rs
@@ -263,7 +263,6 @@ where
/// Clearing the whole area and requesting repaint.
fn clear_and_repaint(&mut self, ctx: &mut EventCtx) {
- self.pad.clear();
ctx.request_paint();
}
### core/embed/rust/src/ui/layout_caesar/component/page.rs
@@ -55,7 +55,7 @@ where
pub fn new(content: T, background: Color) -> Self {
Self {
content: Child::new(content),
- pad: Pad::with_background(background).with_clear(),
+ pad: Pad::with_background(background),
cancel_btn_details: Some(ButtonDetails::cancel_icon()),
confirm_btn_details: Some(ButtonDetails::text(TR::buttons__confirm.into())),
middle_btn_details: None,
@@ -132,7 +132,6 @@ where
content.request_complete_repaint(ctx);
});
self.update_buttons(ctx);
- self.pad.clear();
}
/// Reflecting the current page in the buttons.
### core/embed/rust/src/ui/layout_caesar/component/progress.rs
@@ -131,7 +131,6 @@ impl Component for Progress {
if !new_description.is_empty() && para.content() != &new_description {
para.update(new_description);
ctx.request_paint();
- self.description_pad.clear();
}
});
} else {
### core/embed/rust/src/ui/layout_caesar/component/tutorial.rs
@@ -109,7 +109,6 @@ impl Tutorial {
}
// Buttons still held from the previous screen are not a single press
self.single_press = SinglePress::default();
- self.pad.clear();
ctx.request_paint();
}
### core/embed/rust/src/ui/layout_delizia/bootloader/connect.rs
@@ -29,18 +29,15 @@ impl Connect {
where
T: Into<TString<'static>>,
{
- let mut instance = Self {
+ Self {
fg,
bg: Pad::with_background(bg),
message: message.into(),
font,
button: Button::with_text("Cancel".into())
.styled(button_bld())
.with_text_align(Alignment::Center),
- };
-
- instance.bg.clear();
- instance
+ }
}
}
### core/embed/rust/src/ui/layout_delizia/bootloader/intro.rs
@@ -31,7 +31,7 @@ pub struct Intro<'a> {
impl<'a> Intro<'a> {
pub fn new(title: TString<'a>, content: TString<'a>, fw_ok: bool) -> Self {
Self {
- bg: Pad::with_background(BLD_BG).with_clear(),
+ bg: Pad::with_background(BLD_BG),
title: Child::new(Label::left_aligned(title, text_title(BLD_BG)).vertically_centered()),
menu: Child::new(
Button::with_icon(Icon::new(MENU32))
### core/embed/rust/src/ui/layout_delizia/bootloader/menu.rs
@@ -34,7 +34,7 @@ impl Menu {
let content_reboot = IconText::new("REBOOT TREZOR", Icon::new(REFRESH24));
let content_reset = IconText::new("FACTORY RESET", Icon::new(FIRE24));
- let mut instance = Self {
+ Self {
bg: Pad::with_background(BLD_BG),
title: Child::new(
Label::left_aligned("BOOTLOADER".into(), text_title(BLD_BG)).vertically_centered(),
@@ -46,9 +46,7 @@ impl Menu {
),
reboot: Child::new(Button::with_icon_and_text(content_reboot).styled(button_bld())),
reset: Child::new(Button::with_icon_and_text(content_reset).styled(button_bld())),
- };
- instance.bg.clear();
- instance
+ }
}
}
### core/embed/rust/src/ui/layout_delizia/bootloader/mod.rs
@@ -185,7 +185,6 @@ impl BootloaderUI for UIDelizia {
"Firmware installation was not successful".into(),
Label::centered(RECONNECT_MESSAGE.into(), RESULT_FW_INSTALL.title_style())
.vertically_centered(),
- true,
);
show(&mut frame, true);
}
@@ -304,7 +303,6 @@ impl BootloaderUI for UIDelizia {
"Bootloader unlocked".into(),
Label::centered(RECONNECT_MESSAGE.into(), RESULT_FW_INSTALL.title_style())
.vertically_centered(),
- true,
);
run(&mut frame, true, false);
}
@@ -379,7 +377,6 @@ impl BootloaderUI for UIDelizia {
"Trezor reset\nsuccessfully".into(),
Label::centered(RECONNECT_MESSAGE.into(), RESULT_WIPE.title_style())
.vertically_centered(),
- true,
);
run(&mut frame, true, false);
}
@@ -391,7 +388,6 @@ impl BootloaderUI for UIDelizia {
"Trezor reset was\nnot successful".into(),
Label::centered(RECONNECT_MESSAGE.into(), RESULT_WIPE.title_style())
.vertically_centered(),
- true,
);
show(&mut frame, true);
}
### core/embed/rust/src/ui/layout_delizia/bootloader/welcome.rs
@@ -15,7 +15,7 @@ pub struct Welcome {
impl Welcome {
pub fn new() -> Self {
Self {
- bg: Pad::with_background(BLACK).with_clear(),
+ bg: Pad::with_background(BLACK),
}
}
}
### core/embed/rust/src/ui/layout_delizia/component/bl_confirm.rs
@@ -62,7 +62,7 @@ impl<'a> Confirm<'a> {
message: Label<'a>,
) -> Self {
Self {
- bg: Pad::with_background(bg_color).with_clear(),
+ bg: Pad::with_background(bg_color),
content_pad: Pad::with_background(bg_color),
bg_color,
title,
@@ -172,7 +172,6 @@ impl Component for Confirm<'_> {
if self.show_info {
if let Some(Clicked) = info.close_button.event(ctx, event) {
self.show_info = false;
- self.content_pad.clear();
self.message.request_complete_repaint(ctx);
self.alert.request_complete_repaint(ctx);
return None;
@@ -181,7 +180,6 @@ impl Component for Confirm<'_> {
self.show_info = true;
info.text.request_complete_repaint(ctx);
info.title.request_complete_repaint(ctx);
- self.content_pad.clear();
return None;
}
}
### core/embed/rust/src/ui/layout_delizia/component/error.rs
@@ -34,7 +34,7 @@ impl<'a> ErrorScreen<'a> {
);
Self {
- bg: Pad::with_background(FATAL_ERROR_COLOR).with_clear(),
+ bg: Pad::with_background(FATAL_ERROR_COLOR),
title,
message,
footer,
### core/embed/rust/src/ui/layout_delizia/component/keyboard/passphrase.rs
@@ -726,13 +726,11 @@ impl Component for Input {
self.last_char_timer.stop();
self.display_style = DisplayStyle::Shown;
self.update_shown_area();
- self.pad.clear();
ctx.request_paint();
}
// Hide on touch end anywhere on the screen
Event::Touch(TouchEvent::TouchEnd(_)) if self.display_style == DisplayStyle::Shown => {
self.display_style = DisplayStyle::Hidden;
- self.pad.clear();
ctx.request_paint();
}
// Timeout for showing the last char
### core/embed/rust/src/ui/layout_delizia/component/keyboard/pin.rs
@@ -766,15 +766,13 @@ impl Component for PinDots {
// Stop the last char timer
self.last_digit_timer.stop();
self.display_style = DisplayStyle::Shown;
- self.pad.clear();
ctx.request_paint();
None
}
Event::Touch(TouchEvent::TouchEnd(_)) => {
if mem::replace(&mut self.display_style, DisplayStyle::Hidden)
== DisplayStyle::Shown
{
- self.pad.clear();
ctx.request_paint();
};
None
### core/embed/rust/src/ui/layout_delizia/component/progress.rs
@@ -82,7 +82,6 @@ impl Component for Progress {
if self.description.content() != &new_description {
self.description.update(new_description);
ctx.request_paint();
- self.description_pad.clear();
}
}
}
### core/embed/rust/src/ui/layout_delizia/component/result.rs
@@ -109,23 +109,15 @@ impl<'a> ResultScreen<'a> {
icon: Icon,
message: TString<'a>,
footer: Label<'a>,
- complete_draw: bool,
) -> Self {
- let mut instance = Self {
+ Self {
bg: Pad::with_background(style.bg_color),
footer_pad: Pad::with_background(style.bg_color),
style,
icon,
message: Label::centered(message, style.message_style()),
footer: ResultFooter::new(footer, style),
- };
-
- if complete_draw {
- instance.bg.clear();
- } else {
- instance.footer_pad.clear();
}
- instance
}
}
Why this scored 13/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.