mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-01 20:32:35 +00:00
WIP - integration - canvas folder moved
This commit is contained in:
parent
1be00d543c
commit
534e24c34d
@ -1,5 +1,7 @@
|
|||||||
use crate::error::Error;
|
use crate::{
|
||||||
use crate::micropython::{buffer::get_buffer, obj::Obj};
|
error::Error,
|
||||||
|
micropython::{buffer::get_buffer, obj::Obj},
|
||||||
|
};
|
||||||
|
|
||||||
use crate::ui::{
|
use crate::ui::{
|
||||||
component::{Component, Event, EventCtx, Never},
|
component::{Component, Event, EventCtx, Never},
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
use crate::ui::{
|
use crate::ui::{
|
||||||
canvas::Canvas,
|
|
||||||
display::Color,
|
display::Color,
|
||||||
geometry::{Offset, Point, Rect},
|
geometry::{Offset, Point, Rect},
|
||||||
shape::{DrawingCache, Renderer, Shape, ShapeClone},
|
shape::{Canvas, DrawingCache, Renderer, Shape, ShapeClone},
|
||||||
};
|
};
|
||||||
|
|
||||||
use without_alloc::alloc::LocalAllocLeakExt;
|
use without_alloc::alloc::LocalAllocLeakExt;
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
use crate::ui::{
|
use crate::ui::{
|
||||||
canvas::Canvas,
|
|
||||||
display::Color,
|
display::Color,
|
||||||
geometry::{Offset, Point, Rect},
|
geometry::{Offset, Point, Rect},
|
||||||
shape::{DrawingCache, Renderer, Shape, ShapeClone},
|
shape::{Canvas, DrawingCache, Renderer, Shape, ShapeClone},
|
||||||
};
|
};
|
||||||
|
|
||||||
use without_alloc::alloc::LocalAllocLeakExt;
|
use without_alloc::alloc::LocalAllocLeakExt;
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
use crate::ui::{
|
use crate::ui::{
|
||||||
canvas::Canvas,
|
|
||||||
display::Color,
|
display::Color,
|
||||||
geometry::{Offset, Point, Rect},
|
geometry::{Offset, Point, Rect},
|
||||||
shape::{DrawingCache, Renderer, Shape, ShapeClone},
|
shape::{Canvas, DrawingCache, Renderer, Shape, ShapeClone},
|
||||||
};
|
};
|
||||||
|
|
||||||
use without_alloc::alloc::LocalAllocLeakExt;
|
use without_alloc::alloc::LocalAllocLeakExt;
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
use crate::ui::{
|
use crate::ui::{
|
||||||
canvas::Canvas,
|
|
||||||
display::Color,
|
display::Color,
|
||||||
geometry::{Offset, Point, Rect},
|
geometry::{Offset, Point, Rect},
|
||||||
shape::{DrawingCache, Renderer, Shape, ShapeClone},
|
shape::{Canvas, DrawingCache, Renderer, Shape, ShapeClone},
|
||||||
};
|
};
|
||||||
|
|
||||||
use without_alloc::alloc::LocalAllocLeakExt;
|
use without_alloc::alloc::LocalAllocLeakExt;
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#[cfg(feature = "micropython")]
|
#[cfg(feature = "micropython")]
|
||||||
use crate::micropython::buffer::StrBuffer;
|
use crate::micropython::buffer::StrBuffer;
|
||||||
use crate::ui::{
|
use crate::ui::{component::base::Component, constant::screen, model_tr::component::WelcomeScreen};
|
||||||
component::base::Component, constant::screen, model_tr::component::WelcomeScreen,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[cfg(not(feature = "new_rendering"))]
|
#[cfg(not(feature = "new_rendering"))]
|
||||||
use crate::ui::display;
|
use crate::ui::display;
|
||||||
|
@ -6,7 +6,6 @@ use crate::{
|
|||||||
micropython::buffer::StrBuffer,
|
micropython::buffer::StrBuffer,
|
||||||
translations::TR,
|
translations::TR,
|
||||||
ui::{
|
ui::{
|
||||||
canvas::algo::PI4,
|
|
||||||
component::{
|
component::{
|
||||||
base::Never, Bar, Child, Component, ComponentExt, Empty, Event, EventCtx, Label, Split,
|
base::Never, Bar, Child, Component, ComponentExt, Empty, Event, EventCtx, Label, Split,
|
||||||
},
|
},
|
||||||
@ -143,8 +142,8 @@ where
|
|||||||
|
|
||||||
let start = (self.value as i16 - 100) % 1000;
|
let start = (self.value as i16 - 100) % 1000;
|
||||||
let end = (self.value as i16 + 100) % 1000;
|
let end = (self.value as i16 + 100) % 1000;
|
||||||
let start = ((start as i32 * 8 * PI4 as i32) / 1000) as i16;
|
let start = ((start as i32 * 8 * shape::PI4 as i32) / 1000) as i16;
|
||||||
let end = ((end as i32 * 8 * PI4 as i32) / 1000) as i16;
|
let end = ((end as i32 * 8 * shape::PI4 as i32) / 1000) as i16;
|
||||||
|
|
||||||
shape::Circle::new(center, LOADER_OUTER)
|
shape::Circle::new(center, LOADER_OUTER)
|
||||||
.with_bg(inactive_color)
|
.with_bg(inactive_color)
|
||||||
|
@ -4,7 +4,6 @@ use crate::{
|
|||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
ui::{
|
ui::{
|
||||||
animation::Animation,
|
animation::Animation,
|
||||||
canvas::algo::PI4,
|
|
||||||
component::{Component, Event, EventCtx, Pad},
|
component::{Component, Event, EventCtx, Pad},
|
||||||
display::{self, toif::Icon, Color},
|
display::{self, toif::Icon, Color},
|
||||||
geometry::{Alignment2D, Offset, Rect},
|
geometry::{Alignment2D, Offset, Rect},
|
||||||
@ -236,7 +235,7 @@ impl Component for Loader {
|
|||||||
|
|
||||||
shape::Circle::new(center, constant::LOADER_OUTER)
|
shape::Circle::new(center, constant::LOADER_OUTER)
|
||||||
.with_bg(style.loader_color)
|
.with_bg(style.loader_color)
|
||||||
.with_end_angle(((progress as i32 * PI4 as i32 * 8) / 1000) as i16)
|
.with_end_angle(((progress as i32 * shape::PI4 as i32 * 8) / 1000) as i16)
|
||||||
.render(target);
|
.render(target);
|
||||||
|
|
||||||
shape::Circle::new(center, constant::LOADER_INNER + 2)
|
shape::Circle::new(center, constant::LOADER_INNER + 2)
|
||||||
|
@ -4,7 +4,6 @@ use crate::{
|
|||||||
error::Error,
|
error::Error,
|
||||||
strutil::StringType,
|
strutil::StringType,
|
||||||
ui::{
|
ui::{
|
||||||
canvas::algo::PI4,
|
|
||||||
component::{
|
component::{
|
||||||
base::ComponentExt,
|
base::ComponentExt,
|
||||||
paginated::Paginate,
|
paginated::Paginate,
|
||||||
@ -134,11 +133,11 @@ where
|
|||||||
let (start, end) = if self.indeterminate {
|
let (start, end) = if self.indeterminate {
|
||||||
let start = (self.value as i16 - 100) % 1000;
|
let start = (self.value as i16 - 100) % 1000;
|
||||||
let end = (self.value as i16 + 100) % 1000;
|
let end = (self.value as i16 + 100) % 1000;
|
||||||
let start = ((start as i32 * 8 * PI4 as i32) / 1000) as i16;
|
let start = ((start as i32 * 8 * shape::PI4 as i32) / 1000) as i16;
|
||||||
let end = ((end as i32 * 8 * PI4 as i32) / 1000) as i16;
|
let end = ((end as i32 * 8 * shape::PI4 as i32) / 1000) as i16;
|
||||||
(start, end)
|
(start, end)
|
||||||
} else {
|
} else {
|
||||||
let end = ((self.value as i32 * 8 * PI4 as i32) / 1000) as i16;
|
let end = ((self.value as i32 * 8 * shape::PI4 as i32) / 1000) as i16;
|
||||||
(0, end)
|
(0, end)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,7 +6,10 @@ use crate::ui::{
|
|||||||
shape::Renderer,
|
shape::Renderer,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "bootloader")]
|
#[cfg(feature = "bootloader")]
|
||||||
use crate::ui::{display::{Icon, toif::Toif}, model_tt::theme::bootloader::DEVICE_NAME};
|
use crate::ui::{
|
||||||
|
display::{toif::Toif, Icon},
|
||||||
|
model_tt::theme::bootloader::DEVICE_NAME,
|
||||||
|
};
|
||||||
|
|
||||||
const TEXT_BOTTOM_MARGIN: i16 = 24; // matching the homescreen label margin
|
const TEXT_BOTTOM_MARGIN: i16 = 24; // matching the homescreen label margin
|
||||||
const ICON_TOP_MARGIN: i16 = 48;
|
const ICON_TOP_MARGIN: i16 = 48;
|
||||||
|
@ -14,7 +14,6 @@ use crate::ui::display;
|
|||||||
#[cfg(feature = "new_rendering")]
|
#[cfg(feature = "new_rendering")]
|
||||||
use crate::ui::{display::Color, shape::render_on_display};
|
use crate::ui::{display::Color, shape::render_on_display};
|
||||||
|
|
||||||
|
|
||||||
#[cfg(not(feature = "micropython"))]
|
#[cfg(not(feature = "micropython"))]
|
||||||
// SAFETY: Actually safe but see below
|
// SAFETY: Actually safe but see below
|
||||||
unsafe fn get_str(text: &str) -> &str {
|
unsafe fn get_str(text: &str) -> &str {
|
||||||
|
Loading…
Reference in New Issue
Block a user