diff --git a/core/embed/rust/src/ui/gdc_poc.rs b/core/embed/rust/src/ui/gdc_poc.rs index 1ae981105..ffd5d7ab3 100644 --- a/core/embed/rust/src/ui/gdc_poc.rs +++ b/core/embed/rust/src/ui/gdc_poc.rs @@ -136,9 +136,8 @@ fn draw_screen(split: Point) -> time::Duration { let bump_a = unsafe { &mut *core::ptr::addr_of_mut!(POOL_A) }; let bump_b = unsafe { &mut *core::ptr::addr_of_mut!(POOL_B) }; { - let mut context = DrawingContextImpl::new(bump_a, bump_b); - let mut canvas = display::Canvas::acquire().unwrap(); + let mut context = DrawingContextImpl::new(bump_a, bump_b); let vp = canvas.set_window(canvas.bounds().inset(Insets::new(20, 0, 0, 0))); diff --git a/core/embed/rust/src/ui/shape/context/bitmap_cache.rs b/core/embed/rust/src/ui/shape/context/bitmap_cache.rs index af1586997..6a8db8158 100644 --- a/core/embed/rust/src/ui/shape/context/bitmap_cache.rs +++ b/core/embed/rust/src/ui/shape/context/bitmap_cache.rs @@ -5,7 +5,7 @@ pub struct BitmapCache<'a> { } impl<'a> BitmapCache<'a> { - pub fn new<'alloc: 'a, T>(_pool: &'alloc T) -> BitmapCache<'alloc> + pub fn new<'alloc: 'a, T>(_pool: &'alloc T) -> Self where T: LocalAllocLeakExt<'alloc>, { diff --git a/core/embed/rust/src/ui/shape/context/blur_cache.rs b/core/embed/rust/src/ui/shape/context/blur_cache.rs index 0d539d487..d493ac05c 100644 --- a/core/embed/rust/src/ui/shape/context/blur_cache.rs +++ b/core/embed/rust/src/ui/shape/context/blur_cache.rs @@ -5,7 +5,7 @@ pub struct BlurCache<'a> { } impl<'a> BlurCache<'a> { - pub fn new<'alloc: 'a, T>(_pool: &'alloc T) -> BlurCache<'alloc> + pub fn new<'alloc: 'a, T>(_pool: &'alloc T) -> Self where T: LocalAllocLeakExt<'alloc>, { diff --git a/core/embed/rust/src/ui/shape/context/context.rs b/core/embed/rust/src/ui/shape/context/context.rs index 22fb9f206..b95adf66c 100644 --- a/core/embed/rust/src/ui/shape/context/context.rs +++ b/core/embed/rust/src/ui/shape/context/context.rs @@ -24,18 +24,17 @@ pub trait DrawingContext<'a> { ) -> Result<(), tjpgd::Error>; } -pub struct DrawingContextImpl<'a, 'b> { - zlib_cache: ZlibCache<'a>, - jpeg_cache: JpegCache<'a>, - blur_cache: BlurCache<'a>, - bitmap_cache: BitmapCache<'b>, +pub struct DrawingContextImpl<'alloc> { + zlib_cache: ZlibCache<'alloc>, + jpeg_cache: JpegCache<'alloc>, + blur_cache: BlurCache<'alloc>, + bitmap_cache: BitmapCache<'alloc>, } -impl<'a, 'b> DrawingContextImpl<'a, 'b> { - pub fn new(pool_a: &'a TA, pool_b: &'b TB) -> Self +impl<'alloc> DrawingContextImpl<'alloc> { + pub fn new(pool_a: &'alloc TA, pool_b: &'alloc TA) -> Self where - TA: LocalAllocLeakExt<'a>, - TB: LocalAllocLeakExt<'b>, + TA: LocalAllocLeakExt<'alloc>, { Self { zlib_cache: ZlibCache::new(pool_a, 4), @@ -46,7 +45,7 @@ impl<'a, 'b> DrawingContextImpl<'a, 'b> { } } -impl<'a, 'b> DrawingContext<'a> for DrawingContextImpl<'a, 'b> { +impl<'a> DrawingContext<'a> for DrawingContextImpl<'a> { fn deflate_toif(&mut self, toif: Toif<'static>, from_row: i16, dest_buf: &mut [u8]) { let from_offset = toif.stride() * from_row as usize; self.zlib_cache diff --git a/core/embed/rust/src/ui/shape/context/jpeg_cache.rs b/core/embed/rust/src/ui/shape/context/jpeg_cache.rs index d54ec4601..9d5dd8552 100644 --- a/core/embed/rust/src/ui/shape/context/jpeg_cache.rs +++ b/core/embed/rust/src/ui/shape/context/jpeg_cache.rs @@ -180,7 +180,7 @@ pub struct JpegCache<'a> { } impl<'a> JpegCache<'a> { - pub fn new<'alloc: 'a, T>(pool: &'alloc T, slot_count: usize) -> JpegCache<'a> + pub fn new<'alloc: 'a, T>(pool: &'alloc T, slot_count: usize) -> Self where T: LocalAllocLeakExt<'alloc>, { diff --git a/core/embed/rust/src/ui/shape/context/zlib_cache.rs b/core/embed/rust/src/ui/shape/context/zlib_cache.rs index afecaae5a..2b3c79120 100644 --- a/core/embed/rust/src/ui/shape/context/zlib_cache.rs +++ b/core/embed/rust/src/ui/shape/context/zlib_cache.rs @@ -97,7 +97,7 @@ pub struct ZlibCache<'a> { } impl<'a> ZlibCache<'a> { - pub fn new<'alloc: 'a, T>(pool: &'alloc T, slot_count: usize) -> ZlibCache<'alloc> + pub fn new<'alloc: 'a, T>(pool: &'alloc T, slot_count: usize) -> Self where T: LocalAllocLeakExt<'alloc>, { diff --git a/core/embed/rust/src/ui/shape/render.rs b/core/embed/rust/src/ui/shape/render.rs index 6cf12d2ea..5ed7f1571 100644 --- a/core/embed/rust/src/ui/shape/render.rs +++ b/core/embed/rust/src/ui/shape/render.rs @@ -110,9 +110,9 @@ struct ShapeHolder<'a> { } /// A more advanced Renderer implementation that supports deferred rendering. -pub struct ProgressiveRenderer<'can, 'ctx, 'alloc, T: LocalAllocLeakExt<'alloc>> { +pub struct ProgressiveRenderer<'a, 'alloc, T: LocalAllocLeakExt<'alloc>> { /// Target canvas - canvas: &'can mut dyn rgb::RgbCanvas, + canvas: &'a mut dyn rgb::RgbCanvas, /// Pool for cloning shapes pool: &'alloc T, /// List of rendered shapes @@ -122,18 +122,18 @@ pub struct ProgressiveRenderer<'can, 'ctx, 'alloc, T: LocalAllocLeakExt<'alloc>> // Default background color bg_color: Option, /// Drawing context (decompression context, scratch-pad memory) - drawing_context: &'ctx mut dyn DrawingContext<'alloc>, + drawing_context: &'a mut dyn DrawingContext<'alloc>, } -impl<'can, 'ctx, 'alloc, T> ProgressiveRenderer<'can, 'ctx, 'alloc, T> +impl<'a, 'alloc, T> ProgressiveRenderer<'a, 'alloc, T> where T: LocalAllocLeakExt<'alloc>, { /// Creates a new ProgressiveRenderer instance pub fn new( - canvas: &'can mut dyn rgb::RgbCanvas, + canvas: &'a mut dyn rgb::RgbCanvas, bg_color: Option, - context: &'ctx mut dyn DrawingContext<'alloc>, + context: &'a mut dyn DrawingContext<'alloc>, pool: &'alloc T, max_shapes: usize, ) -> Self { @@ -193,7 +193,7 @@ where } } -impl<'can, 'ctx, 'alloc, T> Renderer for ProgressiveRenderer<'can, 'ctx, 'alloc, T> +impl<'a, 'alloc, T> Renderer for ProgressiveRenderer<'a, 'alloc, T> where T: LocalAllocLeakExt<'alloc>, {