mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 20:55:17 -05:00
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:
parent
b1dcd298c7
commit
c2e9c93563
1 changed files with 13 additions and 2 deletions
|
|
@ -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 */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue