summaryrefslogtreecommitdiffstats
path: root/uisimulator/sdl/lcd-remote-bitmap.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-remote-bitmap.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-remote-bitmap.c')
-rw-r--r--uisimulator/sdl/lcd-remote-bitmap.c47
1 files changed, 33 insertions, 14 deletions
diff --git a/uisimulator/sdl/lcd-remote-bitmap.c b/uisimulator/sdl/lcd-remote-bitmap.c
index d165534e00..f5c2225ab2 100644
--- a/uisimulator/sdl/lcd-remote-bitmap.c
+++ b/uisimulator/sdl/lcd-remote-bitmap.c
@@ -22,20 +22,38 @@
#include "uisdl.h"
#include "lcd-sdl.h"
#include "lcd-remote-bitmap.h"
+#include "misc.h"
SDL_Surface *remote_surface;
-SDL_Color remote_color_zero = {UI_REMOTE_BGCOLOR, 0};
-SDL_Color remote_backlight_color_zero = {UI_REMOTE_BGCOLORLIGHT, 0};
-SDL_Color remote_color_max = {0, 0, 0, 0};
+SDL_Color remote_bl_color_dark = {RED_CMP(LCD_REMOTE_BL_DARKCOLOR),
+ GREEN_CMP(LCD_REMOTE_BL_DARKCOLOR),
+ BLUE_CMP(LCD_REMOTE_BL_DARKCOLOR), 0};
+SDL_Color remote_bl_color_bright = {RED_CMP(LCD_REMOTE_BL_BRIGHTCOLOR),
+ GREEN_CMP(LCD_REMOTE_BL_BRIGHTCOLOR),
+ BLUE_CMP(LCD_REMOTE_BL_BRIGHTCOLOR), 0};
+SDL_Color remote_color_dark = {RED_CMP(LCD_REMOTE_DARKCOLOR),
+ GREEN_CMP(LCD_REMOTE_DARKCOLOR),
+ BLUE_CMP(LCD_REMOTE_DARKCOLOR), 0};
+SDL_Color remote_color_bright = {RED_CMP(LCD_REMOTE_BRIGHTCOLOR),
+ GREEN_CMP(LCD_REMOTE_BRIGHTCOLOR),
+ BLUE_CMP(LCD_REMOTE_BRIGHTCOLOR), 0};
-static unsigned long get_lcd_remote_pixel(int x, int y) {
+#define GRADIENT_MAX 128
+
+#if LCD_REMOTE_DEPTH == 2
+/* Only defined for positive, non-split LCD for now */
+static const unsigned char colorindex[4] = {128, 85, 43, 0};
+#endif
+
+static unsigned long get_lcd_remote_pixel(int x, int y)
+{
#if LCD_REMOTE_DEPTH == 1
- return (lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 1;
+ return lcd_remote_framebuffer[y/8][x] & (1 << (y & 7)) ? 0 : GRADIENT_MAX;
#elif LCD_REMOTE_DEPTH == 2
#if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
unsigned bits = (lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 0x0101;
- return (bits | (bits >> 7)) & 3;
+ return colorindex[(bits | (bits >> 7)) & 3];
#endif
#endif
}
@@ -57,11 +75,11 @@ void lcd_remote_update_rect(int x_start, int y_start, int width, int height)
void sim_remote_backlight(int value)
{
if (value > 0) {
- sdl_set_gradient(remote_surface, &remote_backlight_color_zero,
- &remote_color_max, 0, (1<<LCD_REMOTE_DEPTH));
+ sdl_set_gradient(remote_surface, &remote_bl_color_dark,
+ &remote_bl_color_bright, 0, GRADIENT_MAX+1);
} else {
- sdl_set_gradient(remote_surface, &remote_color_zero, &remote_color_max,
- 0, (1<<LCD_REMOTE_DEPTH));
+ sdl_set_gradient(remote_surface, &remote_color_dark,
+ &remote_color_bright, 0, GRADIENT_MAX+1);
}
sdl_gui_update(remote_surface, 0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT,
@@ -74,10 +92,11 @@ void sim_remote_backlight(int value)
void sim_lcd_remote_init(void)
{
remote_surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
- LCD_REMOTE_WIDTH * display_zoom, LCD_REMOTE_HEIGHT * display_zoom,
- 8, 0, 0, 0, 0);
+ LCD_REMOTE_WIDTH * display_zoom,
+ LCD_REMOTE_HEIGHT * display_zoom,
+ 8, 0, 0, 0, 0);
- sdl_set_gradient(remote_surface, &remote_backlight_color_zero,
- &remote_color_max, 0, (1<<LCD_REMOTE_DEPTH));
+ sdl_set_gradient(remote_surface, &remote_bl_color_dark,
+ &remote_bl_color_bright, 0, GRADIENT_MAX+1);
}