WIP - drawlib - canvas moved to shape

pull/3662/head
cepetr 2 months ago
parent 936ed18e48
commit 21ad1be4de

@ -1,9 +1,9 @@
use crate::{ use crate::{
trezorhal::display, trezorhal::display,
ui::{ ui::{
canvas::{Bitmap, BitmapFormat},
constant, constant,
geometry::{Offset, Point, Rect}, geometry::{Offset, Point, Rect},
shape::{Bitmap, BitmapFormat},
}, },
}; };
use core::slice; use core::slice;

@ -2,7 +2,6 @@
pub mod macros; pub mod macros;
pub mod animation; pub mod animation;
pub mod canvas;
pub mod component; pub mod component;
pub mod constant; pub mod constant;
pub mod display; pub mod display;

@ -1,6 +1,6 @@
use crate::ui::{canvas::Canvas, display::Color, geometry::Rect}; use crate::ui::{display::Color, geometry::Rect};
use super::{DrawingCache, Renderer, Shape, ShapeClone}; use super::{Canvas, DrawingCache, Renderer, Shape, ShapeClone};
use without_alloc::alloc::LocalAllocLeakExt; use without_alloc::alloc::LocalAllocLeakExt;

@ -1,6 +1,6 @@
use crate::ui::{canvas::Canvas, geometry::Rect}; use crate::ui::geometry::Rect;
use super::DrawingCache; use super::{Canvas, DrawingCache};
use without_alloc::alloc::LocalAllocLeakExt; use without_alloc::alloc::LocalAllocLeakExt;

@ -1,6 +1,6 @@
use crate::ui::{canvas::Canvas, geometry::Rect}; use crate::ui::geometry::Rect;
use super::{DrawingCache, Renderer, Shape, ShapeClone}; use super::{Canvas, DrawingCache, Renderer, Shape, ShapeClone};
use without_alloc::alloc::LocalAllocLeakExt; use without_alloc::alloc::LocalAllocLeakExt;

@ -1,7 +1,5 @@
use crate::ui::{ use super::super::algo::{BlurAlgorithm, BlurBuff};
canvas::algo::{BlurAlgorithm, BlurBuff}, use crate::ui::geometry::Offset;
geometry::Offset,
};
use core::cell::UnsafeCell; use core::cell::UnsafeCell;
use without_alloc::alloc::LocalAllocLeakExt; use without_alloc::alloc::LocalAllocLeakExt;

@ -1,7 +1,7 @@
use crate::ui::{ use crate::ui::{
canvas::{BasicCanvas, Bitmap, BitmapFormat, BitmapView, Canvas, Rgb565Canvas},
display::tjpgd, display::tjpgd,
geometry::{Offset, Point, Rect}, geometry::{Offset, Point, Rect},
shape::{BasicCanvas, Bitmap, BitmapFormat, BitmapView, Canvas, Rgb565Canvas},
}; };
use core::cell::UnsafeCell; use core::cell::UnsafeCell;

@ -8,7 +8,7 @@ use super::{BitmapView, Viewport};
#[cfg(feature = "ui_blurring")] #[cfg(feature = "ui_blurring")]
use crate::ui::shape::DrawingCache; use crate::ui::shape::DrawingCache;
use super::algo::{circle_points, line_points, sin_i16, PI4}; use super::super::algo::{circle_points, line_points, sin_i16, PI4};
pub trait BasicCanvas { pub trait BasicCanvas {
/// Returns dimensions of the canvas in pixels. /// Returns dimensions of the canvas in pixels.

@ -1,4 +1,3 @@
pub mod algo;
mod common; mod common;
mod mono8; mod mono8;
mod rgb565; mod rgb565;

@ -1,10 +1,9 @@
use crate::ui::{ use crate::ui::{
canvas::Canvas,
display::Color, display::Color,
geometry::{Point, Rect}, geometry::{Point, Rect},
}; };
use super::{DrawingCache, Renderer, Shape, ShapeClone}; use super::{Canvas, DrawingCache, Renderer, Shape, ShapeClone};
use without_alloc::alloc::LocalAllocLeakExt; use without_alloc::alloc::LocalAllocLeakExt;

@ -1,9 +1,6 @@
use crate::ui::{ use crate::ui::geometry::{Alignment2D, Offset, Point, Rect};
canvas::{Bitmap, BitmapFormat, BitmapView, Canvas},
geometry::{Alignment2D, Offset, Point, Rect},
};
use super::{DrawingCache, Renderer, Shape, ShapeClone}; use super::{Bitmap, BitmapFormat, BitmapView, Canvas, DrawingCache, Renderer, Shape, ShapeClone};
use without_alloc::alloc::LocalAllocLeakExt; use without_alloc::alloc::LocalAllocLeakExt;

@ -1,8 +1,10 @@
mod algo;
mod bar; mod bar;
mod base; mod base;
#[cfg(feature = "ui_blurring")] #[cfg(feature = "ui_blurring")]
mod blur; mod blur;
mod cache; mod cache;
mod canvas;
mod circle; mod circle;
#[cfg(feature = "ui_jpeg_decoder")] #[cfg(feature = "ui_jpeg_decoder")]
mod jpeg; mod jpeg;
@ -25,3 +27,10 @@ pub use qrcode::QrImage;
pub use render::{DirectRenderer, ProgressiveRenderer, Renderer}; pub use render::{DirectRenderer, ProgressiveRenderer, Renderer};
pub use text::Text; pub use text::Text;
pub use toif::ToifImage; pub use toif::ToifImage;
pub use canvas::{BasicCanvas, Canvas, Mono8Canvas, Rgb565Canvas, Rgba8888Canvas, Viewport};
use crate::trezorhal::bitmap;
pub use bitmap::{Bitmap, BitmapFormat, BitmapView};
pub use algo::PI4;

@ -1,9 +1,8 @@
use crate::ui::{ use crate::ui::{
canvas::{BasicCanvas, Canvas, Mono8Canvas, Viewport},
display, display,
display::Color, display::Color,
geometry::{Offset, Rect}, geometry::{Offset, Rect},
shape::{DirectRenderer, DrawingCache}, shape::{BasicCanvas, Canvas, DirectRenderer, DrawingCache, Mono8Canvas, Viewport},
}; };
use static_alloc::Bump; use static_alloc::Bump;

@ -1,8 +1,7 @@
use crate::ui::{ use crate::ui::{
canvas::{BasicCanvas, Viewport},
display::Color, display::Color,
geometry::{Offset, Rect}, geometry::{Offset, Rect},
shape::{DrawingCache, ProgressiveRenderer}, shape::{BasicCanvas, DrawingCache, ProgressiveRenderer, Viewport},
}; };
use crate::trezorhal::bitmap::{BitmapView, Dma2d}; use crate::trezorhal::bitmap::{BitmapView, Dma2d};

@ -1,12 +1,13 @@
use crate::ui::{ use crate::ui::{
canvas::{algo::line_points, Bitmap, BitmapFormat, Canvas},
display::Color, display::Color,
geometry::{Offset, Rect}, geometry::{Offset, Rect},
}; };
use qrcodegen::QrCode; use qrcodegen::QrCode;
use super::{DrawingCache, Renderer, Shape, ShapeClone}; use super::{
algo::line_points, Bitmap, BitmapFormat, Canvas, DrawingCache, Renderer, Shape, ShapeClone,
};
use without_alloc::alloc::LocalAllocLeakExt; use without_alloc::alloc::LocalAllocLeakExt;

@ -1,10 +1,10 @@
use crate::ui::{ use crate::ui::{
canvas::{BasicCanvas, Canvas, Rgb565Canvas, Viewport},
display::Color, display::Color,
geometry::{Offset, Point, Rect}, geometry::{Offset, Point, Rect},
shape::{DrawingCache, Shape, ShapeClone},
}; };
use super::{BasicCanvas, Canvas, DrawingCache, Rgb565Canvas, Shape, ShapeClone, Viewport};
use without_alloc::{alloc::LocalAllocLeakExt, FixedVec}; use without_alloc::{alloc::LocalAllocLeakExt, FixedVec};
// ========================================================================== // ==========================================================================

@ -1,10 +1,9 @@
use crate::ui::{ use crate::ui::{
canvas::{BitmapView, Canvas},
display::{Color, Font}, display::{Color, Font},
geometry::{Alignment, Offset, Point, Rect}, geometry::{Alignment, Offset, Point, Rect},
}; };
use super::{DrawingCache, Renderer, Shape, ShapeClone}; use super::{BitmapView, Canvas, DrawingCache, Renderer, Shape, ShapeClone};
use without_alloc::alloc::LocalAllocLeakExt; use without_alloc::alloc::LocalAllocLeakExt;

@ -1,10 +1,9 @@
use crate::ui::{ use crate::ui::{
canvas::{Bitmap, BitmapFormat, Canvas},
display::{toif::Toif, Color}, display::{toif::Toif, Color},
geometry::{Alignment2D, Offset, Point, Rect}, geometry::{Alignment2D, Offset, Point, Rect},
}; };
use super::{DrawingCache, Renderer, Shape, ShapeClone}; use super::{Bitmap, BitmapFormat, Canvas, DrawingCache, Renderer, Shape, ShapeClone};
use without_alloc::alloc::LocalAllocLeakExt; use without_alloc::alloc::LocalAllocLeakExt;

Loading…
Cancel
Save