diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2012-05-19 17:21:54 -0400 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2012-05-19 17:21:54 -0400 |
commit | c2e9c93563298141058ed89b8c2f14138c3a2b88 (patch) | |
tree | 4fe8be4a7a6cf3c6780489a18bcd50277b986306 /firmware/target | |
parent | b1dcd298c7a5622944e628bf0da4bd04f5f59675 (diff) |
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
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/arm/as3525/lcd-ssd1303.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/firmware/target/arm/as3525/lcd-ssd1303.c b/firmware/target/arm/as3525/lcd-ssd1303.c index a36cf87d95..a00398a998 100644 --- a/firmware/target/arm/as3525/lcd-ssd1303.c +++ b/firmware/target/arm/as3525/lcd-ssd1303.c @@ -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 */ if (x < 0) - height += x, x = 0; + { + width += x; + x = 0; + } + if (x + width > LCD_WIDTH) width = LCD_WIDTH - x; + if (width <= 0) return; /* nothing left to do, 0 is harmful to lcd_write_data() */ + if (y < 0) - height += y, y = 0; + { + height += y; + y = 0; + } + if (y + height > LCD_HEIGHT) height = LCD_HEIGHT - y; + if (height <= 0) return; /* nothing left to do */ |