summaryrefslogtreecommitdiff
path: root/uisimulator/sdl/lcd-remote-bitmap.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-05-15 21:02:47 +0000
committerThomas Martitz <kugel@rockbox.org>2010-05-15 21:02:47 +0000
commit3d0cee8abbaf764958743e8a7851eee94e60a913 (patch)
treea96b1ec825003a71643a7da4707c300f64824f82 /uisimulator/sdl/lcd-remote-bitmap.c
parentdcf442e61f21fb2aef5ce7de0547f733557b156e (diff)
downloadrockbox-3d0cee8abbaf764958743e8a7851eee94e60a913.tar.gz
rockbox-3d0cee8abbaf764958743e8a7851eee94e60a913.zip
- Move uisimulator/sdl/*.[ch] into the target tree, under firmware/target/hosted/sdl, uisdl.c is split up across button-sdl.c and system-sdl.c.
- Refactor the program startup. main() is now in main.c like on target, and the implicit application thread will now act as our main thread (previously a separate one was created for this in thread initialization). This is part of Rockbox as an application and is the first step to make an application port from the uisimulator. In a further step the sim bits from the sdl build will be separated out. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26065 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/sdl/lcd-remote-bitmap.c')
-rw-r--r--uisimulator/sdl/lcd-remote-bitmap.c110
1 files changed, 0 insertions, 110 deletions
diff --git a/uisimulator/sdl/lcd-remote-bitmap.c b/uisimulator/sdl/lcd-remote-bitmap.c
deleted file mode 100644
index c44e476288..0000000000
--- a/uisimulator/sdl/lcd-remote-bitmap.c
+++ /dev/null
@@ -1,110 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 Dan Everton
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "uisdl.h"
23#include "lcd-sdl.h"
24#include "lcd-remote-bitmap.h"
25#include "screendump.h"
26
27SDL_Surface *remote_surface = 0;
28
29SDL_Color remote_bl_color_dark = {RED_CMP(LCD_REMOTE_BL_DARKCOLOR),
30 GREEN_CMP(LCD_REMOTE_BL_DARKCOLOR),
31 BLUE_CMP(LCD_REMOTE_BL_DARKCOLOR), 0};
32SDL_Color remote_bl_color_bright = {RED_CMP(LCD_REMOTE_BL_BRIGHTCOLOR),
33 GREEN_CMP(LCD_REMOTE_BL_BRIGHTCOLOR),
34 BLUE_CMP(LCD_REMOTE_BL_BRIGHTCOLOR), 0};
35SDL_Color remote_color_dark = {RED_CMP(LCD_REMOTE_DARKCOLOR),
36 GREEN_CMP(LCD_REMOTE_DARKCOLOR),
37 BLUE_CMP(LCD_REMOTE_DARKCOLOR), 0};
38SDL_Color remote_color_bright = {RED_CMP(LCD_REMOTE_BRIGHTCOLOR),
39 GREEN_CMP(LCD_REMOTE_BRIGHTCOLOR),
40 BLUE_CMP(LCD_REMOTE_BRIGHTCOLOR), 0};
41
42#define NUM_SHADES 129
43
44#if LCD_REMOTE_DEPTH == 2
45/* Only defined for positive, non-split LCD for now */
46static const unsigned char colorindex[4] = {128, 85, 43, 0};
47#endif
48
49static unsigned long get_lcd_remote_pixel(int x, int y)
50{
51#if LCD_REMOTE_DEPTH == 1
52 return lcd_remote_framebuffer[y/8][x] & (1 << (y & 7)) ? 0 : (NUM_SHADES-1);
53#elif LCD_REMOTE_DEPTH == 2
54#if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
55 unsigned bits = (lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 0x0101;
56 return colorindex[(bits | (bits >> 7)) & 3];
57#endif
58#endif
59}
60
61void lcd_remote_update (void)
62{
63 lcd_remote_update_rect(0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT);
64}
65
66void lcd_remote_update_rect(int x_start, int y_start, int width, int height)
67{
68 if (remote_surface)
69 {
70 sdl_update_rect(remote_surface, x_start, y_start, width, height,
71 LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT, get_lcd_remote_pixel);
72 sdl_gui_update(remote_surface, x_start, y_start, width, height,
73 LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT, background ? UI_REMOTE_POSX : 0,
74 background ? UI_REMOTE_POSY : LCD_HEIGHT);
75 }
76}
77
78void sim_remote_backlight(int value)
79{
80 if (remote_surface)
81 {
82 if (value > 0)
83 {
84 sdl_set_gradient(remote_surface, &remote_bl_color_dark,
85 &remote_bl_color_bright, 0, NUM_SHADES);
86 }
87 else
88 {
89 sdl_set_gradient(remote_surface, &remote_color_dark,
90 &remote_color_bright, 0, NUM_SHADES);
91 }
92 sdl_gui_update(remote_surface, 0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT,
93 LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT,
94 background ? UI_REMOTE_POSX : 0,
95 background? UI_REMOTE_POSY : LCD_HEIGHT);
96 }
97}
98
99/* initialise simulator lcd remote driver */
100void sim_lcd_remote_init(void)
101{
102 remote_surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
103 LCD_REMOTE_WIDTH * display_zoom,
104 LCD_REMOTE_HEIGHT * display_zoom,
105 8, 0, 0, 0, 0);
106
107 sdl_set_gradient(remote_surface, &remote_bl_color_dark,
108 &remote_bl_color_bright, 0, NUM_SHADES);
109}
110