summaryrefslogtreecommitdiff
path: root/uisimulator/sdl/lcd-remote.c
diff options
context:
space:
mode:
authorDan Everton <dan@iocaine.org>2006-02-09 21:49:28 +0000
committerDan Everton <dan@iocaine.org>2006-02-09 21:49:28 +0000
commitb585e87b454917f0424541a34c0b41b1fe83f694 (patch)
treef93652b42b4791ce4f8b64421a1a063c58e511b0 /uisimulator/sdl/lcd-remote.c
parentf42f42e5543f18d11142bb98e3c8677a04b99318 (diff)
downloadrockbox-b585e87b454917f0424541a34c0b41b1fe83f694.tar.gz
rockbox-b585e87b454917f0424541a34c0b41b1fe83f694.zip
Refactor SDL sim source so drawing routines are written once. Split bitmap, remote, and charcell LCD in to their own files. Add zoom support, use --zoom factor (e.g. --zoom 2 for two times zoom) to use it.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8645 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/sdl/lcd-remote.c')
-rw-r--r--uisimulator/sdl/lcd-remote.c57
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
24SDL_Surface *remote_surface;
25
26SDL_Color remote_color_zero = {UI_REMOTE_BGCOLORLIGHT, 0};
27SDL_Color remote_color_max = {0, 0, 0, 0};
28
29extern unsigned char lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_WIDTH];
30
31static inline Uint32 get_lcd_remote_pixel(int x, int y) {
32 return ((lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 1);
33}
34
35void lcd_remote_update (void)
36{
37 lcd_remote_update_rect(0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT);
38}
39
40void 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 */
48void 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