diff options
Diffstat (limited to 'uisimulator/sdl/lcd-remote.c')
-rw-r--r-- | uisimulator/sdl/lcd-remote.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/uisimulator/sdl/lcd-remote.c b/uisimulator/sdl/lcd-remote.c new file mode 100644 index 0000000000..4d592e67f5 --- /dev/null +++ b/uisimulator/sdl/lcd-remote.c | |||
@@ -0,0 +1,57 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 Dan Everton | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "uisdl.h" | ||
21 | #include "lcd-sdl.h" | ||
22 | #include "lcd-remote.h" | ||
23 | |||
24 | SDL_Surface *remote_surface; | ||
25 | |||
26 | SDL_Color remote_color_zero = {UI_REMOTE_BGCOLORLIGHT, 0}; | ||
27 | SDL_Color remote_color_max = {0, 0, 0, 0}; | ||
28 | |||
29 | extern unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH]; | ||
30 | |||
31 | static inline Uint32 get_lcd_remote_pixel(int x, int y) { | ||
32 | return ((lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 1); | ||
33 | } | ||
34 | |||
35 | void lcd_remote_update (void) | ||
36 | { | ||
37 | lcd_remote_update_rect(0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT); | ||
38 | } | ||
39 | |||
40 | void lcd_remote_update_rect(int x_start, int y_start, int width, int height) | ||
41 | { | ||
42 | sdl_update_rect(remote_surface, x_start, y_start, width, height, | ||
43 | LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT, background ? UI_REMOTE_POSX : 0, | ||
44 | (background? UI_REMOTE_POSY : 0) + UI_LCD_HEIGHT, get_lcd_remote_pixel); | ||
45 | } | ||
46 | |||
47 | /* initialise simulator lcd remote driver */ | ||
48 | void sim_lcd_remote_init(void) | ||
49 | { | ||
50 | remote_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, | ||
51 | LCD_REMOTE_WIDTH * display_zoom, LCD_REMOTE_HEIGHT * display_zoom, | ||
52 | 8, 0, 0, 0, 0); | ||
53 | |||
54 | sdl_set_gradient(remote_surface, &remote_color_zero, &remote_color_max, | ||
55 | (1<<LCD_REMOTE_DEPTH)); | ||
56 | } | ||
57 | |||