summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Cellerier <dionoea@videolan.org>2007-09-30 21:12:33 +0000
committerAntoine Cellerier <dionoea@videolan.org>2007-09-30 21:12:33 +0000
commit7b7b9310e70920ce399a1becf87cf15636431c0f (patch)
tree12469d222778c9c8c1b6ec0c49927e7d46d61303
parent473b56bd30af40ee5c73ab1659af7555d54441e4 (diff)
downloadrockbox-7b7b9310e70920ce399a1becf87cf15636431c0f.tar.gz
rockbox-7b7b9310e70920ce399a1becf87cf15636431c0f.tar.bz2
rockbox-7b7b9310e70920ce399a1becf87cf15636431c0f.zip
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
-rw-r--r--firmware/drivers/lcd-16bit.c55
-rw-r--r--firmware/export/lcd.h3
-rw-r--r--firmware/export/scroll_engine.h7
-rw-r--r--firmware/scroll_engine.c10
4 files changed, 39 insertions, 36 deletions
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c
index f748b4027c..e838d5106c 100644
--- a/firmware/drivers/lcd-16bit.c
+++ b/firmware/drivers/lcd-16bit.c
@@ -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;
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index eb67a12211..b64e506981 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -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
diff --git a/firmware/export/scroll_engine.h b/firmware/export/scroll_engine.h
index f40a00f96c..238641c08c 100644
--- a/firmware/export/scroll_engine.h
+++ b/firmware/export/scroll_engine.h
@@ -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
diff --git a/firmware/scroll_engine.c b/firmware/scroll_engine.c
index d4a2e174cc..e21cb8b3ae 100644
--- a/firmware/scroll_engine.c
+++ b/firmware/scroll_engine.c
@@ -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)