summaryrefslogtreecommitdiff
path: root/uisimulator
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-03-26 07:52:13 +0000
committerJens Arnold <amiconn@rockbox.org>2007-03-26 07:52:13 +0000
commitad4e3d665734b14a28f1ba5fa874663772dab3e7 (patch)
treebff44652495f1319a4d11ed63b3d4e90cb11197f /uisimulator
parent165f62d0cd771660e4b8d2ba7475e14d0d6f2e9f (diff)
downloadrockbox-ad4e3d665734b14a28f1ba5fa874663772dab3e7.tar.gz
rockbox-ad4e3d665734b14a28f1ba5fa874663772dab3e7.zip
First step of charcell LCD code rework: * Make it fully unicode aware so that adding non-ISO8859-1 scripts becomes possible (limited by the LCD capabilities of course). * Make the API more similar to the bitmap LCD code's API. * Moved hardware dependent parts to target tree. * Simplified code. * Jumpscroll temporarily non-functional.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12916 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/common/lcd-playersim.c9
-rw-r--r--uisimulator/sdl/lcd-charcell.c20
2 files changed, 15 insertions, 14 deletions
diff --git a/uisimulator/common/lcd-playersim.c b/uisimulator/common/lcd-playersim.c
index 0e10acf437..4c658438d6 100644
--- a/uisimulator/common/lcd-playersim.c
+++ b/uisimulator/common/lcd-playersim.c
@@ -51,8 +51,8 @@ void lcd_print_icon(int x, int icon_line, bool enable, char **icon)
51 int row=0, col; 51 int row=0, col;
52 52
53 int p=0, cp=0; 53 int p=0, cp=0;
54 struct coordinate points[LCD_WIDTH * LCD_HEIGHT]; 54 struct coordinate points[SIM_LCD_WIDTH * SIM_LCD_HEIGHT];
55 struct coordinate clearpoints[LCD_WIDTH * LCD_HEIGHT]; 55 struct coordinate clearpoints[SIM_LCD_WIDTH * SIM_LCD_HEIGHT];
56 56
57 while (icon[row]) { 57 while (icon[row]) {
58 col=0; 58 col=0;
@@ -221,16 +221,15 @@ void lcd_double_height(bool on)
221 lcd_update(); 221 lcd_update();
222} 222}
223 223
224void lcd_define_hw_pattern(int which, const char *pattern, int length) 224void lcd_define_hw_pattern(int pat, const char *pattern)
225{ 225{
226 int i, j; 226 int i, j;
227 int pat = which / 8;
228 unsigned char icon[8]; 227 unsigned char icon[8];
229 memset(icon, 0, sizeof icon); 228 memset(icon, 0, sizeof icon);
230 229
231 DEBUGF("Defining pattern %d:", pat); 230 DEBUGF("Defining pattern %d:", pat);
232 for (j = 0; j <= 5; j++) { 231 for (j = 0; j <= 5; j++) {
233 for (i = 0; i < length; i++) { 232 for (i = 0; i < 7; i++) {
234 if ((pattern[i])&(1<<(j))) 233 if ((pattern[i])&(1<<(j)))
235 icon[5-j] |= (1<<(i)); 234 icon[5-j] |= (1<<(i));
236 } 235 }
diff --git a/uisimulator/sdl/lcd-charcell.c b/uisimulator/sdl/lcd-charcell.c
index cb31d6349b..8849efc7cd 100644
--- a/uisimulator/sdl/lcd-charcell.c
+++ b/uisimulator/sdl/lcd-charcell.c
@@ -132,8 +132,10 @@ void sim_backlight(int value)
132/* initialise simulator lcd driver */ 132/* initialise simulator lcd driver */
133void sim_lcd_init(void) 133void sim_lcd_init(void)
134{ 134{
135 lcd_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, LCD_WIDTH * display_zoom, 135 lcd_surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
136 LCD_HEIGHT * display_zoom, 8, 0, 0, 0, 0); 136 SIM_LCD_WIDTH * display_zoom,
137 SIM_LCD_HEIGHT * display_zoom,
138 8, 0, 0, 0, 0);
137 139
138 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero, &lcd_color_max, 140 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero, &lcd_color_max,
139 0, (1<<LCD_DEPTH)); 141 0, (1<<LCD_DEPTH));
@@ -142,10 +144,10 @@ void sim_lcd_init(void)
142#define BMP_COMPRESSION 0 /* BI_RGB */ 144#define BMP_COMPRESSION 0 /* BI_RGB */
143#define BMP_NUMCOLORS (1 << LCD_DEPTH) 145#define BMP_NUMCOLORS (1 << LCD_DEPTH)
144#define BMP_BPP 1 146#define BMP_BPP 1
145#define BMP_LINESIZE (((LCD_WIDTH + 31) / 32) * 4) 147#define BMP_LINESIZE (((SIM_LCD_WIDTH + 31) / 32) * 4)
146 148
147#define BMP_HEADERSIZE (54 + 4 * BMP_NUMCOLORS) 149#define BMP_HEADERSIZE (54 + 4 * BMP_NUMCOLORS)
148#define BMP_DATASIZE (BMP_LINESIZE * LCD_HEIGHT) 150#define BMP_DATASIZE (BMP_LINESIZE * SIM_LCD_HEIGHT)
149#define BMP_TOTALSIZE (BMP_HEADERSIZE + BMP_DATASIZE) 151#define BMP_TOTALSIZE (BMP_HEADERSIZE + BMP_DATASIZE)
150 152
151#define LE16_CONST(x) (x)&0xff, ((x)>>8)&0xff 153#define LE16_CONST(x) (x)&0xff, ((x)>>8)&0xff
@@ -159,8 +161,8 @@ static const unsigned char bmpheader[] =
159 LE32_CONST(BMP_HEADERSIZE), /* Offset to start of pixel data */ 161 LE32_CONST(BMP_HEADERSIZE), /* Offset to start of pixel data */
160 162
161 0x28, 0x00, 0x00, 0x00, /* Size of (2nd) header */ 163 0x28, 0x00, 0x00, 0x00, /* Size of (2nd) header */
162 LE32_CONST(LCD_WIDTH), /* Width in pixels */ 164 LE32_CONST(SIM_LCD_WIDTH), /* Width in pixels */
163 LE32_CONST(LCD_HEIGHT), /* Height in pixels */ 165 LE32_CONST(SIM_LCD_HEIGHT), /* Height in pixels */
164 0x01, 0x00, /* Number of planes (always 1) */ 166 0x01, 0x00, /* Number of planes (always 1) */
165 LE16_CONST(BMP_BPP), /* Bits per pixel 1/4/8/16/24 */ 167 LE16_CONST(BMP_BPP), /* Bits per pixel 1/4/8/16/24 */
166 LE32_CONST(BMP_COMPRESSION),/* Compression mode */ 168 LE32_CONST(BMP_COMPRESSION),/* Compression mode */
@@ -193,15 +195,15 @@ void screen_dump(void)
193 SDL_LockSurface(lcd_surface); 195 SDL_LockSurface(lcd_surface);
194 196
195 /* BMP image goes bottom up */ 197 /* BMP image goes bottom up */
196 for (y = LCD_HEIGHT - 1; y >= 0; y--) 198 for (y = SIM_LCD_HEIGHT - 1; y >= 0; y--)
197 { 199 {
198 Uint8 *src = (Uint8 *)lcd_surface->pixels 200 Uint8 *src = (Uint8 *)lcd_surface->pixels
199 + y * LCD_WIDTH * display_zoom * display_zoom; 201 + y * SIM_LCD_WIDTH * display_zoom * display_zoom;
200 unsigned char *dst = line; 202 unsigned char *dst = line;
201 unsigned dst_mask = 0x80; 203 unsigned dst_mask = 0x80;
202 204
203 memset(line, 0, sizeof(line)); 205 memset(line, 0, sizeof(line));
204 for (x = LCD_WIDTH; x > 0; x--) 206 for (x = SIM_LCD_WIDTH; x > 0; x--)
205 { 207 {
206 if (*src) 208 if (*src)
207 *dst |= dst_mask; 209 *dst |= dst_mask;