VBRfix description, part 2: actually this note was way outdated. Files recorded with...
[kugel-rb.git] / uisimulator / sdl / lcd-remote-bitmap.c
blob21fa0d2ab42c572c89e970e93546ecc6a525850a
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2006 Dan Everton
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #include "uisdl.h"
21 #include "lcd-sdl.h"
22 #include "lcd-remote-bitmap.h"
24 SDL_Surface *remote_surface;
26 SDL_Color remote_color_zero = {UI_REMOTE_BGCOLOR, 0};
27 SDL_Color remote_backlight_color_zero = {UI_REMOTE_BGCOLORLIGHT, 0};
28 SDL_Color remote_color_max = {0, 0, 0, 0};
30 static unsigned long get_lcd_remote_pixel(int x, int y) {
31 #if LCD_REMOTE_DEPTH == 1
32 return (lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 1;
33 #elif LCD_REMOTE_DEPTH == 2
34 #if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
35 unsigned bits = (lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 0x0101;
36 return (bits | (bits >> 7)) & 3;
37 #endif
38 #endif
41 void lcd_remote_update (void)
43 lcd_remote_update_rect(0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT);
46 void lcd_remote_update_rect(int x_start, int y_start, int width, int height)
48 sdl_update_rect(remote_surface, x_start, y_start, width, height,
49 LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT, get_lcd_remote_pixel);
50 sdl_gui_update(remote_surface, x_start, y_start, width, height,
51 LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT, background ? UI_REMOTE_POSX : 0,
52 background ? UI_REMOTE_POSY : LCD_HEIGHT);
55 void sim_remote_backlight(int value)
57 if (value > 0) {
58 sdl_set_gradient(remote_surface, &remote_backlight_color_zero,
59 &remote_color_max, 0, (1<<LCD_REMOTE_DEPTH));
60 } else {
61 sdl_set_gradient(remote_surface, &remote_color_zero, &remote_color_max,
62 0, (1<<LCD_REMOTE_DEPTH));
65 sdl_gui_update(remote_surface, 0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT,
66 LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT,
67 background ? UI_REMOTE_POSX : 0,
68 background? UI_REMOTE_POSY : LCD_HEIGHT);
71 /* initialise simulator lcd remote driver */
72 void sim_lcd_remote_init(void)
74 remote_surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
75 LCD_REMOTE_WIDTH * display_zoom, LCD_REMOTE_HEIGHT * display_zoom,
76 8, 0, 0, 0, 0);
78 sdl_set_gradient(remote_surface, &remote_backlight_color_zero,
79 &remote_color_max, 0, (1<<LCD_REMOTE_DEPTH));