MCPcopy Create free account
hub / github.com/endbasic/endbasic / assert_xy_in_range

Method assert_xy_in_range

std/src/gfx/lcd/buffered/mod.rs:186–193  ·  view source on GitHub ↗

Make sure that the coordinates 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)

Source from the content-addressed store, hash-verified

184 /// console (such as `move_pixels`). Functions subject to user input (such as `draw_rect`) must
185 /// not use this.
186 fn assert_xy_in_range(&mut self, xy: PixelsXY) {
187 if cfg!(test) {
188 let x = usize::try_from(xy.x).expect("x must be positive and must fit");
189 let y = usize::try_from(xy.y).expect("y must be positive and must fit");
190 debug_assert!(x < self.size_pixels.width, "x must be within the LCD width");
191 debug_assert!(y < self.size_pixels.height, "y must be within the LCD height");
192 }
193 }
194
195 /// Make sure that the coordinates and size are within the LCD space.
196 ///

Callers 2

put_pixelsMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected