mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-15 20:19:23 +00:00
fixup! feat(core): integration of background image into homescreen
This commit is contained in:
parent
945668221b
commit
d21c44d73f
@ -14,8 +14,12 @@ use crate::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use render::{homescreen, homescreen_blurred, HomescreenNotification, HomescreenText};
|
use render::{
|
||||||
|
homescreen, homescreen_blurred, HomescreenNotification, HomescreenText, HOMESCREEN_IMAGE_SIZE,
|
||||||
|
HOMESCREEN_MAX_TEXTS,
|
||||||
|
};
|
||||||
|
|
||||||
|
use crate::{trezorhal::display::ToifFormat, ui::display::toif_info};
|
||||||
use heapless::Vec;
|
use heapless::Vec;
|
||||||
|
|
||||||
use super::{theme, Loader, LoaderMsg};
|
use super::{theme, Loader, LoaderMsg};
|
||||||
@ -184,12 +188,13 @@ where
|
|||||||
let mut label_style = theme::TEXT_BOLD;
|
let mut label_style = theme::TEXT_BOLD;
|
||||||
label_style.text_color = theme::FG;
|
label_style.text_color = theme::FG;
|
||||||
|
|
||||||
let texts: Vec<HomescreenText, 4> = unwrap!(Vec::from_slice(&[HomescreenText {
|
let texts: Vec<HomescreenText, HOMESCREEN_MAX_TEXTS> =
|
||||||
text: self.label.as_ref(),
|
unwrap!(Vec::from_slice(&[HomescreenText {
|
||||||
style: label_style,
|
text: self.label.as_ref(),
|
||||||
offset: Offset::new(10, LABEL_Y),
|
style: label_style,
|
||||||
icon: None
|
offset: Offset::new(10, LABEL_Y),
|
||||||
}],));
|
icon: None
|
||||||
|
}],));
|
||||||
|
|
||||||
let notification = self.get_notification();
|
let notification = self.get_notification();
|
||||||
|
|
||||||
@ -268,7 +273,7 @@ where
|
|||||||
let mut label_style = theme::TEXT_BOLD;
|
let mut label_style = theme::TEXT_BOLD;
|
||||||
label_style.text_color = theme::GREY_MEDIUM;
|
label_style.text_color = theme::GREY_MEDIUM;
|
||||||
|
|
||||||
let texts: Vec<HomescreenText, 4> = unwrap!(Vec::from_slice(&[
|
let texts: Vec<HomescreenText, HOMESCREEN_MAX_TEXTS> = unwrap!(Vec::from_slice(&[
|
||||||
HomescreenText {
|
HomescreenText {
|
||||||
text: locked,
|
text: locked,
|
||||||
style: theme::TEXT_BOLD,
|
style: theme::TEXT_BOLD,
|
||||||
@ -303,10 +308,18 @@ fn get_image() -> Result<Gc<[u8]>, ()> {
|
|||||||
let result = Gc::<[u8]>::new_slice(len);
|
let result = Gc::<[u8]>::new_slice(len);
|
||||||
if let Ok(mut buffer) = result {
|
if let Ok(mut buffer) = result {
|
||||||
if get_avatar(buffer.as_mut()).is_ok() {
|
if get_avatar(buffer.as_mut()).is_ok() {
|
||||||
return Ok(buffer);
|
let toif = toif_info(buffer.as_ref());
|
||||||
|
if let Some((size, format)) = toif {
|
||||||
|
if size.x == HOMESCREEN_IMAGE_SIZE
|
||||||
|
&& size.y == HOMESCREEN_IMAGE_SIZE
|
||||||
|
&& format == ToifFormat::FullColorLE
|
||||||
|
{
|
||||||
|
return Ok(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
Err(())
|
Err(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user