Fixed unecessary parentheses

This commit is contained in:
Sebastian 2018-09-23 19:57:25 +02:00
parent 2789acd044
commit acfba93c0b
2 changed files with 9 additions and 9 deletions

View File

@ -31,14 +31,14 @@ pub trait GFX : PrimitveGFX {
let steep_dir_vertical = ((y1 as i16) - (y0 as i16)).abs() > ((x1 as i16) - (x0 as i16)).abs(); let steep_dir_vertical = ((y1 as i16) - (y0 as i16)).abs() > ((x1 as i16) - (x0 as i16)).abs();
let (x0, y0, x1, y1) = if (steep_dir_vertical) { let (x0, y0, x1, y1) = if steep_dir_vertical {
(y0, x0, y1, x1) (y0, x0, y1, x1)
} }
else { else {
(x0, y0, x1, y1) (x0, y0, x1, y1)
}; };
let (x0, y0, x1, y1) = if (x0 > x1) { let (x0, y0, x1, y1) = if x0 > x1 {
(x1, y1, x0, y0) (x1, y1, x0, y0)
} }
else { else {
@ -51,7 +51,7 @@ pub trait GFX : PrimitveGFX {
let mut err = dx / 2; let mut err = dx / 2;
let y_step : i16 = if (y0 < y1) { let y_step : i16 = if y0 < y1 {
1 1
} else { } else {
-1 -1
@ -62,8 +62,8 @@ pub trait GFX : PrimitveGFX {
let mut cur_y = y0 as i16; let mut cur_y = y0 as i16;
for cur_x in x0..(x1 + 1) { for cur_x in x0..(x1 + 1) {
err -= dy; err -= dy;
if (err < 0) { if err < 0 {
if (steep_dir_vertical) { if steep_dir_vertical {
self.draw_fast_vline(cur_y as u8, seg, cur_x - seg + 1, color); self.draw_fast_vline(cur_y as u8, seg, cur_x - seg + 1, color);
} else { } else {
self.draw_fast_hline(seg, cur_y as u8, cur_x - seg + 1, color); self.draw_fast_hline(seg, cur_y as u8, cur_x - seg + 1, color);

View File

@ -517,10 +517,10 @@ impl<SPIAddr, GPIOAddr> bitmaps::BitmapGFX for St7735IO<SPIAddr, GPIOAddr>
return; return;
} }
if((x + bitmap.width - 1) >= self.st7735.width) { if (x + bitmap.width - 1) >= self.st7735.width {
return; return;
} }
if((y + bitmap.height - 1) >= self.st7735.height) { if (y + bitmap.height - 1) >= self.st7735.height {
return; return;
} }
@ -551,10 +551,10 @@ impl<SPIAddr, GPIOAddr> bitmaps::BitmapGFX for St7735IO<SPIAddr, GPIOAddr>
return; return;
} }
if((x + bitmap.width - 1) >= self.st7735.width) { if (x + bitmap.width - 1) >= self.st7735.width {
return; return;
} }
if((y + bitmap.height - 1) >= self.st7735.height) { if (y + bitmap.height - 1) >= self.st7735.height {
return; return;
} }