summaryrefslogtreecommitdiff
path: root/uisimulator/sdl
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-03-31 09:58:49 +0000
committerJens Arnold <amiconn@rockbox.org>2007-03-31 09:58:49 +0000
commit54ea2e435e1a5688de4e4dcf551a1fc9c1db323f (patch)
treee8ee4e55a20c872a6c0deff554734038c35dc661 /uisimulator/sdl
parent6186b556bdbe97bc3c50dd8feb970590bec2053c (diff)
downloadrockbox-54ea2e435e1a5688de4e4dcf551a1fc9c1db323f.tar.gz
rockbox-54ea2e435e1a5688de4e4dcf551a1fc9c1db323f.zip
Charcell lcd driver: Preparations for switching to non-immediate LCD updates, using lcd_update() like on bitmap targets. * Added proper clipping. * Simplified simulator code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12979 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/sdl')
-rw-r--r--uisimulator/sdl/SOURCES2
-rw-r--r--uisimulator/sdl/button.c2
-rw-r--r--uisimulator/sdl/lcd-charcells.c (renamed from uisimulator/sdl/lcd-charcell.c)91
-rw-r--r--uisimulator/sdl/lcd-charcells.h (renamed from uisimulator/sdl/lcd-charcell.h)0
-rw-r--r--uisimulator/sdl/uisdl.c2
5 files changed, 27 insertions, 70 deletions
diff --git a/uisimulator/sdl/SOURCES b/uisimulator/sdl/SOURCES
index 8f1f3e2fd7..e563cb984d 100644
--- a/uisimulator/sdl/SOURCES
+++ b/uisimulator/sdl/SOURCES
@@ -3,7 +3,7 @@ kernel.c
3#ifdef HAVE_LCD_BITMAP 3#ifdef HAVE_LCD_BITMAP
4lcd-bitmap.c 4lcd-bitmap.c
5#elif defined(HAVE_LCD_CHARCELLS) 5#elif defined(HAVE_LCD_CHARCELLS)
6lcd-charcell.c 6lcd-charcells.c
7#endif 7#endif
8#ifdef HAVE_REMOTE_LCD 8#ifdef HAVE_REMOTE_LCD
9lcd-remote-bitmap.c 9lcd-remote-bitmap.c
diff --git a/uisimulator/sdl/button.c b/uisimulator/sdl/button.c
index 76a41f2230..4b03008497 100644
--- a/uisimulator/sdl/button.c
+++ b/uisimulator/sdl/button.c
@@ -18,7 +18,7 @@
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20#include "uisdl.h" 20#include "uisdl.h"
21#include "lcd-charcell.h" 21#include "lcd-charcells.h"
22#include "lcd-remote.h" 22#include "lcd-remote.h"
23#include "config.h" 23#include "config.h"
24#include "button.h" 24#include "button.h"
diff --git a/uisimulator/sdl/lcd-charcell.c b/uisimulator/sdl/lcd-charcells.c
index 8849efc7cd..5a08179232 100644
--- a/uisimulator/sdl/lcd-charcell.c
+++ b/uisimulator/sdl/lcd-charcells.c
@@ -19,6 +19,7 @@
19 19
20#include "debug.h" 20#include "debug.h"
21#include "lcd.h" 21#include "lcd.h"
22#include "lcd-charcell.h"
22#include "misc.h" 23#include "misc.h"
23#include <string.h> 24#include <string.h>
24#include <unistd.h> 25#include <unistd.h>
@@ -36,82 +37,38 @@ SDL_Color lcd_color_zero = {UI_LCD_BGCOLOR, 0};
36SDL_Color lcd_backlight_color_zero = {UI_LCD_BGCOLORLIGHT, 0}; 37SDL_Color lcd_backlight_color_zero = {UI_LCD_BGCOLORLIGHT, 0};
37SDL_Color lcd_color_max = {0, 0, 0, 0}; 38SDL_Color lcd_color_max = {0, 0, 0, 0};
38 39
39/* Defined in lcd-playersim.c */
40extern void lcd_print_char(int x, int y);
41 40
42void lcd_update(void) 41static unsigned long get_lcd_pixel(int x, int y)
43{ 42{
44 int x, y; 43 return sim_lcd_framebuffer[y][x];
45 SDL_Rect dest = {UI_LCD_POSX, UI_LCD_POSY, UI_LCD_WIDTH, UI_LCD_HEIGHT};
46
47 SDL_LockSurface(lcd_surface);
48
49 for (y=0; y<2; y++) {
50 for (x=0; x<11; x++) {
51 lcd_print_char(x, y);
52 }
53 }
54
55 SDL_UnlockSurface(lcd_surface);
56
57 if (!background) {
58 dest.x -= UI_LCD_POSX;
59 dest.y -= UI_LCD_POSY;
60 }
61
62 SDL_BlitSurface(lcd_surface, NULL, gui_surface, &dest);
63 SDL_UpdateRect(gui_surface, dest.x, dest.y, dest.w, dest.h);
64 SDL_Flip(gui_surface);
65} 44}
66 45
67void drawdots(int color, struct coordinate *points, int count) 46void sim_lcd_update_rect(int x_start, int y_start, int width, int height)
68{ 47{
69 SDL_Rect dest; 48 sdl_update_rect(lcd_surface, x_start, y_start, width, height,
70 Uint32 sdlcolor; 49 SIM_LCD_WIDTH, SIM_LCD_HEIGHT, get_lcd_pixel);
71 50 sdl_gui_update(lcd_surface, x_start, y_start, width, height,
72 SDL_LockSurface(lcd_surface); 51 SIM_LCD_WIDTH, SIM_LCD_HEIGHT,
73 52 background ? UI_LCD_POSX : 0, background ? UI_LCD_POSY : 0);
74 if (color == 1) {
75 sdlcolor = SDL_MapRGB(lcd_surface->format, lcd_color_max.r, lcd_color_max.g, lcd_color_max.b);
76 } else {
77 sdlcolor = SDL_MapRGB(lcd_surface->format, lcd_color_zero.r, lcd_color_zero.g, lcd_color_zero.b);
78 }
79
80 while (count--) {
81 dest.x = points[count].x * display_zoom;
82 dest.y = points[count].y * display_zoom;
83 dest.w = 1 * display_zoom;
84 dest.h = 1 * display_zoom;
85
86 SDL_FillRect(lcd_surface, &dest, sdlcolor);
87 }
88
89 SDL_UnlockSurface(lcd_surface);
90} 53}
91 54
92void drawrectangles(int color, struct rectangle *points, int count) 55void lcd_update(void)
93{ 56{
94 SDL_Rect dest; 57 int x, y;
95 Uint32 sdlcolor;
96
97 SDL_LockSurface(lcd_surface);
98
99 if (color == 1) {
100 sdlcolor = SDL_MapRGB(lcd_surface->format, lcd_color_max.r, lcd_color_max.g, lcd_color_max.b);
101 } else {
102 sdlcolor = SDL_MapRGB(lcd_surface->format, lcd_color_zero.r, lcd_color_zero.g, lcd_color_zero.b);
103 }
104 58
105 while (count--) { 59 for (y = 0; y < lcd_pattern_count; y++)
106 dest.x = points[count].x * display_zoom; 60 if (lcd_patterns[y].count > 0)
107 dest.y = points[count].y * display_zoom; 61 sim_lcd_define_pattern(y, lcd_patterns[y].pattern);
108 dest.w = points[count].width * display_zoom;
109 dest.h = points[count].height * display_zoom;
110 62
111 SDL_FillRect(lcd_surface, &dest, sdlcolor); 63 for (y = 0; y < LCD_HEIGHT; y++)
112 } 64 for (x = 0; x < LCD_WIDTH; x++)
65 lcd_print_char(x, y, lcd_charbuffer[y][x]);
113 66
114 SDL_UnlockSurface(lcd_surface); 67 if (lcd_cursor.visible)
68 lcd_print_char(lcd_cursor.x, lcd_cursor.y, lcd_cursor.hw_char);
69
70 sim_lcd_update_rect(0, ICON_HEIGHT, SIM_LCD_WIDTH,
71 LCD_HEIGHT*CHAR_HEIGHT*CHAR_PIXEL);
115} 72}
116 73
117#if CONFIG_BACKLIGHT 74#if CONFIG_BACKLIGHT
@@ -124,8 +81,8 @@ void sim_backlight(int value)
124 sdl_set_gradient(lcd_surface, &lcd_color_zero, &lcd_color_max, 81 sdl_set_gradient(lcd_surface, &lcd_color_zero, &lcd_color_max,
125 0, (1<<LCD_DEPTH)); 82 0, (1<<LCD_DEPTH));
126 } 83 }
127 84
128 lcd_update(); 85 sim_lcd_update_rect(0, 0, SIM_LCD_WIDTH, SIM_LCD_HEIGHT);
129} 86}
130#endif 87#endif
131 88
diff --git a/uisimulator/sdl/lcd-charcell.h b/uisimulator/sdl/lcd-charcells.h
index 6b1e85e549..6b1e85e549 100644
--- a/uisimulator/sdl/lcd-charcell.h
+++ b/uisimulator/sdl/lcd-charcells.h
diff --git a/uisimulator/sdl/uisdl.c b/uisimulator/sdl/uisdl.c
index 037c54a9bf..54175ce727 100644
--- a/uisimulator/sdl/uisdl.c
+++ b/uisimulator/sdl/uisdl.c
@@ -28,7 +28,7 @@
28#ifdef HAVE_LCD_BITMAP 28#ifdef HAVE_LCD_BITMAP
29#include "lcd-bitmap.h" 29#include "lcd-bitmap.h"
30#elif defined(HAVE_LCD_CHARCELLS) 30#elif defined(HAVE_LCD_CHARCELLS)
31#include "lcd-charcell.h" 31#include "lcd-charcells.h"
32#endif 32#endif
33#ifdef HAVE_REMOTE_LCD 33#ifdef HAVE_REMOTE_LCD
34#include "lcd-remote-bitmap.h" 34#include "lcd-remote-bitmap.h"