summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-06-18 07:15:00 +0200
committerThomas Martitz <kugel@rockbox.org>2014-06-21 00:15:53 +0200
commita1842c04f9cb73210d4cacde61a9e4b115050765 (patch)
treea37af61ef9285b763a42cd33797e2f3d634fbf9f /apps/gui
parent0250be1d6799db7b5ddc99cb33f31bf9cff01ed2 (diff)
downloadrockbox-a1842c04f9cb73210d4cacde61a9e4b115050765.tar.gz
rockbox-a1842c04f9cb73210d4cacde61a9e4b115050765.zip
lcd-24bit: Introduce a 24-bit mid-level LCD driver
With LCD driver all calculation will be performed on RGB888 and the hardware/OS can display from our 24bit framebuffer. It is not yet as performance optimized as the existing drivers but should be good enough.The vast number of small changes is due to the fact that fb_data can be a struct type now, while most of the code expected a scalar type. lcd-as-memframe ASM code does not work with 24bit currently so the with 24bit it enforces the generic C code. All plugins are ported over. Except for rockpaint. It uses so much memory that it wouldnt fit into the 512k plugin buffer anymore (patches welcome). Change-Id: Ibb1964545028ce0d8ff9833ccc3ab66be3ee0754
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/color_picker.c38
-rw-r--r--apps/gui/line.h4
-rw-r--r--apps/gui/skin_engine/skin_render.c6
3 files changed, 31 insertions, 17 deletions
diff --git a/apps/gui/color_picker.c b/apps/gui/color_picker.c
index 907b1744c5..a66b131560 100644
--- a/apps/gui/color_picker.c
+++ b/apps/gui/color_picker.c
@@ -60,7 +60,7 @@ struct rgb_pick
60/* list of primary colors */ 60/* list of primary colors */
61#define SB_PRIM 0 61#define SB_PRIM 0
62#define SB_FILL 1 62#define SB_FILL 1
63static const fb_data prim_rgb[][3] = 63static const unsigned prim_rgb[][3] =
64{ 64{
65 /* Foreground colors for sliders */ 65 /* Foreground colors for sliders */
66 { 66 {
@@ -87,13 +87,13 @@ static const unsigned char rgb_max[3] =
87/* Unpacks the color value into native rgb values and 24 bit rgb values */ 87/* Unpacks the color value into native rgb values and 24 bit rgb values */
88static void unpack_rgb(struct rgb_pick *rgb) 88static void unpack_rgb(struct rgb_pick *rgb)
89{ 89{
90 unsigned color = _LCD_UNSWAP_COLOR(rgb->color); 90 unsigned color = rgb->color;
91 rgb->red = _RGB_UNPACK_RED(color); 91 rgb->red = RGB_UNPACK_RED(color);
92 rgb->green = _RGB_UNPACK_GREEN(color); 92 rgb->green = RGB_UNPACK_GREEN(color);
93 rgb->blue = _RGB_UNPACK_BLUE(color); 93 rgb->blue = RGB_UNPACK_BLUE(color);
94 rgb->r = _RGB_UNPACK_RED_LCD(color); 94 rgb->r = RGB_UNPACK_RED_LCD(color);
95 rgb->g = _RGB_UNPACK_GREEN_LCD(color); 95 rgb->g = RGB_UNPACK_GREEN_LCD(color);
96 rgb->b = _RGB_UNPACK_BLUE_LCD(color); 96 rgb->b = RGB_UNPACK_BLUE_LCD(color);
97} 97}
98 98
99/* Packs the native rgb colors into a color value */ 99/* Packs the native rgb colors into a color value */
@@ -159,6 +159,7 @@ static void draw_screen(struct screen *display, char *title,
159 int max_label_width; 159 int max_label_width;
160 int text_x, text_top; 160 int text_x, text_top;
161 int slider_x, slider_width; 161 int slider_x, slider_width;
162 int value_width;
162 bool display_three_rows; 163 bool display_three_rows;
163 struct viewport vp; 164 struct viewport vp;
164 165
@@ -185,7 +186,12 @@ static void draw_screen(struct screen *display, char *title,
185 TITLE_MARGIN_BOTTOM + SELECTOR_TB_MARGIN; 186 TITLE_MARGIN_BOTTOM + SELECTOR_TB_MARGIN;
186 text_x = SELECTOR_WIDTH; 187 text_x = SELECTOR_WIDTH;
187 slider_x = text_x + max_label_width + SLIDER_TEXT_MARGIN; 188 slider_x = text_x + max_label_width + SLIDER_TEXT_MARGIN;
188 slider_width = vp.width - slider_x*2 - max_label_width; 189 slider_width = vp.width - text_x - slider_x - SLIDER_TEXT_MARGIN;
190 if (display->depth >= 24)
191 display->getstringsize("255", &value_width, NULL);
192 else
193 display->getstringsize("63", &value_width, NULL);
194 slider_width -= value_width;
189 line_height = char_height + 2*SELECTOR_TB_MARGIN; 195 line_height = char_height + 2*SELECTOR_TB_MARGIN;
190 196
191 /* Find out if there's enough room for three sliders or just 197 /* Find out if there's enough room for three sliders or just
@@ -252,7 +258,10 @@ static void draw_screen(struct screen *display, char *title,
252 vp.flags &= ~VP_FLAG_ALIGNMENT_MASK; 258 vp.flags &= ~VP_FLAG_ALIGNMENT_MASK;
253 display->putsxy(text_x, text_top, buf); 259 display->putsxy(text_x, text_top, buf);
254 /* Draw color value */ 260 /* Draw color value */
255 snprintf(buf, 3, "%02d", rgb->rgb_val[i]); 261 if (display->depth >= 24)
262 snprintf(buf, 4, "%03d", rgb->rgb_val[i]);
263 else
264 snprintf(buf, 3, "%02d", rgb->rgb_val[i]);
256 vp.flags |= VP_FLAG_ALIGN_RIGHT; 265 vp.flags |= VP_FLAG_ALIGN_RIGHT;
257 display->putsxy(text_x, text_top, buf); 266 display->putsxy(text_x, text_top, buf);
258 267
@@ -324,7 +333,7 @@ static int touchscreen_slider(struct screen *display,
324{ 333{
325 short x, y; 334 short x, y;
326 int char_height, line_height; 335 int char_height, line_height;
327 int max_label_width; 336 int max_label_width, value_width;
328 int text_top, slider_x, slider_width; 337 int text_top, slider_x, slider_width;
329 bool display_three_rows; 338 bool display_three_rows;
330 int button; 339 int button;
@@ -345,7 +354,12 @@ static int touchscreen_slider(struct screen *display,
345 text_top = MARGIN_TOP + char_height + 354 text_top = MARGIN_TOP + char_height +
346 TITLE_MARGIN_BOTTOM + SELECTOR_TB_MARGIN; 355 TITLE_MARGIN_BOTTOM + SELECTOR_TB_MARGIN;
347 slider_x = SELECTOR_WIDTH + max_label_width + SLIDER_TEXT_MARGIN; 356 slider_x = SELECTOR_WIDTH + max_label_width + SLIDER_TEXT_MARGIN;
348 slider_width = vp.width - slider_x*2 - max_label_width; 357 slider_width = vp.width - SELECTOR_WIDTH - slider_x - SLIDER_TEXT_MARGIN;
358 if (display->depth >= 24)
359 display->getstringsize("255", &value_width, NULL);
360 else
361 display->getstringsize("63", &value_width, NULL);
362 slider_width -= value_width;
349 line_height = char_height + 2*SELECTOR_TB_MARGIN; 363 line_height = char_height + 2*SELECTOR_TB_MARGIN;
350 364
351 /* same logic as in draw_screen */ 365 /* same logic as in draw_screen */
diff --git a/apps/gui/line.h b/apps/gui/line.h
index c14f04d9a2..8a1cc05af2 100644
--- a/apps/gui/line.h
+++ b/apps/gui/line.h
@@ -66,10 +66,10 @@ struct line_desc {
66 int16_t line; 66 int16_t line;
67 /* line text color if STYLE_COLORED is specified, in native 67 /* line text color if STYLE_COLORED is specified, in native
68 * lcd format (convert with LCD_RGBPACK() if necessary) */ 68 * lcd format (convert with LCD_RGBPACK() if necessary) */
69 fb_data text_color; 69 unsigned text_color;
70 /* line color if STYLE_COLORBAR or STYLE_GRADIENT is specified, in native 70 /* line color if STYLE_COLORBAR or STYLE_GRADIENT is specified, in native
71 * lcd format (convert with LCD_RGBPACK() if necessary) */ 71 * lcd format (convert with LCD_RGBPACK() if necessary) */
72 fb_data line_color, line_end_color; 72 unsigned line_color, line_end_color;
73 /* line decorations, see STYLE_DEFAULT etc. */ 73 /* line decorations, see STYLE_DEFAULT etc. */
74 enum line_styles style; 74 enum line_styles style;
75 /* whether the line can scroll */ 75 /* whether the line can scroll */
diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c
index 700694e382..4415619b7e 100644
--- a/apps/gui/skin_engine/skin_render.c
+++ b/apps/gui/skin_engine/skin_render.c
@@ -136,9 +136,9 @@ static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info,
136 * come before the text style tag color fields need to be preserved */ 136 * come before the text style tag color fields need to be preserved */
137 if (data->style & STYLE_GRADIENT) 137 if (data->style & STYLE_GRADIENT)
138 { 138 {
139 fb_data tc = linedes->text_color, 139 unsigned tc = linedes->text_color,
140 lc = linedes->line_color, 140 lc = linedes->line_color,
141 lec = linedes->line_end_color; 141 lec = linedes->line_end_color;
142 *linedes = *data; 142 *linedes = *data;
143 linedes->text_color = tc; 143 linedes->text_color = tc;
144 linedes->line_color = lc; 144 linedes->line_color = lc;