Fix remote warnings and charcell reds, and remove minor left-over tuff.

Change-Id: I10987ea9fcad94d502afd4ae4a80ab9022c75d2e
This commit is contained in:
Thomas Martitz 2014-01-12 01:50:21 +01:00
parent 488a1b983e
commit 0a0d61e777
3 changed files with 20 additions and 18 deletions

View file

@ -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;
};
} lines[MAX_LINES];
#define NOINLINE __attribute__ ((noinline))
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);

View file

@ -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);

View file

@ -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);
}