diff options
author | Thomas Martitz <kugel@rockbox.org> | 2013-04-03 16:33:23 +0200 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2013-12-14 23:11:30 +0100 |
commit | 1c5d0b41eebdb4f8c627b1a0e5f7b699f0b08fb8 (patch) | |
tree | 3ec44a4e6cfe4bfaab689e765ef3546d8dac730d /firmware | |
parent | 47c8d3c14d8fdaf4749ef5e0380fb0c52140b5fb (diff) |
scroll_engine: Rename scroll_stop* functions to be more consistent with the lcd api.
Change-Id: I8ada10b96bfb628cca0331689e8b936ae47c7e1c
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/lcd-16bit-common.c | 8 | ||||
-rw-r--r-- | firmware/drivers/lcd-1bit-vert.c | 2 | ||||
-rw-r--r-- | firmware/drivers/lcd-bitmap-common.c | 10 | ||||
-rw-r--r-- | firmware/drivers/lcd-charcell.c | 6 | ||||
-rw-r--r-- | firmware/export/lcd-remote.h | 3 | ||||
-rw-r--r-- | firmware/export/lcd.h | 4 | ||||
-rw-r--r-- | firmware/export/scroll_engine.h | 24 | ||||
-rw-r--r-- | firmware/rolo.c | 2 | ||||
-rw-r--r-- | firmware/scroll_engine.c | 36 |
9 files changed, 53 insertions, 42 deletions
diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c index f8673ec6db..dffc1cf075 100644 --- a/firmware/drivers/lcd-16bit-common.c +++ b/firmware/drivers/lcd-16bit-common.c @@ -144,13 +144,9 @@ void lcd_clear_viewport(void) } if (current_vp == &default_vp) - { - lcd_scroll_info.lines = 0; - } + lcd_scroll_stop(); else - { - lcd_scroll_stop(current_vp); - } + lcd_scroll_stop_viewport(current_vp); } /*** parameter handling ***/ diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c index 5cacf0a740..668c685187 100644 --- a/firmware/drivers/lcd-1bit-vert.c +++ b/firmware/drivers/lcd-1bit-vert.c @@ -226,7 +226,7 @@ void LCDFN(clear_viewport)(void) current_vp->drawmode = oldmode; - LCDFN(scroll_stop)(current_vp); + LCDFN(scroll_stop_viewport)(current_vp); } } diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c index a17ac51006..10a567edf1 100644 --- a/firmware/drivers/lcd-bitmap-common.c +++ b/firmware/drivers/lcd-bitmap-common.c @@ -178,6 +178,12 @@ void LCDFN(set_viewport)(struct viewport* vp) #endif } +struct viewport *LCDFN(get_viewport)(bool *is_default) +{ + *is_default = (current_vp == &default_vp); + return current_vp; +} + void LCDFN(update_viewport)(void) { LCDFN(update_rect)(current_vp->x, current_vp->y, @@ -405,7 +411,7 @@ void LCDFN(puts_style_xyoffset)(int x, int y, const unsigned char *str, int style, int x_offset, int y_offset) { int xpos, ypos, h; - LCDFN(scroll_stop_line)(current_vp, y); + LCDFN(scroll_stop_viewport_line)(current_vp, y); if(!str) return; @@ -491,7 +497,7 @@ void LCDFN(puts_scroll_style_xyoffset)(int x, int y, const unsigned char *string if (restart) { /* remove any previously scrolling line at the same location */ - LCDFN(scroll_stop_line)(current_vp, y); + LCDFN(scroll_stop_viewport_line)(current_vp, y); if (LCDFN(scroll_info).lines >= LCDM(SCROLLABLE_LINES)) return; LCDFN(puts_style_xyoffset)(x, y, string, style, x_offset, y_offset); diff --git a/firmware/drivers/lcd-charcell.c b/firmware/drivers/lcd-charcell.c index b59b270f9b..bdd02de1b6 100644 --- a/firmware/drivers/lcd-charcell.c +++ b/firmware/drivers/lcd-charcell.c @@ -377,7 +377,7 @@ void lcd_clear_viewport(void) for (y = 0; y < current_vp->height; y++) lcd_putxchar(x, y, xspace); - lcd_scroll_stop(current_vp); + lcd_scroll_stop_viewport(current_vp); } } @@ -486,7 +486,7 @@ void lcd_puts_offset(int x, int y, const unsigned char *str, int offset) return; /* make sure scrolling is turned off on the line we are updating */ - lcd_scroll_stop_line(current_vp, y); + lcd_scroll_stop_viewport_line(current_vp, y); x = lcd_putsxyofs(x, y, offset, str); while (x < current_vp->width) @@ -509,7 +509,7 @@ void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, return; /* remove any previously scrolling line at the same location */ - lcd_scroll_stop_line(current_vp, y); + lcd_scroll_stop_viewport_line(current_vp, y); if (lcd_scroll_info.lines >= LCD_SCROLLABLE_LINES) return; diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h index 6a3371fef2..74b668db3d 100644 --- a/firmware/export/lcd-remote.h +++ b/firmware/export/lcd-remote.h @@ -187,9 +187,6 @@ extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str, extern void lcd_remote_puts_style_xyoffset(int x, int y, const unsigned char *str, int style, int x_offset, int y_offset); extern void lcd_remote_putc(int x, int y, unsigned short ch); -extern void lcd_remote_stop_scroll(void); -extern void lcd_remote_scroll_speed(int speed); -extern void lcd_remote_scroll_delay(int ms); extern void lcd_remote_puts_scroll(int x, int y, const unsigned char *str); extern void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *str, int style); diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 5ad2d83513..7ea053f241 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h @@ -207,10 +207,6 @@ extern void lcd_puts_offset(int x, int y, const unsigned char *str, int offset); extern void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, int offset); extern void lcd_putc(int x, int y, unsigned long ucs); -extern void lcd_stop_scroll(void); -extern void lcd_bidir_scroll(int threshold); -extern void lcd_scroll_speed(int speed); -extern void lcd_scroll_delay(int ms); extern void lcd_puts_scroll(int x, int y, const unsigned char* string); extern void lcd_puts_scroll_style(int x, int y, const unsigned char* string, int style); diff --git a/firmware/export/scroll_engine.h b/firmware/export/scroll_engine.h index 55f4120893..01a9a5e33d 100644 --- a/firmware/export/scroll_engine.h +++ b/firmware/export/scroll_engine.h @@ -29,14 +29,24 @@ #include <lcd.h> #include "file.h" -void scroll_init(void) INIT_ATTR; -void lcd_scroll_stop(const struct viewport* vp); -void lcd_scroll_stop_line(const struct viewport* vp, int y); -void lcd_scroll_fn(void); +extern void scroll_init(void) INIT_ATTR; + +extern void lcd_bidir_scroll(int threshold); +extern void lcd_scroll_speed(int speed); +extern void lcd_scroll_delay(int ms); + +extern void lcd_scroll_stop(void); +extern void lcd_scroll_stop_viewport(const struct viewport *vp); +extern void lcd_scroll_stop_viewport_line(const struct viewport *vp, int line); +extern void lcd_scroll_fn(void); #ifdef HAVE_REMOTE_LCD -void lcd_remote_scroll_fn(void); -void lcd_remote_scroll_stop(const struct viewport* vp); -void lcd_remote_scroll_stop_line(const struct viewport* vp, int y); +extern void lcd_remote_scroll_speed(int speed); +extern void lcd_remote_scroll_delay(int ms); + +extern void lcd_remote_scroll_stop(void); +extern void lcd_remote_scroll_stop_viewport(const struct viewport *vp); +extern void lcd_remote_scroll_stop_viewport_line(const struct viewport *vp, int line); +extern void lcd_remote_scroll_fn(void); #endif /* internal usage, but in multiple drivers */ diff --git a/firmware/rolo.c b/firmware/rolo.c index 325e17e97f..79969bbbcf 100644 --- a/firmware/rolo.c +++ b/firmware/rolo.c @@ -115,7 +115,7 @@ static void rolo_error(const char *text) button_get(true); button_get(true); button_get(true); - lcd_stop_scroll(); + lcd_scroll_stop(); } #if CONFIG_CPU == SH7034 || CONFIG_CPU == IMX31L || CONFIG_CPU == RK27XX diff --git a/firmware/scroll_engine.c b/firmware/scroll_engine.c index bc356a8281..82af26afa8 100644 --- a/firmware/scroll_engine.c +++ b/firmware/scroll_engine.c @@ -41,6 +41,10 @@ static const char scroll_tick_table[18] = { 100, 80, 64, 50, 40, 32, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3, 2, 1 }; +/* imported private functions from lcd-bitmap-common.c */ +extern struct viewport *lcd_get_viewport(void); +extern struct viewport *lcd_remote_get_viewport(void); + static void scroll_thread(void); static char scroll_stack[DEFAULT_STACK_SIZE*3]; static const char scroll_name[] = "scroll"; @@ -80,20 +84,21 @@ struct scroll_screen_info lcd_remote_scroll_info = }; #endif /* HAVE_REMOTE_LCD */ -void lcd_stop_scroll(void) +void lcd_scroll_stop(void) { lcd_scroll_info.lines = 0; } /* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ -void lcd_scroll_stop_line(const struct viewport* current_vp, int y) +void lcd_scroll_stop_viewport_line(const struct viewport *current_vp, int line) { int i = 0; while (i < lcd_scroll_info.lines) { - if ((lcd_scroll_info.scroll[i].vp == current_vp) && - ((y < 0) || (lcd_scroll_info.scroll[i].y == y))) + struct viewport *vp = lcd_scroll_info.scroll[i].vp; + if (((vp == current_vp)) && + ((line < 0) || (lcd_scroll_info.scroll[i].y == line))) { /* If i is not the last active line in the array, then move the last item to position i */ @@ -106,7 +111,7 @@ void lcd_scroll_stop_line(const struct viewport* current_vp, int y) /* A line can only appear once, so we're done, * unless we are clearing the whole viewport */ - if (y >= 0) + if (line >= 0) return ; } else @@ -117,9 +122,9 @@ void lcd_scroll_stop_line(const struct viewport* current_vp, int y) } /* Stop all scrolling lines in the specified viewport */ -void lcd_scroll_stop(const struct viewport* vp) +void lcd_scroll_stop_viewport(const struct viewport *current_vp) { - lcd_scroll_stop_line(vp, -1); + lcd_scroll_stop_viewport_line(current_vp, -1); } void lcd_scroll_speed(int speed) @@ -157,20 +162,21 @@ void lcd_jump_scroll_delay(int ms) #endif #ifdef HAVE_REMOTE_LCD -void lcd_remote_stop_scroll(void) +void lcd_remote_scroll_stop(void) { lcd_remote_scroll_info.lines = 0; } /* Stop scrolling line y in the specified viewport, or all lines if y < 0 */ -void lcd_remote_scroll_stop_line(const struct viewport* current_vp, int y) +void lcd_remote_scroll_stop_viewport_line(const struct viewport *current_vp, int line) { int i = 0; - while (i < lcd_remote_scroll_info.lines) + while (i < lcd_scroll_info.lines) { - if ((lcd_remote_scroll_info.scroll[i].vp == current_vp) && - ((y < 0) || (lcd_remote_scroll_info.scroll[i].y == y))) + struct viewport *vp = lcd_remote_scroll_info.scroll[i].vp; + if (((vp == current_vp)) && + ((line < 0) || (lcd_remote_scroll_info.scroll[i].y == line))) { /* If i is not the last active line in the array, then move the last item to position i */ @@ -183,7 +189,7 @@ void lcd_remote_scroll_stop_line(const struct viewport* current_vp, int y) /* A line can only appear once, so we're done, * unless we are clearing the whole viewport */ - if (y >= 0) + if (line >= 0) return ; } else @@ -194,9 +200,9 @@ void lcd_remote_scroll_stop_line(const struct viewport* current_vp, int y) } /* Stop all scrolling lines in the specified viewport */ -void lcd_remote_scroll_stop(const struct viewport* vp) +void lcd_remote_scroll_stop_viewport(const struct viewport *current_vp) { - lcd_remote_scroll_stop_line(vp, -1); + lcd_remote_scroll_stop_viewport_line(current_vp, -1); } void lcd_remote_scroll_speed(int speed) |