summaryrefslogtreecommitdiff
path: root/uisimulator/sdl/lcd-bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator/sdl/lcd-bitmap.c')
-rw-r--r--uisimulator/sdl/lcd-bitmap.c104
1 files changed, 80 insertions, 24 deletions
diff --git a/uisimulator/sdl/lcd-bitmap.c b/uisimulator/sdl/lcd-bitmap.c
index 92480396bc..b9f5732dc7 100644
--- a/uisimulator/sdl/lcd-bitmap.c
+++ b/uisimulator/sdl/lcd-bitmap.c
@@ -24,15 +24,24 @@
24#include "lcd-sdl.h" 24#include "lcd-sdl.h"
25 25
26SDL_Surface* lcd_surface; 26SDL_Surface* lcd_surface;
27#ifdef UI_LCD_SPLIT
28SDL_Surface* lcd_real_surface; /* the surface which represents the real screen */
29#endif
27int lcd_backlight_val; 30int lcd_backlight_val;
28 31
29#if LCD_DEPTH <= 8 32#if LCD_DEPTH <= 8
30#ifdef HAVE_BACKLIGHT 33#ifdef HAVE_BACKLIGHT
31SDL_Color lcd_backlight_color_zero = {UI_LCD_BGCOLORLIGHT, 0}; 34SDL_Color lcd_backlight_color_zero = {UI_LCD_BGCOLORLIGHT, 0};
32SDL_Color lcd_backlight_color_max = {UI_LCD_FGCOLORLIGHT, 0}; 35SDL_Color lcd_backlight_color_max = {UI_LCD_FGCOLORLIGHT, 0};
36#ifdef UI_LCD_SPLIT
37SDL_Color lcd_backlight_color_split= {UI_LCD_SPLIT_FGCOLORLIGHT, 0};
38#endif
33#endif 39#endif
34SDL_Color lcd_color_zero = {UI_LCD_BGCOLOR, 0}; 40SDL_Color lcd_color_zero = {UI_LCD_BGCOLOR, 0};
35SDL_Color lcd_color_max = {UI_LCD_FGCOLOR, 0}; 41SDL_Color lcd_color_max = {UI_LCD_FGCOLOR, 0};
42#ifdef UI_LCD_SPLIT
43SDL_Color lcd_color_split= {UI_LCD_SPLIT_FGCOLOR, 0};
44#endif
36#endif 45#endif
37 46
38#if LCD_DEPTH < 8 47#if LCD_DEPTH < 8
@@ -73,8 +82,9 @@ void lcd_update_rect(int x_start, int y_start, int width, int height)
73{ 82{
74 sdl_update_rect(lcd_surface, x_start, y_start, width, height, LCD_WIDTH, 83 sdl_update_rect(lcd_surface, x_start, y_start, width, height, LCD_WIDTH,
75 LCD_HEIGHT, get_lcd_pixel); 84 LCD_HEIGHT, get_lcd_pixel);
76 sdl_gui_update(lcd_surface, x_start, y_start, width, height, LCD_WIDTH, 85 sdl_gui_update(lcd_surface, IFSPLIT(lcd_real_surface,) x_start, y_start,
77 LCD_HEIGHT, background ? UI_LCD_POSX : 0, background? UI_LCD_POSY : 0); 86 width, height, LCD_WIDTH, LCD_HEIGHT,
87 background ? UI_LCD_POSX : 0, background? UI_LCD_POSY : 0);
78} 88}
79 89
80#ifdef HAVE_BACKLIGHT 90#ifdef HAVE_BACKLIGHT
@@ -84,27 +94,51 @@ void sim_backlight(int value)
84 94
85#if LCD_DEPTH <= 8 95#if LCD_DEPTH <= 8
86 if (value > 0) { 96 if (value > 0) {
97#ifdef UI_LCD_SPLIT
98 sdl_set_gradient(lcd_real_surface, &lcd_backlight_color_zero,
99 &lcd_backlight_color_max, &lcd_backlight_color_zero,
100 &lcd_backlight_color_split, 0, (1<<LCD_DEPTH));
101#else
87 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero, 102 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero,
88 &lcd_backlight_color_max, 0, (1<<LCD_DEPTH)); 103 &lcd_backlight_color_max, 0, (1<<LCD_DEPTH));
104#endif
89 } else { 105 } else {
90 sdl_set_gradient(lcd_surface, &lcd_color_zero, &lcd_color_max, 106#ifdef UI_LCD_SPLIT
91 0, (1<<LCD_DEPTH)); 107 sdl_set_gradient(lcd_real_surface, &lcd_color_zero, &lcd_color_max,
108 &lcd_color_zero, &lcd_color_split, 0, (1<<LCD_DEPTH));
109#else
110 sdl_set_gradient(lcd_surface, &lcd_color_zero, &lcd_color_max, 0,
111 (1<<LCD_DEPTH));
112#endif
92 } 113 }
93#if LCD_DEPTH < 8 114#if LCD_DEPTH < 8
94 if (lcd_ex_shades) { 115 if (lcd_ex_shades) {
95 if (value > 0) { 116 if (value > 0) {
117#ifdef UI_LCD_SPLIT
118 sdl_set_gradient(lcd_real_surface, &lcd_backlight_color_max,
119 &lcd_backlight_color_zero, &lcd_backlight_color_split,
120 &lcd_backlight_color_zero,
121 (1<<LCD_DEPTH), lcd_ex_shades);
122#else
96 sdl_set_gradient(lcd_surface, &lcd_backlight_color_max, 123 sdl_set_gradient(lcd_surface, &lcd_backlight_color_max,
97 &lcd_backlight_color_zero, (1<<LCD_DEPTH), 124 &lcd_backlight_color_zero, (1<<LCD_DEPTH), lcd_ex_shades);
98 lcd_ex_shades); 125#endif
99 } else { 126 } else {
127#ifdef UI_LCD_SPLIT
128 sdl_set_gradient(lcd_real_surface, &lcd_color_max, &lcd_color_zero,
129 &lcd_color_split, &lcd_color_zero, (1<<LCD_DEPTH),
130 lcd_ex_shades);
131#else
100 sdl_set_gradient(lcd_surface, &lcd_color_max, &lcd_color_zero, 132 sdl_set_gradient(lcd_surface, &lcd_color_max, &lcd_color_zero,
101 (1<<LCD_DEPTH), lcd_ex_shades); 133 (1<<LCD_DEPTH), lcd_ex_shades);
134#endif
102 } 135 }
103 } 136 }
104#endif 137#endif
105 138
106 sdl_gui_update(lcd_surface, 0, 0, LCD_WIDTH, LCD_HEIGHT, LCD_WIDTH, 139 sdl_gui_update(lcd_surface, IFSPLIT(lcd_real_surface,) 0, 0, LCD_WIDTH,
107 LCD_HEIGHT, background ? UI_LCD_POSX : 0, background? UI_LCD_POSY : 0); 140 LCD_HEIGHT, LCD_WIDTH, LCD_HEIGHT,
141 background ? UI_LCD_POSX : 0, background? UI_LCD_POSY : 0);
108 142
109#endif 143#endif
110} 144}
@@ -119,15 +153,26 @@ void sim_lcd_init(void)
119#else 153#else
120 lcd_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, LCD_WIDTH * display_zoom, 154 lcd_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, LCD_WIDTH * display_zoom,
121 LCD_HEIGHT * display_zoom, 8, 0, 0, 0, 0); 155 LCD_HEIGHT * display_zoom, 8, 0, 0, 0, 0);
156#ifdef UI_LCD_SPLIT
157 lcd_real_surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
158 LCD_WIDTH * display_zoom,
159 (LCD_HEIGHT+UI_LCD_SPLIT_BLACK_LINES) * display_zoom, 8, 0, 0, 0, 0);
160#endif
122#endif 161#endif
123 162
124#if LCD_DEPTH <= 8 163#if LCD_DEPTH <= 8
125#ifdef HAVE_BACKLIGHT 164#ifdef HAVE_BACKLIGHT
126 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero, &lcd_color_max, 165#ifdef UI_LCD_SPLIT
127 0, (1<<LCD_DEPTH)); 166 sdl_set_gradient(lcd_real_surface, &lcd_backlight_color_zero,
167 &lcd_color_max, &lcd_backlight_color_zero,
168 &lcd_color_split, 0, (1<<LCD_DEPTH));
169#else
170 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero, &lcd_color_max, 0,
171 (1<<LCD_DEPTH));
172#endif
128#else 173#else
129 sdl_set_gradient(lcd_surface, &lcd_color_zero, &lcd_color_max, 0, 174 sdl_set_gradient(lcd_surface, &lcd_color_zero, &lcd_color_max, 0,
130 (1<<LCD_DEPTH)); 175 (1<<LCD_DEPTH));
131#endif 176#endif
132#endif 177#endif
133} 178}
@@ -140,15 +185,25 @@ void sim_lcd_ex_init(int shades, unsigned long (*getpixel)(int, int))
140 if (shades) { 185 if (shades) {
141#ifdef HAVE_BACKLIGHT 186#ifdef HAVE_BACKLIGHT
142 if (lcd_backlight_val > 0) { 187 if (lcd_backlight_val > 0) {
188#ifdef UI_LCD_SPLIT
189 sdl_set_gradient(lcd_real_surface, &lcd_color_max,
190 &lcd_backlight_color_zero, &lcd_color_split,
191 &lcd_backlight_color_zero, (1<<LCD_DEPTH), shades);
192#else
143 sdl_set_gradient(lcd_surface, &lcd_color_max, 193 sdl_set_gradient(lcd_surface, &lcd_color_max,
144 &lcd_backlight_color_zero, (1<<LCD_DEPTH), 194 &lcd_backlight_color_zero, (1<<LCD_DEPTH), shades);
145 shades); 195#endif
146 } 196 }
147 else 197 else
148#endif 198#endif
149 { 199 {
200#ifdef UI_LCD_SPLIT
201 sdl_set_gradient(lcd_real_surface, &lcd_color_max, &lcd_color_zero,
202 &lcd_color_split, &lcd_color_zero, (1<<LCD_DEPTH), shades);
203#else
150 sdl_set_gradient(lcd_surface, &lcd_color_max, &lcd_color_zero, 204 sdl_set_gradient(lcd_surface, &lcd_color_max, &lcd_color_zero,
151 (1<<LCD_DEPTH), shades); 205 (1<<LCD_DEPTH), shades);
206#endif
152 } 207 }
153 } 208 }
154} 209}
@@ -158,8 +213,9 @@ void sim_lcd_ex_update_rect(int x_start, int y_start, int width, int height)
158 if (lcd_ex_getpixel) { 213 if (lcd_ex_getpixel) {
159 sdl_update_rect(lcd_surface, x_start, y_start, width, height, 214 sdl_update_rect(lcd_surface, x_start, y_start, width, height,
160 LCD_WIDTH, LCD_HEIGHT, lcd_ex_getpixel); 215 LCD_WIDTH, LCD_HEIGHT, lcd_ex_getpixel);
161 sdl_gui_update(lcd_surface, x_start, y_start, width, height, LCD_WIDTH, 216 sdl_gui_update(lcd_surface, IFSPLIT(lcd_real_surface,) x_start, y_start,
162 LCD_HEIGHT, background ? UI_LCD_POSX : 0, 217 width, height, LCD_WIDTH, LCD_HEIGHT,
218 background ? UI_LCD_POSX : 0,
163 background? UI_LCD_POSY : 0); 219 background? UI_LCD_POSY : 0);
164 } 220 }
165} 221}
@@ -256,7 +312,7 @@ void lcd_blit_yuv(unsigned char * const src[3],
256 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 312 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
257 313
258#if LCD_WIDTH >= LCD_HEIGHT 314#if LCD_WIDTH >= LCD_HEIGHT
259 dst++; 315 dst++;
260#else 316#else
261 dst += LCD_WIDTH; 317 dst += LCD_WIDTH;
262#endif 318#endif
@@ -276,7 +332,7 @@ void lcd_blit_yuv(unsigned char * const src[3],
276 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 332 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
277 333
278#if LCD_WIDTH >= LCD_HEIGHT 334#if LCD_WIDTH >= LCD_HEIGHT
279 dst++; 335 dst++;
280#else 336#else
281 dst += LCD_WIDTH; 337 dst += LCD_WIDTH;
282#endif 338#endif
@@ -321,7 +377,7 @@ void lcd_blit_yuv(unsigned char * const src[3],
321 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 377 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
322 378
323#if LCD_WIDTH >= LCD_HEIGHT 379#if LCD_WIDTH >= LCD_HEIGHT
324 dst++; 380 dst++;
325#else 381#else
326 dst += LCD_WIDTH; 382 dst += LCD_WIDTH;
327#endif 383#endif
@@ -341,7 +397,7 @@ void lcd_blit_yuv(unsigned char * const src[3],
341 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 397 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
342 398
343#if LCD_WIDTH >= LCD_HEIGHT 399#if LCD_WIDTH >= LCD_HEIGHT
344 dst++; 400 dst++;
345#else 401#else
346 dst += LCD_WIDTH; 402 dst += LCD_WIDTH;
347#endif 403#endif