diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-08-09 12:20:54 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-08-09 12:20:54 +0000 |
commit | 6985f34bebc38585a1c57c6be29d27957655a09b (patch) | |
tree | a375cf4df9b5bc437676e15c7590b2267b1e79bc | |
parent | 9bf86f75fac571e79e9fd85632704e43fb026ae1 (diff) | |
download | rockbox-6985f34bebc38585a1c57c6be29d27957655a09b.tar.gz rockbox-6985f34bebc38585a1c57c6be29d27957655a09b.zip |
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
-rw-r--r-- | firmware/API | 8 | ||||
-rw-r--r-- | firmware/drivers/lcd.c | 34 | ||||
-rw-r--r-- | firmware/drivers/lcd.h | 5 |
3 files changed, 46 insertions, 1 deletions
diff --git a/firmware/API b/firmware/API index cfd5aa8945..dfa6690260 100644 --- a/firmware/API +++ b/firmware/API | |||
@@ -30,6 +30,14 @@ LCD | |||
30 | shown on screen by calling lcd_update(). | 30 | shown on screen by calling lcd_update(). |
31 | 31 | ||
32 | lcd_update() update the LCD according to the internal buffer. | 32 | lcd_update() update the LCD according to the internal buffer. |
33 | |||
34 | |||
35 | lcd_update_rect(int x, int y, int height, int width) | ||
36 | |||
37 | Update the given rectangle to the LCD. Give arguments measured in | ||
38 | pixels. Notice that the smallest vertical resolution in updates that the | ||
39 | hardware supports is even 8 pixels. This function will adjust to those. | ||
40 | |||
33 | lcd_setfont(int font) set default font | 41 | lcd_setfont(int font) set default font |
34 | lcd_setmargins(int x, int y) set top/left margins | 42 | lcd_setmargins(int x, int y) set top/left margins |
35 | lcd_putsxy(x,y,string,font) put a string at given position, using a | 43 | 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) | |||
594 | } | 594 | } |
595 | } | 595 | } |
596 | 596 | ||
597 | /* | ||
598 | * Update a fraction of the display. | ||
599 | */ | ||
600 | void lcd_update_rect (int, int, int, int) __attribute__ ((section (".icode"))); | ||
601 | void lcd_update_rect (int x_start, int y, | ||
602 | int width, int height) | ||
603 | { | ||
604 | int ymax; | ||
605 | int xmax; | ||
606 | int x; | ||
607 | |||
608 | /* The Y coordinates have to work on even 8 pixel rows */ | ||
609 | ymax = (y + height)/8; | ||
610 | y /= 8; | ||
611 | |||
612 | xmax = x_start + width; | ||
613 | |||
614 | if(xmax > LCD_WIDTH) | ||
615 | xmax = LCD_WIDTH; | ||
616 | if(ymax >= LCD_HEIGHT/8) | ||
617 | ymax = LCD_HEIGHT/8-1; | ||
618 | |||
619 | /* Copy specified rectange bitmap to hardware */ | ||
620 | for (; y <= ymax; y++) | ||
621 | { | ||
622 | lcd_write (true, LCD_CNTL_PAGE | (y & 0xf)); | ||
623 | lcd_write (true, LCD_CNTL_HIGHCOL | ((x_start>>4) & 0xf)); | ||
624 | lcd_write (true, LCD_CNTL_LOWCOL | (x_start & 0xf)); | ||
625 | |||
626 | for (x = x_start; x < xmax; x++) | ||
627 | lcd_write (false, lcd_framebuffer[x][y]); | ||
628 | } | ||
629 | } | ||
630 | |||
597 | #endif /* SIMULATOR */ | 631 | #endif /* SIMULATOR */ |
598 | 632 | ||
599 | /* | 633 | /* |
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); | |||
35 | extern void lcd_scroll_speed( int speed ); | 35 | extern void lcd_scroll_speed( int speed ); |
36 | 36 | ||
37 | #if defined(SIMULATOR) || defined(HAVE_LCD_BITMAP) | 37 | #if defined(SIMULATOR) || defined(HAVE_LCD_BITMAP) |
38 | extern void lcd_update(void); | 38 | extern void lcd_update(void); |
39 | |||
40 | /* update a fraction of the screen */ | ||
41 | extern void lcd_update_rect(int x, int y, int width, int height); | ||
39 | #else | 42 | #else |
40 | #define lcd_update() | 43 | #define lcd_update() |
41 | #endif | 44 | #endif |