diff options
Diffstat (limited to 'firmware/target/hosted/sdl')
-rw-r--r-- | firmware/target/hosted/sdl/button-sdl.c | 1 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/lcd-charcells.c | 206 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/lcd-charcells.h | 34 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/system-sdl.c | 2 |
4 files changed, 0 insertions, 243 deletions
diff --git a/firmware/target/hosted/sdl/button-sdl.c b/firmware/target/hosted/sdl/button-sdl.c index 8c716bc7b9..beb84ee77f 100644 --- a/firmware/target/hosted/sdl/button-sdl.c +++ b/firmware/target/hosted/sdl/button-sdl.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <math.h> | 22 | #include <math.h> |
23 | #include <stdlib.h> /* EXIT_SUCCESS */ | 23 | #include <stdlib.h> /* EXIT_SUCCESS */ |
24 | #include "sim-ui-defines.h" | 24 | #include "sim-ui-defines.h" |
25 | #include "lcd-charcells.h" | ||
26 | #ifdef HAVE_REMOTE_LCD | 25 | #ifdef HAVE_REMOTE_LCD |
27 | #include "lcd-remote.h" | 26 | #include "lcd-remote.h" |
28 | #endif | 27 | #endif |
diff --git a/firmware/target/hosted/sdl/lcd-charcells.c b/firmware/target/hosted/sdl/lcd-charcells.c deleted file mode 100644 index 1020e7269a..0000000000 --- a/firmware/target/hosted/sdl/lcd-charcells.c +++ /dev/null | |||
@@ -1,206 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 Dan Everton | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include <string.h> | ||
23 | #include <unistd.h> | ||
24 | #include <fcntl.h> | ||
25 | #include "system.h" | ||
26 | #include "debug.h" | ||
27 | #include "lcd.h" | ||
28 | #include "lcd-charcell.h" | ||
29 | #include "screendump.h" | ||
30 | #include "general.h" | ||
31 | |||
32 | #include "lcd-playersim.h" | ||
33 | #include "sim-ui-defines.h" | ||
34 | #include "lcd-sdl.h" | ||
35 | |||
36 | /* can't include file.h here */ | ||
37 | #ifndef MAX_PATH | ||
38 | #define MAX_PATH 260 | ||
39 | #endif | ||
40 | |||
41 | /* extern functions, needed for screendump() */ | ||
42 | extern int sim_creat(const char *name, mode_t mode); | ||
43 | |||
44 | SDL_Surface* lcd_surface; | ||
45 | |||
46 | SDL_Color lcd_bl_color_dark = {RED_CMP(LCD_BL_DARKCOLOR), | ||
47 | GREEN_CMP(LCD_BL_DARKCOLOR), | ||
48 | BLUE_CMP(LCD_BL_DARKCOLOR), 0}; | ||
49 | SDL_Color lcd_bl_color_bright = {RED_CMP(LCD_BL_BRIGHTCOLOR), | ||
50 | GREEN_CMP(LCD_BL_BRIGHTCOLOR), | ||
51 | BLUE_CMP(LCD_BL_BRIGHTCOLOR), 0}; | ||
52 | SDL_Color lcd_color_dark = {RED_CMP(LCD_DARKCOLOR), | ||
53 | GREEN_CMP(LCD_DARKCOLOR), | ||
54 | BLUE_CMP(LCD_DARKCOLOR), 0}; | ||
55 | SDL_Color lcd_color_bright = {RED_CMP(LCD_BRIGHTCOLOR), | ||
56 | GREEN_CMP(LCD_BRIGHTCOLOR), | ||
57 | BLUE_CMP(LCD_BRIGHTCOLOR), 0}; | ||
58 | |||
59 | |||
60 | static unsigned long get_lcd_pixel(int x, int y) | ||
61 | { | ||
62 | return sim_lcd_framebuffer[y][x]; | ||
63 | } | ||
64 | |||
65 | void sim_lcd_update_rect(int x_start, int y_start, int width, int height) | ||
66 | { | ||
67 | sdl_update_rect(lcd_surface, x_start, y_start, width, height, | ||
68 | SIM_LCD_WIDTH, SIM_LCD_HEIGHT, get_lcd_pixel); | ||
69 | sdl_gui_update(lcd_surface, x_start, y_start, width, height, | ||
70 | SIM_LCD_WIDTH, SIM_LCD_HEIGHT, | ||
71 | background ? UI_LCD_POSX : 0, background ? UI_LCD_POSY : 0); | ||
72 | } | ||
73 | |||
74 | void lcd_update(void) | ||
75 | { | ||
76 | int x, y; | ||
77 | |||
78 | for (y = 0; y < lcd_pattern_count; y++) | ||
79 | if (lcd_patterns[y].count > 0) | ||
80 | sim_lcd_define_pattern(y, lcd_patterns[y].pattern); | ||
81 | |||
82 | for (y = 0; y < LCD_HEIGHT; y++) | ||
83 | for (x = 0; x < LCD_WIDTH; x++) | ||
84 | lcd_print_char(x, y, lcd_charbuffer[y][x]); | ||
85 | |||
86 | if (lcd_cursor.visible) | ||
87 | lcd_print_char(lcd_cursor.x, lcd_cursor.y, lcd_cursor.hw_char); | ||
88 | |||
89 | sim_lcd_update_rect(0, ICON_HEIGHT, SIM_LCD_WIDTH, | ||
90 | LCD_HEIGHT*CHAR_HEIGHT*CHAR_PIXEL); | ||
91 | } | ||
92 | |||
93 | #ifdef HAVE_BACKLIGHT | ||
94 | void sim_backlight(int value) | ||
95 | { | ||
96 | if (value > 0) { | ||
97 | sdl_set_gradient(lcd_surface, &lcd_bl_color_bright, | ||
98 | &lcd_bl_color_dark, 0, (1<<LCD_DEPTH)); | ||
99 | } else { | ||
100 | sdl_set_gradient(lcd_surface, &lcd_color_bright, | ||
101 | &lcd_color_dark, 0, (1<<LCD_DEPTH)); | ||
102 | } | ||
103 | |||
104 | sim_lcd_update_rect(0, 0, SIM_LCD_WIDTH, SIM_LCD_HEIGHT); | ||
105 | } | ||
106 | #endif | ||
107 | |||
108 | /* initialise simulator lcd driver */ | ||
109 | void lcd_init_device(void) | ||
110 | { | ||
111 | lcd_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, | ||
112 | SIM_LCD_WIDTH * display_zoom, | ||
113 | SIM_LCD_HEIGHT * display_zoom, | ||
114 | 8, 0, 0, 0, 0); | ||
115 | |||
116 | sdl_set_gradient(lcd_surface, &lcd_bl_color_bright, | ||
117 | &lcd_bl_color_dark, 0, (1<<LCD_DEPTH)); | ||
118 | } | ||
119 | |||
120 | #define BMP_COMPRESSION 0 /* BI_RGB */ | ||
121 | #define BMP_NUMCOLORS (1 << LCD_DEPTH) | ||
122 | #define BMP_BPP 1 | ||
123 | #define BMP_LINESIZE (((SIM_LCD_WIDTH + 31) / 32) * 4) | ||
124 | |||
125 | #define BMP_HEADERSIZE (54 + 4 * BMP_NUMCOLORS) | ||
126 | #define BMP_DATASIZE (BMP_LINESIZE * SIM_LCD_HEIGHT) | ||
127 | #define BMP_TOTALSIZE (BMP_HEADERSIZE + BMP_DATASIZE) | ||
128 | |||
129 | #define LE16_CONST(x) (x)&0xff, ((x)>>8)&0xff | ||
130 | #define LE32_CONST(x) (x)&0xff, ((x)>>8)&0xff, ((x)>>16)&0xff, ((x)>>24)&0xff | ||
131 | |||
132 | static const unsigned char bmpheader[] = | ||
133 | { | ||
134 | 0x42, 0x4d, /* 'BM' */ | ||
135 | LE32_CONST(BMP_TOTALSIZE), /* Total file size */ | ||
136 | 0x00, 0x00, 0x00, 0x00, /* Reserved */ | ||
137 | LE32_CONST(BMP_HEADERSIZE), /* Offset to start of pixel data */ | ||
138 | |||
139 | 0x28, 0x00, 0x00, 0x00, /* Size of (2nd) header */ | ||
140 | LE32_CONST(SIM_LCD_WIDTH), /* Width in pixels */ | ||
141 | LE32_CONST(SIM_LCD_HEIGHT), /* Height in pixels */ | ||
142 | 0x01, 0x00, /* Number of planes (always 1) */ | ||
143 | LE16_CONST(BMP_BPP), /* Bits per pixel 1/4/8/16/24 */ | ||
144 | LE32_CONST(BMP_COMPRESSION),/* Compression mode */ | ||
145 | LE32_CONST(BMP_DATASIZE), /* Size of bitmap data */ | ||
146 | 0xc4, 0x0e, 0x00, 0x00, /* Horizontal resolution (pixels/meter) */ | ||
147 | 0xc4, 0x0e, 0x00, 0x00, /* Vertical resolution (pixels/meter) */ | ||
148 | LE32_CONST(BMP_NUMCOLORS), /* Number of used colours */ | ||
149 | LE32_CONST(BMP_NUMCOLORS), /* Number of important colours */ | ||
150 | |||
151 | BMP_COLOR(LCD_BL_BRIGHTCOLOR), | ||
152 | BMP_COLOR(LCD_BL_DARKCOLOR) | ||
153 | }; | ||
154 | |||
155 | void screen_dump(void) | ||
156 | { | ||
157 | int fd; | ||
158 | char filename[MAX_PATH]; | ||
159 | int x, y; | ||
160 | static unsigned char line[BMP_LINESIZE]; | ||
161 | |||
162 | create_numbered_filename(filename, "", "dump_", ".bmp", 4 | ||
163 | IF_CNFN_NUM_(, NULL)); | ||
164 | DEBUGF("screen_dump\n"); | ||
165 | |||
166 | fd = sim_creat(filename, 0666); | ||
167 | if (fd < 0) | ||
168 | return; | ||
169 | |||
170 | if(write(fd, bmpheader, sizeof(bmpheader)) != sizeof(bmpheader)) | ||
171 | { | ||
172 | close(fd); | ||
173 | return; | ||
174 | } | ||
175 | SDL_LockSurface(lcd_surface); | ||
176 | |||
177 | /* BMP image goes bottom up */ | ||
178 | for (y = SIM_LCD_HEIGHT - 1; y >= 0; y--) | ||
179 | { | ||
180 | Uint8 *src = (Uint8 *)lcd_surface->pixels | ||
181 | + y * SIM_LCD_WIDTH * (int)display_zoom * (int)display_zoom; | ||
182 | unsigned char *dst = line; | ||
183 | unsigned dst_mask = 0x80; | ||
184 | |||
185 | memset(line, 0, sizeof(line)); | ||
186 | for (x = SIM_LCD_WIDTH; x > 0; x--) | ||
187 | { | ||
188 | if (*src) | ||
189 | *dst |= dst_mask; | ||
190 | src += (int)display_zoom; | ||
191 | dst_mask >>= 1; | ||
192 | if (dst_mask == 0) | ||
193 | { | ||
194 | dst++; | ||
195 | dst_mask = 0x80; | ||
196 | } | ||
197 | } | ||
198 | if(write(fd, line, sizeof(line)) != sizeof(line)) | ||
199 | { | ||
200 | close(fd); | ||
201 | return; | ||
202 | } | ||
203 | } | ||
204 | SDL_UnlockSurface(lcd_surface); | ||
205 | close(fd); | ||
206 | } | ||
diff --git a/firmware/target/hosted/sdl/lcd-charcells.h b/firmware/target/hosted/sdl/lcd-charcells.h deleted file mode 100644 index 890594f766..0000000000 --- a/firmware/target/hosted/sdl/lcd-charcells.h +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 Dan Everton | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #ifndef __LCDCHARCELL_H__ | ||
23 | #define __LCDCHARCELL_H__ | ||
24 | |||
25 | #include "lcd.h" | ||
26 | #include "SDL.h" | ||
27 | |||
28 | #ifdef HAVE_LCD_CHARCELLS | ||
29 | void sim_lcd_init(void); | ||
30 | void screen_dump(void); | ||
31 | #endif | ||
32 | |||
33 | #endif /* #ifndef __LCDCHARCELL_H__ */ | ||
34 | |||
diff --git a/firmware/target/hosted/sdl/system-sdl.c b/firmware/target/hosted/sdl/system-sdl.c index 37580ede7d..6aaab6e8a5 100644 --- a/firmware/target/hosted/sdl/system-sdl.c +++ b/firmware/target/hosted/sdl/system-sdl.c | |||
@@ -35,8 +35,6 @@ | |||
35 | #include "lcd-sdl.h" | 35 | #include "lcd-sdl.h" |
36 | #ifdef HAVE_LCD_BITMAP | 36 | #ifdef HAVE_LCD_BITMAP |
37 | #include "lcd-bitmap.h" | 37 | #include "lcd-bitmap.h" |
38 | #elif defined(HAVE_LCD_CHARCELLS) | ||
39 | #include "lcd-charcells.h" | ||
40 | #endif | 38 | #endif |
41 | #ifdef HAVE_REMOTE_LCD | 39 | #ifdef HAVE_REMOTE_LCD |
42 | #include "lcd-remote-bitmap.h" | 40 | #include "lcd-remote-bitmap.h" |