Extends the current damage area to include the area between between `x1y1` and `x2y2` (inclusive) as damaged. This only makes sense when syncing is disabled, as the damage area represents the contents that need to be flushed to the LCD once syncing is enabled again.
(&mut self, x1y1: LcdXY, x2y2: LcdXY)
| 230 | /// This only makes sense when syncing is disabled, as the damage area represents the contents |
| 231 | /// that need to be flushed to the LCD once syncing is enabled again. |
| 232 | fn damage(&mut self, x1y1: LcdXY, x2y2: LcdXY) { |
| 233 | debug_assert!(!self.sync); |
| 234 | debug_assert!(x2y2.x >= x1y1.x); |
| 235 | debug_assert!(x2y2.y >= x1y1.y); |
| 236 | |
| 237 | if self.damage.is_none() { |
| 238 | self.damage = Some((x1y1, x2y2)); |
| 239 | return; |
| 240 | } |
| 241 | let mut damage = self.damage.unwrap(); |
| 242 | |
| 243 | if damage.0.x > x1y1.x { |
| 244 | damage.0.x = x1y1.x; |
| 245 | } |
| 246 | if damage.0.y > x1y1.y { |
| 247 | damage.0.y = x1y1.y; |
| 248 | } |
| 249 | |
| 250 | if damage.1.x < x2y2.x { |
| 251 | damage.1.x = x2y2.x; |
| 252 | } |
| 253 | if damage.1.y < x2y2.y { |
| 254 | damage.1.y = x2y2.y; |
| 255 | } |
| 256 | |
| 257 | self.damage = Some(damage); |
| 258 | } |
| 259 | |
| 260 | /// Fills the area contained between `x1y1` and `x2y2` (inclusive) with the current drawing |
| 261 | /// color. |
no outgoing calls
no test coverage detected