summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-11-16 21:09:23 +0000
committerJens Arnold <amiconn@rockbox.org>2005-11-16 21:09:23 +0000
commit5b2cba17aa95ececfdb6a498540de4dfa215e920 (patch)
tree3574eab7dc84f588268b72f6db56744fcc4d0e64 /apps/plugins
parent15046f99b3840c07bdd9d52e7014c6e775267c55 (diff)
downloadrockbox-5b2cba17aa95ececfdb6a498540de4dfa215e920.zip
rockbox-5b2cba17aa95ececfdb6a498540de4dfa215e920.tar.gz
rockbox-5b2cba17aa95ececfdb6a498540de4dfa215e920.tar.bz2
rockbox-5b2cba17aa95ececfdb6a498540de4dfa215e920.tar.xz
Changed the LCD_COLOR pixel value format to packed RGB (unsigned int). Now all LCDs with depth > 1 use the same datatype. Added macros for easy pixel value definition.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7912 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/bounce.c13
-rw-r--r--apps/plugins/cube.c16
-rw-r--r--apps/plugins/lib/gray.h10
-rw-r--r--apps/plugins/lib/gray_parm.c10
-rw-r--r--apps/plugins/minesweeper.c14
-rw-r--r--apps/plugins/sokoban.c6
-rw-r--r--apps/plugins/solitaire.c8
-rw-r--r--apps/plugins/sudoku.c10
8 files changed, 31 insertions, 56 deletions
diff --git a/apps/plugins/bounce.c b/apps/plugins/bounce.c
index 3ff3a8d..1bf8b3b 100644
--- a/apps/plugins/bounce.c
+++ b/apps/plugins/bounce.c
@@ -282,17 +282,14 @@ static void addclock(void)
#define DRAW_WIDTH (LCD_WIDTH + LETTER_WIDTH*2)
#if LCD_DEPTH > 1
-#ifdef HAVE_LCD_COLOR
-static const struct rgb face_colors[] =
+static const unsigned face_colors[] =
{
- LCD_BLACK, {0, 0, LCD_MAX_BLUE}, {LCD_MAX_RED, 0, 0}
-};
+#ifdef HAVE_LCD_COLOR
+ LCD_BLACK, LCD_RGBPACK(0, 0, 255), LCD_RGBPACK(255, 0, 0)
#else
-static const int face_colors[] =
-{
- 0, 2*LCD_MAX_LEVEL/3, LCD_MAX_LEVEL/3
-};
+ LCD_BLACK, LCD_LIGHTGRAY, LCD_DARKGRAY
#endif
+};
#endif
static int scrollit(void)
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c
index 2360269..dc5b570 100644
--- a/apps/plugins/cube.c
+++ b/apps/plugins/cube.c
@@ -152,18 +152,16 @@ static const struct face faces[6] =
};
#if LCD_DEPTH > 1
-#ifdef HAVE_LCD_COLOR
-static const struct rgb face_colors[6] =
+static const unsigned 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}
-};
+#ifdef HAVE_LCD_COLOR
+ LCD_RGBPACK(255, 0, 0), LCD_RGBPACK(255, 0, 0), LCD_RGBPACK(0, 255, 0),
+ LCD_RGBPACK(0, 255, 0), LCD_RGBPACK(0, 0, 255), LCD_RGBPACK(0, 0, 255)
#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
-};
+ LCD_LIGHTGRAY, LCD_LIGHTGRAY, LCD_DARKGRAY,
+ LCD_DARKGRAY, LCD_BLACK, LCD_BLACK
#endif
+};
#endif
enum {
diff --git a/apps/plugins/lib/gray.h b/apps/plugins/lib/gray.h
index dadac92..f82cf38 100644
--- a/apps/plugins/lib/gray.h
+++ b/apps/plugins/lib/gray.h
@@ -51,11 +51,11 @@ void gray_update_rect(int x, int y, int width, int height);
void gray_set_position(int x, int by);
void gray_set_drawmode(int mode);
int gray_get_drawmode(void);
-void gray_set_foreground(int brightness);
-int gray_get_foreground(void);
-void gray_set_background(int brightness);
-int gray_get_background(void);
-void gray_set_drawinfo(int mode, int fg_brightness, int bg_brightness);
+void gray_set_foreground(unsigned brightness);
+unsigned gray_get_foreground(void);
+void gray_set_background(unsigned brightness);
+unsigned gray_get_background(void);
+void gray_set_drawinfo(int mode, unsigned fg_brightness, unsigned bg_brightness);
void gray_setfont(int newfont);
int gray_getstringsize(const unsigned char *str, int *w, int *h);
diff --git a/apps/plugins/lib/gray_parm.c b/apps/plugins/lib/gray_parm.c
index a8c238a..c4ee92f 100644
--- a/apps/plugins/lib/gray_parm.c
+++ b/apps/plugins/lib/gray_parm.c
@@ -53,7 +53,7 @@ int gray_get_drawmode(void)
}
/* Set the foreground shade for subsequent drawing operations */
-void gray_set_foreground(int brightness)
+void gray_set_foreground(unsigned brightness)
{
unsigned data = MULU16(_gray_info.depth, brightness & 0xFF) + 127;
@@ -61,14 +61,14 @@ void gray_set_foreground(int brightness)
}
/* Return the current foreground shade */
-int gray_get_foreground(void)
+unsigned gray_get_foreground(void)
{
return (_gray_info.fg_brightness * 255 + (_gray_info.depth >> 1))
/ _gray_info.depth;
}
/* Set the background shade for subsequent drawing operations */
-void gray_set_background(int brightness)
+void gray_set_background(unsigned brightness)
{
unsigned data = MULU16(_gray_info.depth, brightness & 0xFF) + 127;
@@ -76,14 +76,14 @@ void gray_set_background(int brightness)
}
/* Return the current background shade */
-int gray_get_background(void)
+unsigned gray_get_background(void)
{
return (_gray_info.bg_brightness * 255 + (_gray_info.depth >> 1))
/ _gray_info.depth;
}
/* Set draw mode, foreground and background shades at once */
-void gray_set_drawinfo(int mode, int fg_brightness, int bg_brightness)
+void gray_set_drawinfo(int mode, unsigned fg_brightness, unsigned bg_brightness)
{
gray_set_drawmode(mode);
gray_set_foreground(fg_brightness);
diff --git a/apps/plugins/minesweeper.c b/apps/plugins/minesweeper.c
index 097c1b0..4af467b 100644
--- a/apps/plugins/minesweeper.c
+++ b/apps/plugins/minesweeper.c
@@ -67,16 +67,6 @@ use F3 to see how many mines are left (supposing all your flags are correct)
#endif
-#if LCD_DEPTH > 1
-#if HAVE_LCD_COLOR
-#define LIGHT_GRAY ((struct rgb){2*LCD_MAX_RED/3, 2*LCD_MAX_GREEN/3, 2*LCD_MAX_BLUE/3})
-#define DARK_GRAY ((struct rgb){LCD_MAX_RED/3, LCD_MAX_GREEN/3, LCD_MAX_BLUE/3})
-#else
-#define LIGHT_GRAY (2*LCD_MAX_LEVEL/3)
-#define DARK_GRAY (LCD_MAX_LEVEL/3)
-#endif
-#endif
-
/* here is a global api struct pointer. while not strictly necessary,
it's nice not to have to pass the api pointer in all function calls
in the plugin */
@@ -385,7 +375,7 @@ int minesweeper(void)
for(i=0;i<height;i++){
for(j=0;j<width;j++){
#if LCD_DEPTH > 1
- rb->lcd_set_foreground(DARK_GRAY);
+ rb->lcd_set_foreground(LCD_DARKGRAY);
rb->lcd_drawrect(j*8,i*8,8,8);
rb->lcd_set_foreground(LCD_BLACK);
#else
@@ -404,7 +394,7 @@ int minesweeper(void)
rb->lcd_drawline(j*8+2,i*8+5,j*8+5,i*8+2);
} else {
#if LCD_DEPTH > 1
- rb->lcd_set_foreground(LIGHT_GRAY);
+ rb->lcd_set_foreground(LCD_LIGHTGRAY);
rb->lcd_fillrect(j*8+1,i*8+1,6,6);
rb->lcd_set_foreground(LCD_BLACK);
#else
diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c
index 70f616d..a341cf5 100644
--- a/apps/plugins/sokoban.c
+++ b/apps/plugins/sokoban.c
@@ -59,10 +59,10 @@
#endif
#if LCD_DEPTH > 1
-#if HAVE_LCD_COLOR
-#define MEDIUM_GRAY ((struct rgb){LCD_MAX_RED/2, LCD_MAX_GREEN/2, LCD_MAX_BLUE/2})
+#ifdef HAVE_LCD_COLOR
+#define MEDIUM_GRAY LCD_RGBPACK(127, 127, 127)
#else
-#define MEDIUM_GRAY (LCD_MAX_LEVEL/2)
+#define MEDIUM_GRAY LCD_BRIGHTNESS(127)
#endif
#endif
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c
index b2af082..30405a5 100644
--- a/apps/plugins/solitaire.c
+++ b/apps/plugins/solitaire.c
@@ -135,13 +135,13 @@ static struct plugin_api* rb;
#endif
#if LCD_DEPTH>1
+static const unsigned colors[4] = {
#ifdef HAVE_LCD_COLOR
-static const unsigned struct rgb colors[4] = {
- { 0, 0, 0 }, { LCD_MAX_RED, 0, 0 }, { 0, 0, 0 }, { LCD_MAX_RED, 0, 0 }
-};
+ LCD_BLACK, LCD_RGBPACK(255, 0, 0), LCD_BLACK, LCD_RGBPACK(255, 0, 0)
#else
-static const int colors[4] = { LCD_BLACK, LCD_MAX_LEVEL/2, LCD_BLACK, LCD_MAX_LEVEL/2 };
+ LCD_BLACK, LCD_BRIGHTNESS(127), LCD_BLACK, LCD_BRIGHTNESS(127)
#endif
+};
#endif
static const unsigned char suits[4][8] = {
diff --git a/apps/plugins/sudoku.c b/apps/plugins/sudoku.c
index 526416d..bab53bb 100644
--- a/apps/plugins/sudoku.c
+++ b/apps/plugins/sudoku.c
@@ -362,16 +362,6 @@ static unsigned char num_inverse[10][8]= {
#error SUDOKU: Unsupported LCD size
#endif
-#if LCD_DEPTH > 1
-#if HAVE_LCD_COLOR
-#define LIGHT_GRAY ((struct rgb){2*LCD_MAX_RED/3, 2*LCD_MAX_GREEN/3, 2*LCD_MAX_BLUE/3})
-#define DARK_GRAY ((struct rgb){LCD_MAX_RED/3, LCD_MAX_GREEN/3, LCD_MAX_BLUE/3})
-#else
-#define LIGHT_GRAY (2*LCD_MAX_LEVEL/3)
-#define DARK_GRAY (LCD_MAX_LEVEL/3)
-#endif
-#endif
-
/* here is a global api struct pointer. while not strictly necessary,
it's nice not to have to pass the api pointer in all function calls
in the plugin */