1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 15:38:11 +00:00

perf(core/ui): save flash by forbidding some inlining

[no changelog]
This commit is contained in:
Martin Milata 2024-06-04 16:48:57 +02:00 committed by matejcik
parent d1cf36097a
commit 9cd933b88e
3 changed files with 18 additions and 10 deletions

View File

@ -131,6 +131,7 @@ struct LayoutObjInner {
impl LayoutObj {
/// Create a new `LayoutObj`, wrapping a root component.
#[inline(never)]
pub fn new(root: impl ComponentMsgObj + MaybeTrace + 'static) -> Result<Gc<Self>, Error> {
// Let's wrap the root component into a `Root` to maintain the top-level
// invalidation logic.

View File

@ -68,14 +68,17 @@ where
}
}
#[inline(never)]
pub const fn left_aligned(title: TString<'static>, content: T) -> Self {
Self::new(Alignment::Start, title, content)
}
#[inline(never)]
pub const fn right_aligned(title: TString<'static>, content: T) -> Self {
Self::new(Alignment::End, title, content)
}
#[inline(never)]
pub const fn centered(title: TString<'static>, content: T) -> Self {
Self::new(Alignment::Center, title, content)
}
@ -90,6 +93,7 @@ where
self
}
#[inline(never)]
pub fn with_subtitle(mut self, subtitle: TString<'static>) -> Self {
let style = theme::TEXT_SUB_GREY;
self.title = Child::new(self.title.into_inner().top_aligned());
@ -173,16 +177,14 @@ where
})
}
pub fn with_swipe(self, dir: SwipeDirection, settings: SwipeSettings) -> Self {
Self {
footer: self.footer.map(|f| match dir {
SwipeDirection::Up => f.with_swipe_up(),
SwipeDirection::Down => f.with_swipe_down(),
_ => f,
}),
swipe: self.swipe.with_swipe(dir, settings),
..self
}
pub fn with_swipe(mut self, dir: SwipeDirection, settings: SwipeSettings) -> Self {
self.footer = self.footer.map(|f| match dir {
SwipeDirection::Up => f.with_swipe_up(),
SwipeDirection::Down => f.with_swipe_down(),
_ => f,
});
self.swipe = self.swipe.with_swipe(dir, settings);
self
}
pub fn with_horizontal_pages(self) -> Self {

View File

@ -175,21 +175,25 @@ impl ShowInfoParams {
}
}
#[inline(never)]
pub const fn with_subtitle(mut self, subtitle: Option<TString<'static>>) -> Self {
self.subtitle = subtitle;
self
}
#[inline(never)]
pub const fn with_menu_button(mut self) -> Self {
self.menu_button = true;
self
}
#[inline(never)]
pub const fn with_cancel_button(mut self) -> Self {
self.cancel_button = true;
self
}
#[inline(never)]
pub const fn with_footer(
mut self,
instruction: TString<'static>,
@ -210,6 +214,7 @@ impl ShowInfoParams {
self
}
#[inline(never)]
pub fn into_layout(
self,
) -> Result<impl Component<Msg = FlowMsg> + Swipable + MaybeTrace, Error> {