mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-24 07:28:34 +00:00
fixup! feat(core): introduce new drawing library
This commit is contained in:
parent
dfb196e10e
commit
f3103ebb0d
@ -122,7 +122,7 @@ impl<'s> ShapeClone<'s> for Bar {
|
||||
where
|
||||
T: LocalAllocLeakExt<'alloc>,
|
||||
{
|
||||
let clone = bump.alloc_t::<Bar>()?;
|
||||
let clone = bump.alloc_t()?;
|
||||
Some(clone.uninit.init(Bar { ..self }))
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ impl<'s> ShapeClone<'s> for Blurring {
|
||||
where
|
||||
T: LocalAllocLeakExt<'alloc>,
|
||||
{
|
||||
let clone = bump.alloc_t::<Blurring>()?;
|
||||
let clone = bump.alloc_t()?;
|
||||
Some(clone.uninit.init(Blurring { ..self }))
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ impl<'a> BlurCache<'a> {
|
||||
T: LocalAllocLeakExt<'alloc>,
|
||||
{
|
||||
let buff = bump
|
||||
.alloc_t::<UnsafeCell<BlurBuff>>()?
|
||||
.alloc_t()?
|
||||
.uninit
|
||||
.init(UnsafeCell::new([0; 7928])); // TODO !!! 7928
|
||||
|
||||
|
@ -45,7 +45,7 @@ where
|
||||
B: LocalAllocLeakExt<'a>,
|
||||
{
|
||||
Some(
|
||||
bump.alloc_t::<RefCell<[u8; S]>>()?
|
||||
bump.alloc_t()?
|
||||
.uninit
|
||||
.init(RefCell::new([0; S])),
|
||||
)
|
||||
|
@ -64,12 +64,12 @@ impl<'a> JpegCacheSlot<'a> {
|
||||
T: LocalAllocLeakExt<'alloc>,
|
||||
{
|
||||
let scratchpad = bump
|
||||
.alloc_t::<UnsafeCell<[u8; JPEG_SCRATCHPAD_SIZE]>>()?
|
||||
.alloc_t()?
|
||||
.uninit
|
||||
.init(UnsafeCell::new([0; JPEG_SCRATCHPAD_SIZE]));
|
||||
|
||||
let canvas_buff = bump
|
||||
.alloc_t::<UnsafeCell<[u8; JPEG_BUFF_SIZE]>>()?
|
||||
.alloc_t()?
|
||||
.uninit
|
||||
.init(UnsafeCell::new([0; JPEG_BUFF_SIZE]));
|
||||
|
||||
|
@ -23,7 +23,7 @@ impl<'a> ZlibCacheSlot<'a> {
|
||||
T: LocalAllocLeakExt<'alloc>,
|
||||
{
|
||||
let window = bump
|
||||
.alloc_t::<UnsafeCell<[u8; UZLIB_WINDOW_SIZE]>>()?
|
||||
.alloc_t()?
|
||||
.uninit
|
||||
.init(UnsafeCell::new([0; UZLIB_WINDOW_SIZE]));
|
||||
|
||||
|
@ -839,12 +839,12 @@ impl Rect {
|
||||
/// Returns a new `Rect` with potentially swapped left/right,
|
||||
/// top/bottom coordinates, ensuring that `x0`, `y0` represents
|
||||
/// the top-left corner and `x1`, `y1` represents the bottom-right corner.
|
||||
pub fn normalize(&self) -> Self {
|
||||
fn normalize(&self) -> Self {
|
||||
Rect {
|
||||
x0: core::cmp::min(self.x0, self.x1),
|
||||
y0: core::cmp::min(self.y0, self.y1),
|
||||
x1: core::cmp::max(self.x0, self.x1),
|
||||
y1: core::cmp::max(self.y0, self.y1),
|
||||
x0: self.x0.min(self.x1),
|
||||
y0: self.y0.min(self.y1),
|
||||
x1: self.x0.max(self.x1),
|
||||
y1: self.y0.max(self.y1),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ impl<'s> ShapeClone<'s> for Circle {
|
||||
where
|
||||
T: LocalAllocLeakExt<'alloc>,
|
||||
{
|
||||
let clone = bump.alloc_t::<Circle>()?;
|
||||
let clone = bump.alloc_t()?;
|
||||
Some(clone.uninit.init(Circle { ..self }))
|
||||
}
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ impl<'a> ShapeClone<'a> for JpegImage<'a> {
|
||||
where
|
||||
T: LocalAllocLeakExt<'alloc>,
|
||||
{
|
||||
let clone = bump.alloc_t::<JpegImage>()?;
|
||||
let clone = bump.alloc_t()?;
|
||||
Some(clone.uninit.init(JpegImage { ..self }))
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ impl<'s> ShapeClone<'s> for QrImage {
|
||||
where
|
||||
T: LocalAllocLeakExt<'alloc>,
|
||||
{
|
||||
let clone = bump.alloc_t::<QrImage>()?;
|
||||
let clone = bump.alloc_t()?;
|
||||
Some(clone.uninit.init(QrImage { ..self }))
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ impl<'a, 's> ShapeClone<'s> for Text<'a> {
|
||||
where
|
||||
T: LocalAllocLeakExt<'alloc>,
|
||||
{
|
||||
let clone = bump.alloc_t::<Text>()?;
|
||||
let clone = bump.alloc_t()?;
|
||||
let text = bump.copy_str(self.text)?;
|
||||
Some(clone.uninit.init(Text { text, ..self }))
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ impl<'a> ShapeClone<'a> for ToifImage<'a> {
|
||||
where
|
||||
T: LocalAllocLeakExt<'alloc>,
|
||||
{
|
||||
let clone = bump.alloc_t::<ToifImage>()?;
|
||||
let clone = bump.alloc_t()?;
|
||||
Some(clone.uninit.init(ToifImage { ..self }))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user