summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-07-19 10:33:41 +0000
committerJens Arnold <amiconn@rockbox.org>2005-07-19 10:33:41 +0000
commitb0e056b5aeaac668312cbf67ee9c9d1713704b05 (patch)
treee0db08c1723c11b82191366ca3930046f5f1f34b
parent82ea7c3bacd0b5308e7f0b1d8f35a4e3e13e54f7 (diff)
downloadrockbox-b0e056b5aeaac668312cbf67ee9c9d1713704b05.zip
rockbox-b0e056b5aeaac668312cbf67ee9c9d1713704b05.tar.gz
rockbox-b0e056b5aeaac668312cbf67ee9c9d1713704b05.tar.bz2
rockbox-b0e056b5aeaac668312cbf67ee9c9d1713704b05.tar.xz
More preparations and conversions for colour LCD support.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7195 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugin.c8
-rw-r--r--apps/plugin.h7
-rw-r--r--apps/plugins/bounce.c11
-rw-r--r--apps/plugins/cube.c12
-rw-r--r--apps/screens.c6
-rw-r--r--firmware/export/lcd.h5
6 files changed, 39 insertions, 10 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index e298b55..6df7621 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -412,11 +412,11 @@ int plugin_load(const char* plugin, void* parameter)
button_clear_queue();
#ifdef HAVE_LCD_BITMAP
#if LCD_DEPTH > 1
- lcd_set_drawinfo(DRMODE_SOLID, 0, LCD_MAX_LEVEL);
-#else
+ lcd_set_drawinfo(DRMODE_SOLID, LCD_BLACK, LCD_WHITE);
+#else /* LCD_DEPTH == 1 */
lcd_set_drawmode(DRMODE_SOLID);
-#endif
-#endif
+#endif /* LCD_DEPTH */
+#endif /* HAVE_LCD_BITMAP */
plugin_loaded = false;
diff --git a/apps/plugin.h b/apps/plugin.h
index b081887..801c49e 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -403,10 +403,17 @@ struct plugin_api {
int *rundb_initialized;
int (*strncmp)(const char *, const char *, size_t);
#if LCD_DEPTH > 1
+#ifdef HAVE_LCD_COLOR
+ void (*lcd_set_foreground)(struct rgb color);
+ struct rgb (*lcd_get_foreground)(void);
+ void (*lcd_set_background)(struct rgb color);
+ struct rgb (*lcd_get_background)(void);
+#else
void (*lcd_set_foreground)(int brightness);
int (*lcd_get_foreground)(void);
void (*lcd_set_background)(int brightness);
int (*lcd_get_background)(void);
+#endif
void (*lcd_bitmap_part)(const unsigned char *src, int src_x, int src_y,
int stride, int x, int y, int width, int height);
void (*lcd_bitmap)(const unsigned char *src, int x, int y, int width,
diff --git a/apps/plugins/bounce.c b/apps/plugins/bounce.c
index c3bea8e..3ff3a8d 100644
--- a/apps/plugins/bounce.c
+++ b/apps/plugins/bounce.c
@@ -282,11 +282,18 @@ static void addclock(void)
#define DRAW_WIDTH (LCD_WIDTH + LETTER_WIDTH*2)
#if LCD_DEPTH > 1
-static const int face_colors[] =
+#ifdef HAVE_LCD_COLOR
+static const struct rgb face_colors[] =
+{
+ LCD_BLACK, {0, 0, LCD_MAX_BLUE}, {LCD_MAX_RED, 0, 0}
+};
+#else
+static const int face_colors[] =
{
0, 2*LCD_MAX_LEVEL/3, LCD_MAX_LEVEL/3
};
#endif
+#endif
static int scrollit(void)
{
@@ -474,7 +481,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
if (h > 0)
h = scrollit();
#if LCD_DEPTH > 1
- rb->lcd_set_foreground(0);
+ rb->lcd_set_foreground(LCD_BLACK);
#endif
} while(h > 0);
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c
index afb2b88..e69ef46 100644
--- a/apps/plugins/cube.c
+++ b/apps/plugins/cube.c
@@ -152,11 +152,19 @@ static const struct face faces[6] =
};
#if LCD_DEPTH > 1
-static const int face_colors[6] =
+#ifdef HAVE_LCD_COLOR
+static const struct rgb face_colors[6] =
+{
+ {LCD_MAX_RED, 0, 0}, {LCD_MAX_RED, 0, 0}, {0, LCD_MAX_GREEN, 0},
+ {0, LCD_MAX_GREEN, 0}, {0, 0, LCD_MAX_BLUE}, {0, 0, LCD_MAX_BLUE}
+};
+#else
+static const int face_colors[6] =
{
2*LCD_MAX_LEVEL/3, 2*LCD_MAX_LEVEL/3, LCD_MAX_LEVEL/3, LCD_MAX_LEVEL/3, 0, 0
};
#endif
+#endif
enum {
#if LCD_DEPTH > 1
@@ -352,7 +360,7 @@ static void cube_draw(void)
point2D[faces[i].corner[3]].y);
}
- rb->lcd_set_foreground(0);
+ rb->lcd_set_foreground(LCD_BLACK);
break;
#endif /* LCD_DEPTH > 1 */
diff --git a/apps/screens.c b/apps/screens.c
index a51d83f..19afe44 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -855,8 +855,12 @@ void splash(int ticks, /* how long the splash is displayed */
int xx = (LCD_WIDTH-maxw)/2 - 2;
/* The new graphics routines handle clipping, so no need to check */
#if LCD_DEPTH > 1
+#ifdef HAVE_LCD_COLOR
+ lcd_set_background((struct rgb){LCD_MAX_RED-1, LCD_MAX_GREEN-1, LCD_MAX_BLUE-1});
+#else
lcd_set_background(LCD_MAX_LEVEL-1);
#endif
+#endif
lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
lcd_fillrect(xx, y-2, maxw+4, LCD_HEIGHT-y*2+4);
lcd_set_drawmode(DRMODE_SOLID);
@@ -903,7 +907,7 @@ void splash(int ticks, /* how long the splash is displayed */
next = strtok_r(NULL, " ", &store);
}
#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH > 1)
- lcd_set_background(LCD_MAX_LEVEL);
+ lcd_set_background(LCD_WHITE);
#endif
lcd_update();
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 30677e4..cfc73b4 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -135,9 +135,12 @@ struct rgb {
unsigned char green;
unsigned char blue;
};
+#define LCD_BLACK ((struct rgb){0, 0, 0})
+#define LCD_WHITE ((struct rgb){LCD_MAX_RED, LCD_MAX_GREEN, LCD_MAX_BLUE})
#else /* monochrome */
#define LCD_MAX_LEVEL ((1 << LCD_DEPTH) - 1)
-
+#define LCD_BLACK 0
+#define LCD_WHITE LCD_MAX_LEVEL
#endif
/* Memory copy of display bitmap */