diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2012-05-19 14:05:11 -0400 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2012-05-19 14:05:11 -0400 |
| commit | b1dcd298c7a5622944e628bf0da4bd04f5f59675 (patch) | |
| tree | 5b83e79b3d69fb67301e6af6ea2457a9e8fe33f1 | |
| parent | 028c5e35eee43efc3c922ffc0db067fc61cf27cb (diff) | |
| download | rockbox-b1dcd298c7a5622944e628bf0da4bd04f5f59675.zip rockbox-b1dcd298c7a5622944e628bf0da4bd04f5f59675.tar.gz rockbox-b1dcd298c7a5622944e628bf0da4bd04f5f59675.tar.bz2 rockbox-b1dcd298c7a5622944e628bf0da4bd04f5f59675.tar.xz | |
ssd1303: make sure sansa clip and whatever others clip updates properly.
Sometimes I do want to update outside the screen boundaries and it was
messing it up; such things should not cause display problems.
Change-Id: Ic9deec609b19e5a1c603601b20c66599dd44f892
| -rw-r--r-- | firmware/target/arm/as3525/lcd-ssd1303.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/firmware/target/arm/as3525/lcd-ssd1303.c b/firmware/target/arm/as3525/lcd-ssd1303.c index 9fcc85d..a36cf87 100644 --- a/firmware/target/arm/as3525/lcd-ssd1303.c +++ b/firmware/target/arm/as3525/lcd-ssd1303.c @@ -287,15 +287,21 @@ void lcd_update_rect(int x, int y, int width, int height) return; /* The Y coordinates have to work on even 8 pixel rows */ - ymax = (y + height-1) >> 3; - y >>= 3; - - if(x + width > LCD_WIDTH) + if (x < 0) + height += 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(ymax >= LCD_FBHEIGHT) - ymax = LCD_FBHEIGHT-1; + if (y < 0) + height += y, y = 0; + if (y + height > LCD_HEIGHT) + height = LCD_HEIGHT - y; + if (height <= 0) + return; /* nothing left to do */ + + ymax = (y + height-1) >> 3; + y >>= 3; /* Copy specified rectange bitmap to hardware */ for (; y <= ymax; y++) |