From 6985f34bebc38585a1c57c6be29d27957655a09b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 9 Aug 2002 12:20:54 +0000 Subject: Added lcd_update_rect(), for updating only a part of the LCD. This was written "blindly". I've not tested this on hardware (yet). The simulators will need to get this funtion added as well. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1643 a1c6a512-1295-4272-9138-f99709370657 --- firmware/API | 8 ++++++++ firmware/drivers/lcd.c | 34 ++++++++++++++++++++++++++++++++++ firmware/drivers/lcd.h | 5 ++++- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/firmware/API b/firmware/API index cfd5aa8945..dfa6690260 100644 --- a/firmware/API +++ b/firmware/API @@ -30,6 +30,14 @@ LCD shown on screen by calling lcd_update(). lcd_update() update the LCD according to the internal buffer. + + + lcd_update_rect(int x, int y, int height, int width) + + Update the given rectangle to the LCD. Give arguments measured in + pixels. Notice that the smallest vertical resolution in updates that the + hardware supports is even 8 pixels. This function will adjust to those. + lcd_setfont(int font) set default font lcd_setmargins(int x, int y) set top/left margins lcd_putsxy(x,y,string,font) put a string at given position, using a diff --git a/firmware/drivers/lcd.c b/firmware/drivers/lcd.c index fe1e13a522..056aca0769 100644 --- a/firmware/drivers/lcd.c +++ b/firmware/drivers/lcd.c @@ -594,6 +594,40 @@ void lcd_update (void) } } +/* + * Update a fraction of the display. + */ +void lcd_update_rect (int, int, int, int) __attribute__ ((section (".icode"))); +void lcd_update_rect (int x_start, int y, + int width, int height) +{ + int ymax; + int xmax; + int x; + + /* The Y coordinates have to work on even 8 pixel rows */ + ymax = (y + height)/8; + y /= 8; + + xmax = x_start + width; + + if(xmax > LCD_WIDTH) + xmax = LCD_WIDTH; + if(ymax >= LCD_HEIGHT/8) + ymax = LCD_HEIGHT/8-1; + + /* Copy specified rectange bitmap to hardware */ + for (; y <= ymax; y++) + { + lcd_write (true, LCD_CNTL_PAGE | (y & 0xf)); + lcd_write (true, LCD_CNTL_HIGHCOL | ((x_start>>4) & 0xf)); + lcd_write (true, LCD_CNTL_LOWCOL | (x_start & 0xf)); + + for (x = x_start; x < xmax; x++) + lcd_write (false, lcd_framebuffer[x][y]); + } +} + #endif /* SIMULATOR */ /* diff --git a/firmware/drivers/lcd.h b/firmware/drivers/lcd.h index 23e333287b..a2d392cbd5 100644 --- a/firmware/drivers/lcd.h +++ b/firmware/drivers/lcd.h @@ -35,7 +35,10 @@ extern void lcd_stop_scroll(void); extern void lcd_scroll_speed( int speed ); #if defined(SIMULATOR) || defined(HAVE_LCD_BITMAP) - extern void lcd_update(void); +extern void lcd_update(void); + +/* update a fraction of the screen */ +extern void lcd_update_rect(int x, int y, int width, int height); #else #define lcd_update() #endif -- cgit v1.2.3