1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006 Dan Everton
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
24 #include "lcd-remote-bitmap.h"
26 SDL_Surface
*remote_surface
;
28 SDL_Color remote_color_zero
= {UI_REMOTE_BGCOLOR
, 0};
29 SDL_Color remote_backlight_color_zero
= {UI_REMOTE_BGCOLORLIGHT
, 0};
30 SDL_Color remote_color_max
= {0, 0, 0, 0};
32 static unsigned long get_lcd_remote_pixel(int x
, int y
) {
33 #if LCD_REMOTE_DEPTH == 1
34 return (lcd_remote_framebuffer
[y
/8][x
] >> (y
& 7)) & 1;
35 #elif LCD_REMOTE_DEPTH == 2
36 #if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
37 unsigned bits
= (lcd_remote_framebuffer
[y
/8][x
] >> (y
& 7)) & 0x0101;
38 return (bits
| (bits
>> 7)) & 3;
43 void lcd_remote_update (void)
45 lcd_remote_update_rect(0, 0, LCD_REMOTE_WIDTH
, LCD_REMOTE_HEIGHT
);
48 void lcd_remote_update_rect(int x_start
, int y_start
, int width
, int height
)
50 sdl_update_rect(remote_surface
, x_start
, y_start
, width
, height
,
51 LCD_REMOTE_WIDTH
, LCD_REMOTE_HEIGHT
, get_lcd_remote_pixel
);
52 sdl_gui_update(remote_surface
, x_start
, y_start
, width
, height
,
53 LCD_REMOTE_WIDTH
, LCD_REMOTE_HEIGHT
, background
? UI_REMOTE_POSX
: 0,
54 background
? UI_REMOTE_POSY
: LCD_HEIGHT
);
57 void sim_remote_backlight(int value
)
60 sdl_set_gradient(remote_surface
, &remote_backlight_color_zero
,
61 &remote_color_max
, 0, (1<<LCD_REMOTE_DEPTH
));
63 sdl_set_gradient(remote_surface
, &remote_color_zero
, &remote_color_max
,
64 0, (1<<LCD_REMOTE_DEPTH
));
67 sdl_gui_update(remote_surface
, 0, 0, LCD_REMOTE_WIDTH
, LCD_REMOTE_HEIGHT
,
68 LCD_REMOTE_WIDTH
, LCD_REMOTE_HEIGHT
,
69 background
? UI_REMOTE_POSX
: 0,
70 background
? UI_REMOTE_POSY
: LCD_HEIGHT
);
73 /* initialise simulator lcd remote driver */
74 void sim_lcd_remote_init(void)
76 remote_surface
= SDL_CreateRGBSurface(SDL_SWSURFACE
,
77 LCD_REMOTE_WIDTH
* display_zoom
, LCD_REMOTE_HEIGHT
* display_zoom
,
80 sdl_set_gradient(remote_surface
, &remote_backlight_color_zero
,
81 &remote_color_max
, 0, (1<<LCD_REMOTE_DEPTH
));