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

chore(core): remove unused mercury ButtonContent

[no changelog]
This commit is contained in:
obrusvit 2024-08-21 12:04:28 +02:00 committed by Vít Obrusník
parent 9b7ce3c84f
commit e19138cdc8
2 changed files with 15 additions and 52 deletions

View File

@ -71,10 +71,6 @@ impl Button {
Self::new(ButtonContent::IconAndText(content)) 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 { pub const fn empty() -> Self {
Self::new(ButtonContent::Empty) Self::new(ButtonContent::Empty)
} }
@ -181,12 +177,7 @@ impl Button {
} }
pub fn paint_background(&self, style: &ButtonStyle) { pub fn paint_background(&self, style: &ButtonStyle) {
match &self.content { display::rect_fill(self.area, style.button_color);
ButtonContent::IconBlend(_, _, _) => {}
_ => {
display::rect_fill(self.area, style.button_color);
}
}
} }
pub fn render_background<'s>( pub fn render_background<'s>(
@ -195,25 +186,20 @@ impl Button {
style: &ButtonStyle, style: &ButtonStyle,
alpha: u8, alpha: u8,
) { ) {
match &self.content { if self.radius.is_some() {
ButtonContent::IconBlend(_, _, _) => {} shape::Bar::new(self.area)
_ => { .with_bg(style.background_color)
if self.radius.is_some() { .with_radius(self.radius.unwrap() as i16)
shape::Bar::new(self.area) .with_thickness(2)
.with_bg(style.background_color) .with_fg(style.button_color)
.with_radius(self.radius.unwrap() as i16) .with_alpha(alpha)
.with_thickness(2) .render(target);
.with_fg(style.button_color) } else {
.with_alpha(alpha) shape::Bar::new(self.area)
.render(target); .with_bg(style.button_color)
} else { .with_fg(style.button_color)
shape::Bar::new(self.area) .with_alpha(alpha)
.with_bg(style.button_color) .render(target);
.with_fg(style.button_color)
.with_alpha(alpha)
.render(target);
}
}
} }
} }
@ -243,12 +229,6 @@ impl Button {
ButtonContent::IconAndText(child) => { ButtonContent::IconAndText(child) => {
child.paint(self.area, self.style(), Self::BASELINE_OFFSET); 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, 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.string("text", content.text);
t.bool("icon", true); t.bool("icon", true);
} }
ButtonContent::IconBlend(_, _, _) => t.bool("icon", true),
} }
} }
} }
@ -471,7 +436,6 @@ pub enum ButtonContent {
Text(TString<'static>), Text(TString<'static>),
Icon(Icon), Icon(Icon),
IconAndText(IconText), IconAndText(IconText),
IconBlend(Icon, Icon, Offset),
} }
#[derive(PartialEq, Eq, Clone, Copy)] #[derive(PartialEq, Eq, Clone, Copy)]

View File

@ -169,7 +169,6 @@ impl PassphraseKeyboard {
ButtonContent::Icon(_) => " ".into(), ButtonContent::Icon(_) => " ".into(),
ButtonContent::IconAndText(_) => " ".into(), ButtonContent::IconAndText(_) => " ".into(),
ButtonContent::Empty => "".into(), ButtonContent::Empty => "".into(),
ButtonContent::IconBlend(_, _, _) => "".into(),
} }
} }