decreased the change of a overflow happening in draw_pixel, some more calculations and improvements are needed

This commit is contained in:
Chris
2018-05-26 17:38:51 +02:00
parent 2272ef80ee
commit 03f2cbc942
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -87,7 +87,7 @@ impl Graphics {
pub fn draw_pixel(&self, buffer: &mut[u8], x: u16, y: u16, color: &Color) {
let (idx, bit) = match self.rotation {
Displayorientation::Rotate0 | Displayorientation::Rotate180
=> ((x + self.width * y) / 8,
=> ((x / 8 + (self.width / 8) * y) ,
0x80 >> (x % 8)),
Displayorientation::Rotate90 | Displayorientation::Rotate270
=> (y / 8 * self.width + x,