summaryrefslogtreecommitdiff
path: root/uisimulator/sdl/lcd-charcells.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2009-02-09 00:32:59 +0000
committerJens Arnold <amiconn@rockbox.org>2009-02-09 00:32:59 +0000
commit0d935ce75e1408dfd9832ae7dbb7d84df50a645d (patch)
tree9ddcc5d21dcd0e576d0fa824e74c58755fa9d1a0 /uisimulator/sdl/lcd-charcells.c
parent94537f954e67d44fdd9703c062c4ee53599e0e74 (diff)
downloadrockbox-0d935ce75e1408dfd9832ae7dbb7d84df50a645d.tar.gz
rockbox-0d935ce75e1408dfd9832ae7dbb7d84df50a645d.zip
Put the display colours for monochrome and greyscale targets into the target config files, and use them both for the simulator UI and screendumps. The Clip now shows the split display properly in screendumps and simulator. A side effect is that screendumps of ordinary monochrome targets are now 4-bit BMP files (saves an alternate code path, and might be more compatible with some gfx programs). * Simplify the simulation of split display, and also simplify greylib simulation. The simulator now always calculates 129 shades (2*128 for a Clip sim), and just uses 2 (or 4) of those for native display simulation. * Centralised the simulator LCD dimension definition.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19950 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/sdl/lcd-charcells.c')
-rw-r--r--uisimulator/sdl/lcd-charcells.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/uisimulator/sdl/lcd-charcells.c b/uisimulator/sdl/lcd-charcells.c
index 6f09858717..19d27d5152 100644
--- a/uisimulator/sdl/lcd-charcells.c
+++ b/uisimulator/sdl/lcd-charcells.c
@@ -35,10 +35,19 @@
35extern int sim_creat(const char *name); 35extern int sim_creat(const char *name);
36 36
37SDL_Surface* lcd_surface; 37SDL_Surface* lcd_surface;
38SDL_Color lcd_color_zero = {UI_LCD_BGCOLOR, 0}; 38
39SDL_Color lcd_backlight_color_zero = {UI_LCD_BGCOLORLIGHT, 0}; 39SDL_Color lcd_bl_color_dark = {RED_CMP(LCD_BL_DARKCOLOR),
40SDL_Color lcd_color_max = {UI_LCD_FGCOLOR, 0}; 40 GREEN_CMP(LCD_BL_DARKCOLOR),
41SDL_Color lcd_backlight_color_max = {UI_LCD_FGCOLORLIGHT, 0}; 41 BLUE_CMP(LCD_BL_DARKCOLOR), 0};
42SDL_Color lcd_bl_color_bright = {RED_CMP(LCD_BL_BRIGHTCOLOR),
43 GREEN_CMP(LCD_BL_BRIGHTCOLOR),
44 BLUE_CMP(LCD_BL_BRIGHTCOLOR), 0};
45SDL_Color lcd_color_dark = {RED_CMP(LCD_DARKCOLOR),
46 GREEN_CMP(LCD_DARKCOLOR),
47 BLUE_CMP(LCD_DARKCOLOR), 0};
48SDL_Color lcd_color_bright = {RED_CMP(LCD_BRIGHTCOLOR),
49 GREEN_CMP(LCD_BRIGHTCOLOR),
50 BLUE_CMP(LCD_BRIGHTCOLOR), 0};
42 51
43 52
44static unsigned long get_lcd_pixel(int x, int y) 53static unsigned long get_lcd_pixel(int x, int y)
@@ -78,12 +87,11 @@ void lcd_update(void)
78void sim_backlight(int value) 87void sim_backlight(int value)
79{ 88{
80 if (value > 0) { 89 if (value > 0) {
81 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero, 90 sdl_set_gradient(lcd_surface, &lcd_bl_color_bright,
82 &lcd_backlight_color_max, 91 &lcd_bl_color_dark, 0, (1<<LCD_DEPTH));
83 0, (1<<LCD_DEPTH));
84 } else { 92 } else {
85 sdl_set_gradient(lcd_surface, &lcd_color_zero, &lcd_color_max, 93 sdl_set_gradient(lcd_surface, &lcd_color_bright,
86 0, (1<<LCD_DEPTH)); 94 &lcd_color_dark, 0, (1<<LCD_DEPTH));
87 } 95 }
88 96
89 sim_lcd_update_rect(0, 0, SIM_LCD_WIDTH, SIM_LCD_HEIGHT); 97 sim_lcd_update_rect(0, 0, SIM_LCD_WIDTH, SIM_LCD_HEIGHT);
@@ -98,8 +106,8 @@ void sim_lcd_init(void)
98 SIM_LCD_HEIGHT * display_zoom, 106 SIM_LCD_HEIGHT * display_zoom,
99 8, 0, 0, 0, 0); 107 8, 0, 0, 0, 0);
100 108
101 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero, &lcd_color_max, 109 sdl_set_gradient(lcd_surface, &lcd_bl_color_bright,
102 0, (1<<LCD_DEPTH)); 110 &lcd_bl_color_dark, 0, (1<<LCD_DEPTH));
103} 111}
104 112
105#define BMP_COMPRESSION 0 /* BI_RGB */ 113#define BMP_COMPRESSION 0 /* BI_RGB */
@@ -133,8 +141,8 @@ static const unsigned char bmpheader[] =
133 LE32_CONST(BMP_NUMCOLORS), /* Number of used colours */ 141 LE32_CONST(BMP_NUMCOLORS), /* Number of used colours */
134 LE32_CONST(BMP_NUMCOLORS), /* Number of important colours */ 142 LE32_CONST(BMP_NUMCOLORS), /* Number of important colours */
135 143
136 0x90, 0xee, 0x90, 0x00, /* Colour #0 */ 144 BMP_COLOR(LCD_BL_BRIGHTCOLOR),
137 0x00, 0x00, 0x00, 0x00 /* Colour #1 */ 145 BMP_COLOR(LCD_BL_DARKCOLOR)
138}; 146};
139 147
140void screen_dump(void) 148void screen_dump(void)