Skip to content

Commit

Permalink
WIP - integration - canvas folder moved
Browse files Browse the repository at this point in the history
  • Loading branch information
cepetr committed Mar 27, 2024
1 parent 1be00d5 commit 534e24c
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 24 deletions.
6 changes: 4 additions & 2 deletions core/embed/rust/src/ui/component/jpeg.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use crate::error::Error;
use crate::micropython::{buffer::get_buffer, obj::Obj};
use crate::{
error::Error,
micropython::{buffer::get_buffer, obj::Obj},
};

use crate::ui::{
component::{Component, Event, EventCtx, Never},
Expand Down
3 changes: 1 addition & 2 deletions core/embed/rust/src/ui/model_tr/cshape/dotted_line.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::ui::{
canvas::Canvas,
display::Color,
geometry::{Offset, Point, Rect},
shape::{DrawingCache, Renderer, Shape, ShapeClone},
shape::{Canvas, DrawingCache, Renderer, Shape, ShapeClone},
};

use without_alloc::alloc::LocalAllocLeakExt;
Expand Down
3 changes: 1 addition & 2 deletions core/embed/rust/src/ui/model_tr/cshape/loader_circular.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::ui::{
canvas::Canvas,
display::Color,
geometry::{Offset, Point, Rect},
shape::{DrawingCache, Renderer, Shape, ShapeClone},
shape::{Canvas, DrawingCache, Renderer, Shape, ShapeClone},
};

use without_alloc::alloc::LocalAllocLeakExt;
Expand Down
3 changes: 1 addition & 2 deletions core/embed/rust/src/ui/model_tr/cshape/loader_small.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::ui::{
canvas::Canvas,
display::Color,
geometry::{Offset, Point, Rect},
shape::{DrawingCache, Renderer, Shape, ShapeClone},
shape::{Canvas, DrawingCache, Renderer, Shape, ShapeClone},
};

use without_alloc::alloc::LocalAllocLeakExt;
Expand Down
3 changes: 1 addition & 2 deletions core/embed/rust/src/ui/model_tr/cshape/loader_starry.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::ui::{
canvas::Canvas,
display::Color,
geometry::{Offset, Point, Rect},
shape::{DrawingCache, Renderer, Shape, ShapeClone},
shape::{Canvas, DrawingCache, Renderer, Shape, ShapeClone},
};

use without_alloc::alloc::LocalAllocLeakExt;
Expand Down
4 changes: 1 addition & 3 deletions core/embed/rust/src/ui/model_tr/screens.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#[cfg(feature = "micropython")]
use crate::micropython::buffer::StrBuffer;
use crate::ui::{
component::base::Component, constant::screen, model_tr::component::WelcomeScreen,
};
use crate::ui::{component::base::Component, constant::screen, model_tr::component::WelcomeScreen};

#[cfg(not(feature = "new_rendering"))]
use crate::ui::display;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::{
micropython::buffer::StrBuffer,
translations::TR,
ui::{
canvas::algo::PI4,
component::{
base::Never, Bar, Child, Component, ComponentExt, Empty, Event, EventCtx, Label, Split,
},
Expand Down Expand Up @@ -143,8 +142,8 @@ where

let start = (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 end = ((end 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 * shape::PI4 as i32) / 1000) as i16;

shape::Circle::new(center, LOADER_OUTER)
.with_bg(inactive_color)
Expand Down
3 changes: 1 addition & 2 deletions core/embed/rust/src/ui/model_tt/component/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::{
time::{Duration, Instant},
ui::{
animation::Animation,
canvas::algo::PI4,
component::{Component, Event, EventCtx, Pad},
display::{self, toif::Icon, Color},
geometry::{Alignment2D, Offset, Rect},
Expand Down Expand Up @@ -236,7 +235,7 @@ impl Component for Loader {

shape::Circle::new(center, constant::LOADER_OUTER)
.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);

shape::Circle::new(center, constant::LOADER_INNER + 2)
Expand Down
7 changes: 3 additions & 4 deletions core/embed/rust/src/ui/model_tt/component/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::{
error::Error,
strutil::StringType,
ui::{
canvas::algo::PI4,
component::{
base::ComponentExt,
paginated::Paginate,
Expand Down Expand Up @@ -134,11 +133,11 @@ where
let (start, end) = if self.indeterminate {
let start = (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 end = ((end 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 * shape::PI4 as i32) / 1000) as i16;
(start, end)
} 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)
};

Expand Down
5 changes: 4 additions & 1 deletion core/embed/rust/src/ui/model_tt/component/welcome_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ use crate::ui::{
shape::Renderer,
};
#[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 ICON_TOP_MARGIN: i16 = 48;
Expand Down
1 change: 0 additions & 1 deletion core/embed/rust/src/ui/model_tt/screens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use crate::ui::display;
#[cfg(feature = "new_rendering")]
use crate::ui::{display::Color, shape::render_on_display};


#[cfg(not(feature = "micropython"))]
// SAFETY: Actually safe but see below
unsafe fn get_str(text: &str) -> &str {
Expand Down

0 comments on commit 534e24c

Please sign in to comment.