diff --git a/core/embed/rust/src/ui/shape/canvas/common.rs b/core/embed/rust/src/ui/shape/canvas/common.rs index 66f41441bf..ebc88ff7a3 100644 --- a/core/embed/rust/src/ui/shape/canvas/common.rs +++ b/core/embed/rust/src/ui/shape/canvas/common.rs @@ -375,6 +375,10 @@ pub trait Canvas: BasicCanvas { // Draws circle with the specified center and the radius. #[cfg(not(feature = "ui_antialiasing"))] fn draw_circle(&mut self, center: Point, radius: i16, color: Color, alpha: u8) { + if radius == 0 { + return; + } + let split = unwrap!(circle_points(radius).last()).v; let r = Rect::new( @@ -437,6 +441,10 @@ pub trait Canvas: BasicCanvas { /// Draws filled circle with the specified center and the radius. #[cfg(not(feature = "ui_antialiasing"))] fn fill_circle(&mut self, center: Point, radius: i16, color: Color, alpha: u8) { + if radius == 0 { + return; + } + let split = unwrap!(circle_points(radius).last()).v; let r = Rect::new( @@ -500,6 +508,10 @@ pub trait Canvas: BasicCanvas { /// radius. #[cfg(feature = "ui_antialiasing")] fn fill_circle(&mut self, center: Point, radius: i16, color: Color, alpha: u8) { + if radius == 0 { + return; + } + let split = unwrap!(circle_points(radius).last()).v; let alpha_mul = |a: u8| -> u8 { ((a as u16 * alpha as u16) / 255) as u8 }; @@ -590,6 +602,10 @@ pub trait Canvas: BasicCanvas { mut end: f32, color: Color, ) { + if radius == 0 { + return; + } + start = (360.0 + start % 360.0) % 360.0; end = (360.0 + end % 360.0) % 360.0; @@ -715,6 +731,10 @@ fn fill_octant( mut u2: i16, fill: &mut impl FnMut(Option, u8, Point, u8), ) { + if radius == 0 { + return; + } + // Starting end ending points on if u1 > u2 { (u1, u2) = (u2, u1);