lcd-ssd1303: Fix big oops putting height where there should've been width.

Rid code of dar commasar and substitute huggy braces while we're at it. :P

Change-Id: If91974b93660bb0de32a0c92629eb83cea99d266
This commit is contained in:
Michael Sevakis 2012-05-19 17:21:54 -04:00
parent b1dcd298c7
commit c2e9c93563

View file

@ -288,15 +288,26 @@ void lcd_update_rect(int x, int y, int width, int height)
/* The Y coordinates have to work on even 8 pixel rows */ /* The Y coordinates have to work on even 8 pixel rows */
if (x < 0) if (x < 0)
height += x, x = 0; {
width += x;
x = 0;
}
if (x + width > LCD_WIDTH) if (x + width > LCD_WIDTH)
width = LCD_WIDTH - x; width = LCD_WIDTH - x;
if (width <= 0) if (width <= 0)
return; /* nothing left to do, 0 is harmful to lcd_write_data() */ return; /* nothing left to do, 0 is harmful to lcd_write_data() */
if (y < 0) if (y < 0)
height += y, y = 0; {
height += y;
y = 0;
}
if (y + height > LCD_HEIGHT) if (y + height > LCD_HEIGHT)
height = LCD_HEIGHT - y; height = LCD_HEIGHT - y;
if (height <= 0) if (height <= 0)
return; /* nothing left to do */ return; /* nothing left to do */