diff options
| author | Thomas Martitz <kugel@rockbox.org> | 2014-01-12 01:50:21 +0100 |
|---|---|---|
| committer | Thomas Martitz <kugel@rockbox.org> | 2014-01-12 01:50:21 +0100 |
| commit | 0a0d61e777c47d742be195dd9c661065be0eb7da (patch) | |
| tree | fdb9660885991731d0122f74395a8b7a677c8123 | |
| parent | 488a1b983e1c2fac14de25aa781caf12628e53c8 (diff) | |
| download | rockbox-0a0d61e777c47d742be195dd9c661065be0eb7da.zip rockbox-0a0d61e777c47d742be195dd9c661065be0eb7da.tar.gz rockbox-0a0d61e777c47d742be195dd9c661065be0eb7da.tar.bz2 rockbox-0a0d61e777c47d742be195dd9c661065be0eb7da.tar.xz | |
Fix remote warnings and charcell reds, and remove minor left-over tuff.
Change-Id: I10987ea9fcad94d502afd4ae4a80ab9022c75d2e
| -rw-r--r-- | apps/gui/line.c | 12 | ||||
| -rw-r--r-- | apps/plugin.h | 2 | ||||
| -rw-r--r-- | firmware/drivers/lcd-charcell.c | 24 |
3 files changed, 20 insertions, 18 deletions
diff --git a/apps/gui/line.c b/apps/gui/line.c index e2eb6f2..fe01797 100644 --- a/apps/gui/line.c +++ b/apps/gui/line.c @@ -53,18 +53,15 @@ static void put_text(struct screen *display, int x, int y, struct line_desc *lin struct line_desc_scroll { struct line_desc desc; /* must be first! */ bool used; -}; - -#define NOINLINE __attribute__ ((noinline)) +} lines[MAX_LINES]; -struct line_desc_scroll *get_line_desc(void) NOINLINE; -struct line_desc_scroll *get_line_desc(void) +static struct line_desc_scroll *get_line_desc(void) { - static struct line_desc_scroll lines[MAX_LINES]; static unsigned line_index; struct line_desc_scroll *this; - do { + do + { this = &lines[line_index++]; if (line_index >= ARRAYLEN(lines)) line_index = 0; @@ -87,7 +84,6 @@ static void scroller(struct scrollinfo *s, struct screen *display) line->used = false; } else - if (s->line) { style_line(display, s->x, s->y - (line->desc.height/2 - display->getcharheight()/2), &line->desc); put_text(display, s->x, s->y, &line->desc, s->line, true, s->offset); diff --git a/apps/plugin.h b/apps/plugin.h index 5d6527d..8a0d056 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -326,7 +326,7 @@ struct plugin_api { void (*lcd_remote_set_contrast)(int x); void (*lcd_remote_clear_display)(void); void (*lcd_remote_puts)(int x, int y, const unsigned char *string); - void (*lcd_remote_puts_scroll)(int x, int y, const unsigned char* string); + bool (*lcd_remote_puts_scroll)(int x, int y, const unsigned char* string); void (*lcd_remote_scroll_stop)(void); void (*lcd_remote_set_drawmode)(int mode); int (*lcd_remote_get_drawmode)(void); diff --git a/firmware/drivers/lcd-charcell.c b/firmware/drivers/lcd-charcell.c index 6a6e57e..46c48bb 100644 --- a/firmware/drivers/lcd-charcell.c +++ b/firmware/drivers/lcd-charcell.c @@ -511,7 +511,7 @@ void lcd_putsf(int x, int y, const unsigned char *fmt, ...) /** scrolling **/ -void lcd_puts_scroll_worker(int x, int y, const unsigned char *string, +bool lcd_puts_scroll_worker(int x, int y, const unsigned char *string, int offset, void (*scroll_func)(struct scrollinfo *), void *data) { @@ -519,12 +519,13 @@ void lcd_puts_scroll_worker(int x, int y, const unsigned char *string, int len; if ((unsigned)y >= (unsigned)current_vp->height) - return; + return false; /* remove any previously scrolling line at the same location */ lcd_scroll_stop_viewport_rect(current_vp, x, y, current_vp->width - x, 1); - if (lcd_scroll_info.lines >= LCD_SCROLLABLE_LINES) return; + if (lcd_scroll_info.lines >= LCD_SCROLLABLE_LINES) + return false; s = &lcd_scroll_info.scroll[lcd_scroll_info.lines]; @@ -534,7 +535,7 @@ void lcd_puts_scroll_worker(int x, int y, const unsigned char *string, len = utf8length(string); if (current_vp->width - x >= len) - return; + return false; /* prepare scroll line */ strlcpy(s->linebuffer, string, sizeof s->linebuffer); @@ -558,19 +559,24 @@ void lcd_puts_scroll_worker(int x, int y, const unsigned char *string, s->offset = offset; s->backward = false; lcd_scroll_info.lines++; + + return true; } -void lcd_putsxy_scroll_func(int x, int y, const unsigned char *string, +bool lcd_putsxy_scroll_func(int x, int y, const unsigned char *string, void (*scroll_func)(struct scrollinfo *), void *data, int x_offset) { + bool retval = false; if (!scroll_func) lcd_putsxyofs(x, y, x_offset, string); else - lcd_puts_scroll_worker(x, y, string, x_offset, scroll_func, data); + retval = lcd_puts_scroll_worker(x, y, string, x_offset, scroll_func, data); + + return retval; } -void lcd_scroll_fn(struct scrollinfo* s) +static void lcd_scroll_fn(struct scrollinfo* s) { lcd_putsxyofs(s->x, s->y, s->offset, s->line); if (lcd_cursor.enabled) @@ -583,7 +589,7 @@ void lcd_scroll_fn(struct scrollinfo* s) } } -void lcd_puts_scroll(int x, int y, const unsigned char *string) +bool lcd_puts_scroll(int x, int y, const unsigned char *string) { - lcd_puts_scroll_worker(x, y, string, 0, lcd_scroll_fn, NULL); + return lcd_puts_scroll_worker(x, y, string, 0, lcd_scroll_fn, NULL); } |