Save a few bytes in the line selector style handling code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14927 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
473b56bd30
commit
7b7b9310e7
4 changed files with 39 additions and 36 deletions
|
@ -910,16 +910,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
|
|||
s = &lcd_scroll_info.scroll[y];
|
||||
|
||||
s->start_tick = current_tick + lcd_scroll_info.delay;
|
||||
s->invert = false;
|
||||
if (style & STYLE_INVERT) {
|
||||
s->invert = 1;
|
||||
}
|
||||
else if (style & STYLE_COLORBAR) {
|
||||
s->invert = 2;
|
||||
}
|
||||
else if (style & STYLE_GRADIENT) {
|
||||
s->invert = 3;
|
||||
}
|
||||
s->style = style;
|
||||
lcd_puts_style_offset(x,y,string,style,offset);
|
||||
|
||||
lcd_getstringsize(string, &w, &h);
|
||||
|
@ -956,8 +947,6 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
|
|||
s->offset = offset;
|
||||
s->startx = xmargin + x * s->width / s->len;
|
||||
s->backward = false;
|
||||
s->line_color = (style&STYLE_COLORED)?
|
||||
(style&STYLE_COLOR_MASK): -1;
|
||||
lcd_scroll_info.lines |= (1<<y);
|
||||
}
|
||||
else
|
||||
|
@ -986,13 +975,13 @@ void lcd_scroll_fn(void)
|
|||
if (TIME_BEFORE(current_tick, s->start_tick))
|
||||
continue;
|
||||
|
||||
if (s->line_color >= 0) {
|
||||
if (s->invert) {
|
||||
if (s->style&STYLE_COLORED) {
|
||||
if (s->style&STYLE_MODE_MASK) {
|
||||
fg_pattern = old_fgcolor;
|
||||
bg_pattern = s->line_color;
|
||||
bg_pattern = s->style&STYLE_COLOR_MASK;
|
||||
}
|
||||
else {
|
||||
fg_pattern = s->line_color;
|
||||
fg_pattern = s->style&STYLE_COLOR_MASK;
|
||||
bg_pattern = old_bgcolor;
|
||||
}
|
||||
}
|
||||
|
@ -1027,20 +1016,26 @@ void lcd_scroll_fn(void)
|
|||
}
|
||||
|
||||
lastmode = drawmode;
|
||||
drawmode = s->invert == 1 ?
|
||||
(DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
|
||||
if (s->invert == 2) {
|
||||
/* Solid colour line selector */
|
||||
drawmode = DRMODE_FG;
|
||||
fg_pattern = lss_pattern;
|
||||
lcd_fillrect(0, ypos, LCD_WIDTH, pf->height);
|
||||
fg_pattern = lst_pattern;
|
||||
}
|
||||
else if (s->invert == 3) {
|
||||
/* Gradient line selector */
|
||||
drawmode = DRMODE_FG;
|
||||
lcd_gradient_rect(0, LCD_WIDTH, ypos, (signed)pf->height);
|
||||
fg_pattern = lst_pattern;
|
||||
switch (s->style&STYLE_MODE_MASK) {
|
||||
case STYLE_INVERT:
|
||||
drawmode = DRMODE_SOLID|DRMODE_INVERSEVID;
|
||||
break;
|
||||
case STYLE_COLORBAR:
|
||||
/* Solid colour line selector */
|
||||
drawmode = DRMODE_FG;
|
||||
fg_pattern = lss_pattern;
|
||||
lcd_fillrect(0, ypos, LCD_WIDTH, pf->height);
|
||||
fg_pattern = lst_pattern;
|
||||
break;
|
||||
case STYLE_GRADIENT:
|
||||
/* Gradient line selector */
|
||||
drawmode = DRMODE_FG;
|
||||
lcd_gradient_rect(0, LCD_WIDTH, ypos, (signed)pf->height);
|
||||
fg_pattern = lst_pattern;
|
||||
break;
|
||||
default:
|
||||
drawmode = DRMODE_SOLID;
|
||||
break;
|
||||
}
|
||||
lcd_putsxyofs(xpos, ypos, s->offset, s->line);
|
||||
drawmode = lastmode;
|
||||
|
|
|
@ -25,10 +25,11 @@
|
|||
#include "config.h"
|
||||
|
||||
#define STYLE_DEFAULT 0x00000000
|
||||
#define STYLE_INVERT 0x20000000
|
||||
#define STYLE_COLORED 0x10000000
|
||||
#define STYLE_INVERT 0x20000000
|
||||
#define STYLE_COLORBAR 0x40000000
|
||||
#define STYLE_GRADIENT 0x80000000
|
||||
#define STYLE_MODE_MASK 0xF0000000
|
||||
#define STYLE_COLOR_MASK 0x0000FFFF
|
||||
|
||||
#ifdef SIMULATOR
|
||||
|
|
|
@ -44,17 +44,14 @@ struct scrollinfo
|
|||
#ifdef HAVE_LCD_BITMAP
|
||||
int width; /* length of line in pixels */
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
int invert; /* invert the scrolled text */
|
||||
int style; /* line style */
|
||||
#else
|
||||
bool invert;
|
||||
bool invert; /* invert the scrolled text */
|
||||
#endif
|
||||
#endif/* HAVE_LCD_BITMAP */
|
||||
bool backward; /* scroll presently forward or backward? */
|
||||
bool bidir;
|
||||
long start_tick;
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
int line_color;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct scroll_screen_info
|
||||
|
|
|
@ -99,7 +99,12 @@ void lcd_invertscroll(int x, int y)
|
|||
if((unsigned)y>=LCD_SCROLLABLE_LINES) return;
|
||||
|
||||
s = &lcd_scroll_info.scroll[y];
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
s->style = !s->style; /* FIXME: now that the setting isn't bool this seems
|
||||
flawed. */
|
||||
#else
|
||||
s->invert = !s->invert;
|
||||
#endif
|
||||
}
|
||||
|
||||
void lcd_scroll_step(int step)
|
||||
|
@ -142,7 +147,12 @@ void lcd_remote_invertscroll(int x, int y)
|
|||
if((unsigned)y>=LCD_REMOTE_SCROLLABLE_LINES) return;
|
||||
|
||||
s = &lcd_remote_scroll_info.scroll[y];
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
s->style = !s->style; /* FIXME: now that the setting isn't bool this seems
|
||||
flawed. */
|
||||
#else
|
||||
s->invert = !s->invert;
|
||||
#endif
|
||||
}
|
||||
|
||||
void lcd_remote_stop_scroll(void)
|
||||
|
|
Loading…
Reference in a new issue