From e19138cdc87fba19d87b611ccd60a3ed588b27c0 Mon Sep 17 00:00:00 2001 From: obrusvit Date: Wed, 21 Aug 2024 12:04:28 +0200 Subject: [PATCH] chore(core): remove unused mercury ButtonContent [no changelog] --- .../src/ui/model_mercury/component/button.rs | 66 +++++-------------- .../component/keyboard/passphrase.rs | 1 - 2 files changed, 15 insertions(+), 52 deletions(-) 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 7f0a7446d4..1cf6c53a2f 100644 --- a/core/embed/rust/src/ui/model_mercury/component/button.rs +++ b/core/embed/rust/src/ui/model_mercury/component/button.rs @@ -71,10 +71,6 @@ impl Button { Self::new(ButtonContent::IconAndText(content)) } - pub const fn with_icon_blend(bg: Icon, fg: Icon, fg_offset: Offset) -> Self { - Self::new(ButtonContent::IconBlend(bg, fg, fg_offset)) - } - pub const fn empty() -> Self { Self::new(ButtonContent::Empty) } @@ -181,12 +177,7 @@ impl Button { } pub fn paint_background(&self, style: &ButtonStyle) { - match &self.content { - ButtonContent::IconBlend(_, _, _) => {} - _ => { - display::rect_fill(self.area, style.button_color); - } - } + display::rect_fill(self.area, style.button_color); } pub fn render_background<'s>( @@ -195,25 +186,20 @@ impl Button { style: &ButtonStyle, alpha: u8, ) { - match &self.content { - ButtonContent::IconBlend(_, _, _) => {} - _ => { - if self.radius.is_some() { - shape::Bar::new(self.area) - .with_bg(style.background_color) - .with_radius(self.radius.unwrap() as i16) - .with_thickness(2) - .with_fg(style.button_color) - .with_alpha(alpha) - .render(target); - } else { - shape::Bar::new(self.area) - .with_bg(style.button_color) - .with_fg(style.button_color) - .with_alpha(alpha) - .render(target); - } - } + if self.radius.is_some() { + shape::Bar::new(self.area) + .with_bg(style.background_color) + .with_radius(self.radius.unwrap() as i16) + .with_thickness(2) + .with_fg(style.button_color) + .with_alpha(alpha) + .render(target); + } else { + shape::Bar::new(self.area) + .with_bg(style.button_color) + .with_fg(style.button_color) + .with_alpha(alpha) + .render(target); } } @@ -243,12 +229,6 @@ impl Button { ButtonContent::IconAndText(child) => { child.paint(self.area, self.style(), Self::BASELINE_OFFSET); } - ButtonContent::IconBlend(bg, fg, offset) => display::icon_over_icon( - Some(self.area), - (*bg, Offset::zero(), style.button_color), - (*fg, *offset, style.text_color), - style.background_color, - ), } } @@ -294,20 +274,6 @@ impl Button { alpha, ); } - ButtonContent::IconBlend(bg, fg, offset) => { - shape::Bar::new(self.area) - .with_bg(style.background_color) - .with_alpha(alpha) - .render(target); - shape::ToifImage::new(self.area.top_left(), bg.toif) - .with_fg(style.button_color) - .with_alpha(alpha) - .render(target); - shape::ToifImage::new(self.area.top_left() + *offset, fg.toif) - .with_fg(style.icon_color) - .with_alpha(alpha) - .render(target); - } } } @@ -452,7 +418,6 @@ impl crate::trace::Trace for Button { t.string("text", content.text); t.bool("icon", true); } - ButtonContent::IconBlend(_, _, _) => t.bool("icon", true), } } } @@ -471,7 +436,6 @@ pub enum ButtonContent { Text(TString<'static>), Icon(Icon), IconAndText(IconText), - IconBlend(Icon, Icon, Offset), } #[derive(PartialEq, Eq, Clone, Copy)] 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 94aad186bb..7cea508859 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 @@ -169,7 +169,6 @@ impl PassphraseKeyboard { ButtonContent::Icon(_) => " ".into(), ButtonContent::IconAndText(_) => " ".into(), ButtonContent::Empty => "".into(), - ButtonContent::IconBlend(_, _, _) => "".into(), } }