From c2e9c93563298141058ed89b8c2f14138c3a2b88 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sat, 19 May 2012 17:21:54 -0400 Subject: 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 --- firmware/target/arm/as3525/lcd-ssd1303.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'firmware/target') 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 */ -- cgit v1.2.3