fixup! feat(core): introduce new drawing library

matejcik/lifetimehell
cepetr 2 weeks ago
parent 75a3f13918
commit 7c14d61693

@ -221,7 +221,7 @@ impl<'a> Bitmap<'a> {
let offset = self.stride * row as usize;
if offset % core::mem::align_of::<T>() == 0 {
let len = self.stride * height as usize;
self.wait_for_dma();
// SAFETY:
// The bitmap is mutable.
// The resulting slice is inside the bitmap and properly aligned.
@ -233,8 +233,6 @@ impl<'a> Bitmap<'a> {
)
};
self.wait_for_dma();
return Some(&mut array[offset..offset + len]);
}
}

@ -1,3 +0,0 @@
pub mod bitmap_base;
pub use bitmap_base::{Bitmap, BitmapFormat, BitmapView};

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

@ -59,10 +59,7 @@ impl<'a> DrawingCache<'a> {
"ZLIB cache alloc"
)),
#[cfg(feature = "ui_jpeg_decoder")]
jpeg_cache: RefCell::new(unwrap!(
JpegCache::new(bump_a),
"JPEG cache alloc"
)),
jpeg_cache: RefCell::new(unwrap!(JpegCache::new(bump_a), "JPEG cache alloc")),
#[cfg(feature = "ui_blurring")]
blur_cache: RefCell::new(unwrap!(BlurCache::new(bump_a), "Blur cache alloc")),

@ -269,8 +269,8 @@ impl<'a> JpegCache<'a> {
}
pub const fn get_bump_size() -> usize {
core::mem::size_of::<UnsafeCell<[u8; JPEG_SCRATCHPAD_SIZE]>>() +
core::mem::size_of::<UnsafeCell<[u8; JPEG_BUFF_SIZE]>>()
core::mem::size_of::<UnsafeCell<[u8; JPEG_SCRATCHPAD_SIZE]>>()
+ core::mem::size_of::<UnsafeCell<[u8; JPEG_BUFF_SIZE]>>()
}
}
@ -347,4 +347,3 @@ where
(self.output)(mcu_r, BitmapView::new(&mcu_bitmap))
}
}

@ -4,7 +4,7 @@ use crate::ui::{
};
use super::super::{
algo::{circle_points, line_points, sin_i16, PI4},
utils::{circle_points, line_points, sin_i16, PI4},
BitmapView, Viewport,
};

@ -1,4 +1,3 @@
mod algo;
mod bar;
mod base;
mod bitmap;
@ -14,8 +13,8 @@ mod qrcode;
mod render;
mod text;
mod toif;
mod utils;
pub use algo::PI4;
pub use bar::Bar;
pub use base::{Shape, ShapeClone};
pub use bitmap::{Bitmap, BitmapFormat, BitmapView};
@ -31,3 +30,4 @@ pub use qrcode::QrImage;
pub use render::{DirectRenderer, ProgressiveRenderer, Renderer};
pub use text::Text;
pub use toif::ToifImage;
pub use utils::PI4;

@ -6,7 +6,7 @@ use crate::ui::{
use qrcodegen::QrCode;
use super::{
algo::line_points, Bitmap, BitmapFormat, Canvas, DrawingCache, Renderer, Shape, ShapeClone,
utils::line_points, Bitmap, BitmapFormat, Canvas, DrawingCache, Renderer, Shape, ShapeClone,
};
use without_alloc::alloc::LocalAllocLeakExt;

Loading…
Cancel
Save