diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2006-10-14 01:32:58 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2006-10-14 01:32:58 +0000 |
commit | 6aa12c11f741a4544d780d11fc583a25a5aef171 (patch) | |
tree | 0fe4b08bd13817657660c5339247e8ea203f2508 /firmware/export | |
parent | 1f3360f0216dbf54bcd50547a759fa6e514c6e76 (diff) | |
download | rockbox-6aa12c11f741a4544d780d11fc583a25a5aef171.tar.gz rockbox-6aa12c11f741a4544d780d11fc583a25a5aef171.zip |
Added a small interface to screens to translate colors into remote gray levels on the x5. Splash screens paint properly with light gray. Should be adapted to a more general approach in the future. A few trailing whitespace trimmings got into a couple files but that is fine.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11218 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/lcd-remote.h | 16 | ||||
-rw-r--r-- | firmware/export/lcd.h | 23 |
2 files changed, 28 insertions, 11 deletions
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h index 5f1551e395..13d78ac428 100644 --- a/firmware/export/lcd-remote.h +++ b/firmware/export/lcd-remote.h | |||
@@ -60,9 +60,18 @@ typedef void lcd_remote_pixelfunc_type(int x, int y); | |||
60 | typedef void lcd_remote_blockfunc_type(fb_remote_data *address, unsigned mask, | 60 | typedef void lcd_remote_blockfunc_type(fb_remote_data *address, unsigned mask, |
61 | unsigned bits); | 61 | unsigned bits); |
62 | 62 | ||
63 | #if LCD_REMOTE_DEPTH > 1 /* greyscale */ | 63 | #if LCD_REMOTE_DEPTH > 1 /* greyscale - 8 bit max */ |
64 | #ifdef HAVE_LCD_COLOR | ||
65 | extern unsigned lcd_remote_color_to_native(unsigned color); | ||
66 | #endif | ||
67 | |||
64 | #define LCD_REMOTE_MAX_LEVEL ((1 << LCD_REMOTE_DEPTH) - 1) | 68 | #define LCD_REMOTE_MAX_LEVEL ((1 << LCD_REMOTE_DEPTH) - 1) |
65 | #define LCD_REMOTE_BRIGHTNESS(y) (((y) * LCD_REMOTE_MAX_LEVEL + 127) / 255) | 69 | /** |
70 | * On 2 bit for example (y >> (8-DEPTH)) = (y >> 6) = y/64 gives: | ||
71 | * |000-063|064-127|128-191|192-255| | ||
72 | * | 0 | 1 | 2 | 3 | | ||
73 | */ | ||
74 | #define LCD_REMOTE_BRIGHTNESS(y) ((y) >> (8-LCD_REMOTE_DEPTH)) | ||
66 | 75 | ||
67 | #define LCD_REMOTE_BLACK LCD_REMOTE_BRIGHTNESS(0) | 76 | #define LCD_REMOTE_BLACK LCD_REMOTE_BRIGHTNESS(0) |
68 | #define LCD_REMOTE_DARKGRAY LCD_REMOTE_BRIGHTNESS(85) | 77 | #define LCD_REMOTE_DARKGRAY LCD_REMOTE_BRIGHTNESS(85) |
@@ -70,7 +79,6 @@ typedef void lcd_remote_blockfunc_type(fb_remote_data *address, unsigned mask, | |||
70 | #define LCD_REMOTE_WHITE LCD_REMOTE_BRIGHTNESS(255) | 79 | #define LCD_REMOTE_WHITE LCD_REMOTE_BRIGHTNESS(255) |
71 | #define LCD_REMOTE_DEFAULT_FG LCD_REMOTE_BLACK | 80 | #define LCD_REMOTE_DEFAULT_FG LCD_REMOTE_BLACK |
72 | #define LCD_REMOTE_DEFAULT_BG LCD_REMOTE_WHITE | 81 | #define LCD_REMOTE_DEFAULT_BG LCD_REMOTE_WHITE |
73 | |||
74 | #endif | 82 | #endif |
75 | 83 | ||
76 | /* Memory copy of display bitmap */ | 84 | /* Memory copy of display bitmap */ |
@@ -91,7 +99,7 @@ extern void lcd_remote_clear_display(void); | |||
91 | extern void lcd_remote_puts(int x, int y, const unsigned char *str); | 99 | extern void lcd_remote_puts(int x, int y, const unsigned char *str); |
92 | extern void lcd_remote_puts_style(int x, int y, const unsigned char *str, | 100 | extern void lcd_remote_puts_style(int x, int y, const unsigned char *str, |
93 | int style); | 101 | int style); |
94 | extern void lcd_remote_puts_offset(int x, int y, const unsigned char *str, | 102 | extern void lcd_remote_puts_offset(int x, int y, const unsigned char *str, |
95 | int offset); | 103 | int offset); |
96 | extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str, | 104 | extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str, |
97 | int style, int offset); | 105 | int style, int offset); |
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 7fe76a5366..4949f51cdb 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h | |||
@@ -151,6 +151,15 @@ typedef void lcd_fastpixelfunc_type(fb_data *address); | |||
151 | 151 | ||
152 | #ifdef HAVE_LCD_BITMAP | 152 | #ifdef HAVE_LCD_BITMAP |
153 | 153 | ||
154 | #if defined(HAVE_LCD_COLOR) && LCD_REMOTE_DEPTH > 1 | ||
155 | /* Just return color for screens use */ | ||
156 | static inline unsigned lcd_color_to_native(unsigned color) | ||
157 | { return color; } | ||
158 | #define SCREEN_COLOR_TO_NATIVE(screen, color) (screen)->color_to_native(color) | ||
159 | #else | ||
160 | #define SCREEN_COLOR_TO_NATIVE(screen, color) (color) | ||
161 | #endif | ||
162 | |||
154 | #ifdef HAVE_LCD_COLOR | 163 | #ifdef HAVE_LCD_COLOR |
155 | #if LCD_DEPTH == 16 | 164 | #if LCD_DEPTH == 16 |
156 | #define LCD_MAX_RED 31 | 165 | #define LCD_MAX_RED 31 |
@@ -169,12 +178,12 @@ typedef void lcd_fastpixelfunc_type(fb_data *address); | |||
169 | |((_RGBPACK((r), (g), (b)) & 0x00ff) << 8)) | 178 | |((_RGBPACK((r), (g), (b)) & 0x00ff) << 8)) |
170 | #define RGB_UNPACK_RED(x) _RGB_UNPACK_RED(swap16(x)) | 179 | #define RGB_UNPACK_RED(x) _RGB_UNPACK_RED(swap16(x)) |
171 | #define RGB_UNPACK_GREEN(x) _RGB_UNPACK_GREEN(swap16(x)) | 180 | #define RGB_UNPACK_GREEN(x) _RGB_UNPACK_GREEN(swap16(x)) |
172 | #define RGB_UNPACK_BLUE(x) _RGB_UNPACK_BLUE(swap16(x)) | 181 | #define RGB_UNPACK_BLUE(x) _RGB_UNPACK_BLUE(swap16(x)) |
173 | #else | 182 | #else |
174 | #define LCD_RGBPACK(r, g, b) _RGBPACK((r), (g), (b)) | 183 | #define LCD_RGBPACK(r, g, b) _RGBPACK((r), (g), (b)) |
175 | #define RGB_UNPACK_RED(x) _RGB_UNPACK_RED(x) | 184 | #define RGB_UNPACK_RED(x) _RGB_UNPACK_RED(x) |
176 | #define RGB_UNPACK_GREEN(x) _RGB_UNPACK_GREEN(x) | 185 | #define RGB_UNPACK_GREEN(x) _RGB_UNPACK_GREEN(x) |
177 | #define RGB_UNPACK_BLUE(x) _RGB_UNPACK_BLUE(x) | 186 | #define RGB_UNPACK_BLUE(x) _RGB_UNPACK_BLUE(x) |
178 | #endif | 187 | #endif |
179 | #elif LCD_DEPTH == 18 | 188 | #elif LCD_DEPTH == 18 |
180 | #define LCD_MAX_RED 63 | 189 | #define LCD_MAX_RED 63 |
@@ -185,7 +194,7 @@ typedef void lcd_fastpixelfunc_type(fb_data *address); | |||
185 | | (((b) * (63*257) + (127*257)) >> 16)) | 194 | | (((b) * (63*257) + (127*257)) >> 16)) |
186 | #else | 195 | #else |
187 | /* other colour depths */ | 196 | /* other colour depths */ |
188 | #endif | 197 | #endif |
189 | 198 | ||
190 | #define LCD_BLACK LCD_RGBPACK(0, 0, 0) | 199 | #define LCD_BLACK LCD_RGBPACK(0, 0, 0) |
191 | #define LCD_DARKGRAY LCD_RGBPACK(85, 85, 85) | 200 | #define LCD_DARKGRAY LCD_RGBPACK(85, 85, 85) |
@@ -220,7 +229,7 @@ extern fb_data lcd_framebuffer[LCD_HEIGHT/4][LCD_WIDTH]; | |||
220 | extern fb_data lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH]; | 229 | extern fb_data lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH]; |
221 | #elif LCD_DEPTH == 18 | 230 | #elif LCD_DEPTH == 18 |
222 | extern fb_data lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH]; | 231 | extern fb_data lcd_framebuffer[LCD_HEIGHT][LCD_WIDTH]; |
223 | #endif | 232 | #endif |
224 | 233 | ||
225 | #ifndef LCD_FBWIDTH | 234 | #ifndef LCD_FBWIDTH |
226 | #define LCD_FBWIDTH LCD_WIDTH | 235 | #define LCD_FBWIDTH LCD_WIDTH |
@@ -273,12 +282,12 @@ extern void lcd_setfont(int font); | |||
273 | extern int lcd_getstringsize(const unsigned char *str, int *w, int *h); | 282 | extern int lcd_getstringsize(const unsigned char *str, int *w, int *h); |
274 | 283 | ||
275 | extern void lcd_puts_offset(int x, int y, const unsigned char *str, int offset); | 284 | extern void lcd_puts_offset(int x, int y, const unsigned char *str, int offset); |
276 | extern void lcd_puts_style_offset(int x, int y, const unsigned char *str, | 285 | extern void lcd_puts_style_offset(int x, int y, const unsigned char *str, |
277 | int style, int offset); | 286 | int style, int offset); |
278 | extern void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, | 287 | extern void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, |
279 | int offset); | 288 | int offset); |
280 | extern void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, | 289 | extern void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, |
281 | int style, int offset); | 290 | int style, int offset); |
282 | 291 | ||
283 | /* low level drawing function pointer arrays */ | 292 | /* low level drawing function pointer arrays */ |
284 | extern lcd_pixelfunc_type* const lcd_pixelfuncs[8]; | 293 | extern lcd_pixelfunc_type* const lcd_pixelfuncs[8]; |
@@ -333,7 +342,7 @@ extern void lcd_bitmap_transparent(const fb_data *src, int x, int y, | |||
333 | #endif /* HAVE_LCD_BITMAP */ | 342 | #endif /* HAVE_LCD_BITMAP */ |
334 | 343 | ||
335 | /* internal usage, but in multiple drivers */ | 344 | /* internal usage, but in multiple drivers */ |
336 | #ifdef HAVE_LCD_BITMAP | 345 | #ifdef HAVE_LCD_BITMAP |
337 | #define SCROLL_SPACING 3 | 346 | #define SCROLL_SPACING 3 |
338 | 347 | ||
339 | struct scrollinfo { | 348 | struct scrollinfo { |