Make sure that the coordinates and size are within the LCD space. This is only used to validate input parameters for those functions that are internal to the console (such as `move_pixels`). Functions subject to user input (such as `draw_rect`) must not use this.
(&mut self, xy: PixelsXY, size: SizeInPixels)
| 198 | /// console (such as `move_pixels`). Functions subject to user input (such as `draw_rect`) must |
| 199 | /// not use this. |
| 200 | fn assert_xy_size_in_range(&mut self, xy: PixelsXY, size: SizeInPixels) { |
| 201 | if cfg!(test) { |
| 202 | self.assert_xy_in_range(xy); |
| 203 | let x = xy.x as usize; |
| 204 | let y = xy.y as usize; |
| 205 | |
| 206 | let width = usize::from(size.width); |
| 207 | let height = usize::from(size.height); |
| 208 | |
| 209 | debug_assert!( |
| 210 | x + width - 1 < self.size_pixels.width, |
| 211 | "x + width must be within the LCD width" |
| 212 | ); |
| 213 | debug_assert!( |
| 214 | y + height - 1 < self.size_pixels.height, |
| 215 | "y + height must be within the LCD height" |
| 216 | ); |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | /// Gets the start address of the pixel `x`/`y` in the framebuffer. |
| 221 | fn fb_addr(&self, x: usize, y: usize) -> usize { |
no test coverage detected