summaryrefslogtreecommitdiff
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
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
-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
-rw-r--r--apps/plugin.c2
-rw-r--r--apps/plugin.h2
-rw-r--r--apps/plugins/SOURCES3
-rw-r--r--apps/plugins/SUBDIRS2
-rw-r--r--apps/plugins/doom/i_video.c2
-rw-r--r--apps/plugins/fft/fft.c8
-rw-r--r--apps/plugins/fire.c16
-rw-r--r--apps/plugins/fractals/mandelbrot_set.c5
-rw-r--r--apps/plugins/imageviewer/jpeg/yuv2rgb.c8
-rw-r--r--apps/plugins/imageviewer/ppm/ppm_decoder.c4
-rw-r--r--apps/plugins/invadrox.c9
-rw-r--r--apps/plugins/lib/bmp_smooth_scale.c186
-rw-r--r--apps/plugins/lib/osd.c3
-rw-r--r--apps/plugins/lib/pluginlib_bmp.c6
-rw-r--r--apps/plugins/lib/xlcd_draw.c12
-rw-r--r--apps/plugins/logo.c8
-rw-r--r--apps/plugins/lua/rocklib.c4
-rw-r--r--apps/plugins/mpegplayer/alloc.c1
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c32
-rw-r--r--apps/plugins/pacbox/arcade.c2
-rw-r--r--apps/plugins/pictureflow/pictureflow.c62
-rw-r--r--apps/plugins/plasma.c2
-rw-r--r--apps/plugins/rockblox.c2
-rw-r--r--apps/plugins/rockboy/lcd-gb.h6
-rw-r--r--apps/plugins/rockboy/lcd.c14
-rw-r--r--apps/plugins/rockboy/sys_rockbox.c9
-rw-r--r--apps/plugins/superdom.c4
-rw-r--r--apps/plugins/zxbox/zxvid_16bpp.c6
-rw-r--r--apps/recorder/bmp.c17
-rw-r--r--apps/recorder/resize.c12
-rw-r--r--firmware/SOURCES2
-rw-r--r--firmware/asm/SOURCES4
-rw-r--r--firmware/asm/lcd-as-memframe-24bit.c3
-rw-r--r--firmware/asm/lcd-as-memframe.c8
-rw-r--r--firmware/drivers/lcd-24bit.c1129
-rw-r--r--firmware/drivers/lcd-color-common.c8
-rw-r--r--firmware/export/config.h1
-rw-r--r--firmware/export/config/samsungypr0.h2
-rw-r--r--firmware/export/config/samsungypr1.h4
-rw-r--r--firmware/export/config/sansae200v2.h4
-rw-r--r--firmware/export/config/sdlapp.h4
-rw-r--r--firmware/export/lcd.h85
-rw-r--r--firmware/screendump.c14
-rw-r--r--firmware/target/hosted/sdl/lcd-bitmap.c4
-rw-r--r--tools/bmp2rb.c25
-rw-r--r--wps/WPSLIST200
49 files changed, 1653 insertions, 341 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;
diff --git a/apps/plugin.c b/apps/plugin.c
index 4bed707c11..d0e6ade547 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -184,7 +184,7 @@ static const struct plugin_api rockbox_api = {
184 lcd_get_backdrop, 184 lcd_get_backdrop,
185 lcd_set_backdrop, 185 lcd_set_backdrop,
186#endif 186#endif
187#if LCD_DEPTH == 16 187#if LCD_DEPTH >= 16
188 lcd_bitmap_transparent_part, 188 lcd_bitmap_transparent_part,
189 lcd_bitmap_transparent, 189 lcd_bitmap_transparent,
190#if MEMORYSIZE > 2 190#if MEMORYSIZE > 2
diff --git a/apps/plugin.h b/apps/plugin.h
index fd4e468b91..1ed1c041d1 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -242,7 +242,7 @@ struct plugin_api {
242 fb_data* (*lcd_get_backdrop)(void); 242 fb_data* (*lcd_get_backdrop)(void);
243 void (*lcd_set_backdrop)(fb_data* backdrop); 243 void (*lcd_set_backdrop)(fb_data* backdrop);
244#endif 244#endif
245#if LCD_DEPTH == 16 245#if LCD_DEPTH >= 16
246 void (*lcd_bitmap_transparent_part)(const fb_data *src, 246 void (*lcd_bitmap_transparent_part)(const fb_data *src,
247 int src_x, int src_y, int stride, 247 int src_x, int src_y, int stride,
248 int x, int y, int width, int height); 248 int x, int y, int width, int height);
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES
index 59bd4023cc..c56cd5eb46 100644
--- a/apps/plugins/SOURCES
+++ b/apps/plugins/SOURCES
@@ -195,7 +195,8 @@ codebuster.c
195fireworks.c 195fireworks.c
196#endif 196#endif
197 197
198#if LCD_DEPTH >= 16 198#if LCD_DEPTH == 16
199/* FIXME: make it work with 24bit (needs lot of memory) */
199rockpaint.c 200rockpaint.c
200#endif 201#endif
201 202
diff --git a/apps/plugins/SUBDIRS b/apps/plugins/SUBDIRS
index c22977f137..8e653983b7 100644
--- a/apps/plugins/SUBDIRS
+++ b/apps/plugins/SUBDIRS
@@ -22,7 +22,7 @@ clock
22rockboy 22rockboy
23#endif 23#endif
24 24
25#ifdef HAVE_TAGCACHE 25#if defined(HAVE_TAGCACHE)
26pictureflow 26pictureflow
27#endif 27#endif
28 28
diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c
index 57803fb57d..10aee392a2 100644
--- a/apps/plugins/doom/i_video.c
+++ b/apps/plugins/doom/i_video.c
@@ -790,7 +790,7 @@ static void I_UploadNewPalette(int pal)
790#ifndef HAVE_LCD_COLOR 790#ifndef HAVE_LCD_COLOR
791 paldata[i]=(3*r+6*g+b)/10; 791 paldata[i]=(3*r+6*g+b)/10;
792#else 792#else
793 paldata[i] = LCD_RGBPACK(r,g,b); 793 paldata[i] = FB_RGBPACK(r,g,b);
794#endif 794#endif
795 } 795 }
796 796
diff --git a/apps/plugins/fft/fft.c b/apps/plugins/fft/fft.c
index e591954664..2b7f6a4fbe 100644
--- a/apps/plugins/fft/fft.c
+++ b/apps/plugins/fft/fft.c
@@ -929,13 +929,15 @@ static void draw_spectrogram_vertical(unsigned this_max, unsigned graph_max)
929 if(bins_acc >= ARRAYLEN_PLOT) 929 if(bins_acc >= ARRAYLEN_PLOT)
930 { 930 {
931 unsigned index = (SHADES-1)*bins_max / graph_max; 931 unsigned index = (SHADES-1)*bins_max / graph_max;
932 unsigned color;
932 933
933 /* These happen because we exaggerate the graph a little for 934 /* These happen because we exaggerate the graph a little for
934 * linear mode */ 935 * linear mode */
935 if(index >= SHADES) 936 if(index >= SHADES)
936 index = SHADES-1; 937 index = SHADES-1;
937 938
938 mylcd_set_foreground(SPECTROGRAPH_PALETTE(index)); 939 color = FB_UNPACK_SCALAR_LCD(SPECTROGRAPH_PALETTE(index));
940 mylcd_set_foreground(color);
939 mylcd_drawpixel(fft_spectrogram_pos, y); 941 mylcd_drawpixel(fft_spectrogram_pos, y);
940 942
941 if(--y < 0) 943 if(--y < 0)
@@ -973,13 +975,15 @@ static void draw_spectrogram_horizontal(unsigned this_max, unsigned graph_max)
973 if(bins_acc >= ARRAYLEN_PLOT) 975 if(bins_acc >= ARRAYLEN_PLOT)
974 { 976 {
975 unsigned index = (SHADES-1)*bins_max / graph_max; 977 unsigned index = (SHADES-1)*bins_max / graph_max;
978 unsigned color;
976 979
977 /* These happen because we exaggerate the graph a little for 980 /* These happen because we exaggerate the graph a little for
978 * linear mode */ 981 * linear mode */
979 if(index >= SHADES) 982 if(index >= SHADES)
980 index = SHADES-1; 983 index = SHADES-1;
981 984
982 mylcd_set_foreground(SPECTROGRAPH_PALETTE(index)); 985 color = FB_UNPACK_SCALAR_LCD(SPECTROGRAPH_PALETTE(index));
986 mylcd_set_foreground(color);
983 mylcd_drawpixel(x, fft_spectrogram_pos); 987 mylcd_drawpixel(x, fft_spectrogram_pos);
984 988
985 if(++x >= LCD_WIDTH) 989 if(++x >= LCD_WIDTH)
diff --git a/apps/plugins/fire.c b/apps/plugins/fire.c
index 478296b5f8..4fc30173da 100644
--- a/apps/plugins/fire.c
+++ b/apps/plugins/fire.c
@@ -100,20 +100,20 @@ static void color_palette_init(fb_data* palette)
100 int i; 100 int i;
101 for (i = 0; i < 32; i++){ 101 for (i = 0; i < 32; i++){
102 /* black to blue, 32 values*/ 102 /* black to blue, 32 values*/
103 palette[i]=LCD_RGBPACK(0, 0, 2*i); 103 palette[i]=FB_RGBPACK(0, 0, 2*i);
104 104
105 /* blue to red, 32 values*/ 105 /* blue to red, 32 values*/
106 palette[i + 32]=LCD_RGBPACK(8*i, 0, 64 - 2*i); 106 palette[i + 32]=FB_RGBPACK(8*i, 0, 64 - 2*i);
107 107
108 /* red to yellow, 32 values*/ 108 /* red to yellow, 32 values*/
109 palette[i + 64]=LCD_RGBPACK(255, 8*i, 0); 109 palette[i + 64]=FB_RGBPACK(255, 8*i, 0);
110 110
111 /* yellow to white, 162 values */ 111 /* yellow to white, 162 values */
112 palette[i + 96]=LCD_RGBPACK(255, 255, 0 + 4*i); 112 palette[i + 96]=FB_RGBPACK(255, 255, 0 + 4*i);
113 palette[i + 128]=LCD_RGBPACK(255, 255, 64 + 4*i); 113 palette[i + 128]=FB_RGBPACK(255, 255, 64 + 4*i);
114 palette[i + 160]=LCD_RGBPACK(255, 255, 128 + 4*i); 114 palette[i + 160]=FB_RGBPACK(255, 255, 128 + 4*i);
115 palette[i + 192]=LCD_RGBPACK(255, 255, 192 + i); 115 palette[i + 192]=FB_RGBPACK(255, 255, 192 + i);
116 palette[i + 224]=LCD_RGBPACK(255, 255, 224 + i); 116 palette[i + 224]=FB_RGBPACK(255, 255, 224 + i);
117 } 117 }
118#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) 118#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
119 rb->lcd_pal256_update_pal(palette); 119 rb->lcd_pal256_update_pal(palette);
diff --git a/apps/plugins/fractals/mandelbrot_set.c b/apps/plugins/fractals/mandelbrot_set.c
index 6e47527a20..583095913f 100644
--- a/apps/plugins/fractals/mandelbrot_set.c
+++ b/apps/plugins/fractals/mandelbrot_set.c
@@ -43,8 +43,8 @@ static fb_data imgbuffer[LCD_HEIGHT];
43#endif 43#endif
44 44
45#ifdef HAVE_LCD_COLOR 45#ifdef HAVE_LCD_COLOR
46#define COLOR(iter) (fb_data)LCOLOR(iter) 46#define COLOR(iter) FB_SCALARPACK(LCOLOR(iter))
47#define CONVERGENCE_COLOR LCD_RGBPACK(0, 0, 0) 47#define CONVERGENCE_COLOR FB_RGBPACK(0, 0, 0)
48#else /* greyscale */ 48#else /* greyscale */
49#define COLOR(iter) (unsigned char)LCOLOR(iter) 49#define COLOR(iter) (unsigned char)LCOLOR(iter)
50#define CONVERGENCE_COLOR 0 50#define CONVERGENCE_COLOR 0
@@ -413,4 +413,3 @@ static int mandelbrot_precision(int d)
413 413
414 return changed; 414 return changed;
415} 415}
416
diff --git a/apps/plugins/imageviewer/jpeg/yuv2rgb.c b/apps/plugins/imageviewer/jpeg/yuv2rgb.c
index 2395f232b2..764dc71a47 100644
--- a/apps/plugins/imageviewer/jpeg/yuv2rgb.c
+++ b/apps/plugins/imageviewer/jpeg/yuv2rgb.c
@@ -106,7 +106,7 @@ static fb_data pixel_to_lcd_colour(void)
106 b = component_to_lcd(p->b, LCD_BLUE_BITS, NODITHER_DELTA); 106 b = component_to_lcd(p->b, LCD_BLUE_BITS, NODITHER_DELTA);
107 b = clamp_component_bits(b, LCD_BLUE_BITS); 107 b = clamp_component_bits(b, LCD_BLUE_BITS);
108 108
109 return LCD_RGBPACK_LCD(r, g, b); 109 return FB_RGBPACK_LCD(r, g, b);
110} 110}
111 111
112/** write a monochrome pixel to the colour LCD **/ 112/** write a monochrome pixel to the colour LCD **/
@@ -119,7 +119,7 @@ static fb_data pixel_to_lcd_gray(void)
119 b = component_to_lcd(g, LCD_BLUE_BITS, NODITHER_DELTA); 119 b = component_to_lcd(g, LCD_BLUE_BITS, NODITHER_DELTA);
120 g = component_to_lcd(g, LCD_GREEN_BITS, NODITHER_DELTA); 120 g = component_to_lcd(g, LCD_GREEN_BITS, NODITHER_DELTA);
121 121
122 return LCD_RGBPACK_LCD(r, g, b); 122 return FB_RGBPACK_LCD(r, g, b);
123} 123}
124 124
125/** 125/**
@@ -163,7 +163,7 @@ static fb_data pixel_odither_to_lcd(void)
163 163
164 p->col += p->inc; 164 p->col += p->inc;
165 165
166 return LCD_RGBPACK_LCD(r, g, b); 166 return FB_RGBPACK_LCD(r, g, b);
167} 167}
168 168
169/** 169/**
@@ -217,7 +217,7 @@ static fb_data pixel_fsdither_to_lcd(void)
217 distribute_error(&p->ce[BLU], &p->e[BLU], bc, epos, inc); 217 distribute_error(&p->ce[BLU], &p->e[BLU], bc, epos, inc);
218 218
219 /* Pack and return pixel */ 219 /* Pack and return pixel */
220 return LCD_RGBPACK_LCD(r, g, b); 220 return FB_RGBPACK_LCD(r, g, b);
221} 221}
222 222
223/* Functions for each output mode, colour then grayscale. */ 223/* Functions for each output mode, colour then grayscale. */
diff --git a/apps/plugins/imageviewer/ppm/ppm_decoder.c b/apps/plugins/imageviewer/ppm/ppm_decoder.c
index be459293fe..4a86be1a3a 100644
--- a/apps/plugins/imageviewer/ppm/ppm_decoder.c
+++ b/apps/plugins/imageviewer/ppm/ppm_decoder.c
@@ -197,7 +197,7 @@ static int read_ppm_row(int fd, struct ppm_info *ppm, int row)
197 { 197 {
198 return PLUGIN_ERROR; 198 return PLUGIN_ERROR;
199 } 199 }
200 *dst = LCD_RGBPACK( 200 *dst = FB_RGBPACK(
201 (255 * r)/ppm->maxval, 201 (255 * r)/ppm->maxval,
202 (255 * g)/ppm->maxval, 202 (255 * g)/ppm->maxval,
203 (255 * b)/ppm->maxval); 203 (255 * b)/ppm->maxval);
@@ -216,7 +216,7 @@ static int read_ppm_row(int fd, struct ppm_info *ppm, int row)
216 { 216 {
217 return PLUGIN_ERROR; 217 return PLUGIN_ERROR;
218 } 218 }
219 *dst = LCD_RGBPACK( 219 *dst = FB_RGBPACK(
220 (255 * r)/ppm->maxval, 220 (255 * r)/ppm->maxval,
221 (255 * g)/ppm->maxval, 221 (255 * g)/ppm->maxval,
222 (255 * b)/ppm->maxval); 222 (255 * b)/ppm->maxval);
diff --git a/apps/plugins/invadrox.c b/apps/plugins/invadrox.c
index ef53715753..158ad2f4d7 100644
--- a/apps/plugins/invadrox.c
+++ b/apps/plugins/invadrox.c
@@ -1027,7 +1027,7 @@ static inline void draw_ship(void)
1027} 1027}
1028 1028
1029 1029
1030static inline void fire_alpha(int xc, int yc, fb_data color) 1030static inline void fire_alpha(int xc, int yc, unsigned color)
1031{ 1031{
1032 int oldmode = rb->lcd_get_drawmode(); 1032 int oldmode = rb->lcd_get_drawmode();
1033 1033
@@ -1128,12 +1128,12 @@ static void move_fire(void)
1128 /* Check for hit*/ 1128 /* Check for hit*/
1129 for (i = FIRE_SPEED; i >= 0; i--) { 1129 for (i = FIRE_SPEED; i >= 0; i--) {
1130 pix = get_pixel(fire_x, fire_y + i); 1130 pix = get_pixel(fire_x, fire_y + i);
1131 if(pix == screen_white) { 1131 if(!memcmp(&pix, &screen_white, sizeof(fb_data))) {
1132 hit_white = true; 1132 hit_white = true;
1133 fire_y += i; 1133 fire_y += i;
1134 break; 1134 break;
1135 } 1135 }
1136 if(pix == screen_green) { 1136 if(!memcmp(&pix, &screen_green, sizeof(fb_data))) {
1137 hit_green = true; 1137 hit_green = true;
1138 fire_y += i; 1138 fire_y += i;
1139 break; 1139 break;
@@ -1336,7 +1336,8 @@ static void move_bombs(void)
1336 /* Check for green (ship or shield) */ 1336 /* Check for green (ship or shield) */
1337 for (j = BOMB_HEIGHT; j >= BOMB_HEIGHT - BOMB_SPEED; j--) { 1337 for (j = BOMB_HEIGHT; j >= BOMB_HEIGHT - BOMB_SPEED; j--) {
1338 bombs[i].target = 0; 1338 bombs[i].target = 0;
1339 if(get_pixel(bombs[i].x + BOMB_WIDTH / 2, bombs[i].y + j) == screen_green) { 1339 fb_data pix = get_pixel(bombs[i].x + BOMB_WIDTH / 2, bombs[i].y + j);
1340 if(!memcmp(&pix, &screen_green, sizeof(fb_data))) {
1340 /* Move to hit pixel */ 1341 /* Move to hit pixel */
1341 bombs[i].x += BOMB_WIDTH / 2; 1342 bombs[i].x += BOMB_WIDTH / 2;
1342 bombs[i].y += j; 1343 bombs[i].y += j;
diff --git a/apps/plugins/lib/bmp_smooth_scale.c b/apps/plugins/lib/bmp_smooth_scale.c
index e99ff33d71..c5f258cdbf 100644
--- a/apps/plugins/lib/bmp_smooth_scale.c
+++ b/apps/plugins/lib/bmp_smooth_scale.c
@@ -130,38 +130,38 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
130 130
131 if (XAP > 0) { 131 if (XAP > 0) {
132 pix = ypoint + xpoint; 132 pix = ypoint + xpoint;
133 r = RGB_UNPACK_RED(*pix) * INV_XAP; 133 r = FB_UNPACK_RED(*pix) * INV_XAP;
134 g = RGB_UNPACK_GREEN(*pix) * INV_XAP; 134 g = FB_UNPACK_GREEN(*pix) * INV_XAP;
135 b = RGB_UNPACK_BLUE(*pix) * INV_XAP; 135 b = FB_UNPACK_BLUE(*pix) * INV_XAP;
136 pix++; 136 pix++;
137 r += RGB_UNPACK_RED(*pix) * XAP; 137 r += FB_UNPACK_RED(*pix) * XAP;
138 g += RGB_UNPACK_GREEN(*pix) * XAP; 138 g += FB_UNPACK_GREEN(*pix) * XAP;
139 b += RGB_UNPACK_BLUE(*pix) * XAP; 139 b += FB_UNPACK_BLUE(*pix) * XAP;
140 pix += sow; 140 pix += sow;
141 rr = RGB_UNPACK_RED(*pix) * XAP; 141 rr = FB_UNPACK_RED(*pix) * XAP;
142 gg = RGB_UNPACK_GREEN(*pix) * XAP; 142 gg = FB_UNPACK_GREEN(*pix) * XAP;
143 bb = RGB_UNPACK_BLUE(*pix) * XAP; 143 bb = FB_UNPACK_BLUE(*pix) * XAP;
144 pix--; 144 pix--;
145 rr += RGB_UNPACK_RED(*pix) * INV_XAP; 145 rr += FB_UNPACK_RED(*pix) * INV_XAP;
146 gg += RGB_UNPACK_GREEN(*pix) * INV_XAP; 146 gg += FB_UNPACK_GREEN(*pix) * INV_XAP;
147 bb += RGB_UNPACK_BLUE(*pix) * INV_XAP; 147 bb += FB_UNPACK_BLUE(*pix) * INV_XAP;
148 r = ((rr * YAP) + (r * INV_YAP)) >> 16; 148 r = ((rr * YAP) + (r * INV_YAP)) >> 16;
149 g = ((gg * YAP) + (g * INV_YAP)) >> 16; 149 g = ((gg * YAP) + (g * INV_YAP)) >> 16;
150 b = ((bb * YAP) + (b * INV_YAP)) >> 16; 150 b = ((bb * YAP) + (b * INV_YAP)) >> 16;
151 *dptr++ = LCD_RGBPACK(r, g, b); 151 *dptr++ = FB_RGBPACK(r, g, b);
152 } else { 152 } else {
153 pix = ypoint + xpoint; 153 pix = ypoint + xpoint;
154 r = RGB_UNPACK_RED(*pix) * INV_YAP; 154 r = FB_UNPACK_RED(*pix) * INV_YAP;
155 g = RGB_UNPACK_GREEN(*pix) * INV_YAP; 155 g = FB_UNPACK_GREEN(*pix) * INV_YAP;
156 b = RGB_UNPACK_BLUE(*pix) * INV_YAP; 156 b = FB_UNPACK_BLUE(*pix) * INV_YAP;
157 pix += sow; 157 pix += sow;
158 r += RGB_UNPACK_RED(*pix) * YAP; 158 r += FB_UNPACK_RED(*pix) * YAP;
159 g += RGB_UNPACK_GREEN(*pix) * YAP; 159 g += FB_UNPACK_GREEN(*pix) * YAP;
160 b += RGB_UNPACK_BLUE(*pix) * YAP; 160 b += FB_UNPACK_BLUE(*pix) * YAP;
161 r >>= 8; 161 r >>= 8;
162 g >>= 8; 162 g >>= 8;
163 b >>= 8; 163 b >>= 8;
164 *dptr++ = LCD_RGBPACK(r, g, b); 164 *dptr++ = FB_RGBPACK(r, g, b);
165 } 165 }
166 } 166 }
167 } else { 167 } else {
@@ -176,17 +176,17 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
176 176
177 if (XAP > 0) { 177 if (XAP > 0) {
178 pix = ypoint + xpoint; 178 pix = ypoint + xpoint;
179 r = RGB_UNPACK_RED(*pix) * INV_XAP; 179 r = FB_UNPACK_RED(*pix) * INV_XAP;
180 g = RGB_UNPACK_GREEN(*pix) * INV_XAP; 180 g = FB_UNPACK_GREEN(*pix) * INV_XAP;
181 b = RGB_UNPACK_BLUE(*pix) * INV_XAP; 181 b = FB_UNPACK_BLUE(*pix) * INV_XAP;
182 pix++; 182 pix++;
183 r += RGB_UNPACK_RED(*pix) * XAP; 183 r += FB_UNPACK_RED(*pix) * XAP;
184 g += RGB_UNPACK_GREEN(*pix) * XAP; 184 g += FB_UNPACK_GREEN(*pix) * XAP;
185 b += RGB_UNPACK_BLUE(*pix) * XAP; 185 b += FB_UNPACK_BLUE(*pix) * XAP;
186 r >>= 8; 186 r >>= 8;
187 g >>= 8; 187 g >>= 8;
188 b >>= 8; 188 b >>= 8;
189 *dptr++ = LCD_RGBPACK(r, g, b); 189 *dptr++ = FB_RGBPACK(r, g, b);
190 } else 190 } else
191 *dptr++ = sptr[xpoint]; 191 *dptr++ = sptr[xpoint];
192 } 192 }
@@ -221,37 +221,37 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
221 val_x += inc_x; 221 val_x += inc_x;
222 222
223 pix = ypoint + xpoint; 223 pix = ypoint + xpoint;
224 r = (RGB_UNPACK_RED(*pix) * yap) >> 10; 224 r = (FB_UNPACK_RED(*pix) * yap) >> 10;
225 g = (RGB_UNPACK_GREEN(*pix) * yap) >> 10; 225 g = (FB_UNPACK_GREEN(*pix) * yap) >> 10;
226 b = (RGB_UNPACK_BLUE(*pix) * yap) >> 10; 226 b = (FB_UNPACK_BLUE(*pix) * yap) >> 10;
227 pix += sow; 227 pix += sow;
228 for (j = (1 << 14) - yap; j > Cy; j -= Cy) { 228 for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
229 r += (RGB_UNPACK_RED(*pix) * Cy) >> 10; 229 r += (FB_UNPACK_RED(*pix) * Cy) >> 10;
230 g += (RGB_UNPACK_GREEN(*pix) * Cy) >> 10; 230 g += (FB_UNPACK_GREEN(*pix) * Cy) >> 10;
231 b += (RGB_UNPACK_BLUE(*pix) * Cy) >> 10; 231 b += (FB_UNPACK_BLUE(*pix) * Cy) >> 10;
232 pix += sow; 232 pix += sow;
233 } 233 }
234 if (j > 0) { 234 if (j > 0) {
235 r += (RGB_UNPACK_RED(*pix) * j) >> 10; 235 r += (FB_UNPACK_RED(*pix) * j) >> 10;
236 g += (RGB_UNPACK_GREEN(*pix) * j) >> 10; 236 g += (FB_UNPACK_GREEN(*pix) * j) >> 10;
237 b += (RGB_UNPACK_BLUE(*pix) * j) >> 10; 237 b += (FB_UNPACK_BLUE(*pix) * j) >> 10;
238 } 238 }
239 if (XAP > 0) { 239 if (XAP > 0) {
240 pix = ypoint + xpoint + 1; 240 pix = ypoint + xpoint + 1;
241 rr = (RGB_UNPACK_RED(*pix) * yap) >> 10; 241 rr = (FB_UNPACK_RED(*pix) * yap) >> 10;
242 gg = (RGB_UNPACK_GREEN(*pix) * yap) >> 10; 242 gg = (FB_UNPACK_GREEN(*pix) * yap) >> 10;
243 bb = (RGB_UNPACK_BLUE(*pix) * yap) >> 10; 243 bb = (FB_UNPACK_BLUE(*pix) * yap) >> 10;
244 pix += sow; 244 pix += sow;
245 for (j = (1 << 14) - yap; j > Cy; j -= Cy) { 245 for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
246 rr += (RGB_UNPACK_RED(*pix) * Cy) >> 10; 246 rr += (FB_UNPACK_RED(*pix) * Cy) >> 10;
247 gg += (RGB_UNPACK_GREEN(*pix) * Cy) >> 10; 247 gg += (FB_UNPACK_GREEN(*pix) * Cy) >> 10;
248 bb += (RGB_UNPACK_BLUE(*pix) * Cy) >> 10; 248 bb += (FB_UNPACK_BLUE(*pix) * Cy) >> 10;
249 pix += sow; 249 pix += sow;
250 } 250 }
251 if (j > 0) { 251 if (j > 0) {
252 rr += (RGB_UNPACK_RED(*pix) * j) >> 10; 252 rr += (FB_UNPACK_RED(*pix) * j) >> 10;
253 gg += (RGB_UNPACK_GREEN(*pix) * j) >> 10; 253 gg += (FB_UNPACK_GREEN(*pix) * j) >> 10;
254 bb += (RGB_UNPACK_BLUE(*pix) * j) >> 10; 254 bb += (FB_UNPACK_BLUE(*pix) * j) >> 10;
255 } 255 }
256 r = r * INV_XAP; 256 r = r * INV_XAP;
257 g = g * INV_XAP; 257 g = g * INV_XAP;
@@ -264,7 +264,7 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
264 g >>= 4; 264 g >>= 4;
265 b >>= 4; 265 b >>= 4;
266 } 266 }
267 *dptr = LCD_RGBPACK(r, g, b); 267 *dptr = FB_RGBPACK(r, g, b);
268 dptr++; 268 dptr++;
269 } 269 }
270 } 270 }
@@ -297,37 +297,37 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
297 xap = XAP & 0xffff; 297 xap = XAP & 0xffff;
298 298
299 pix = ypoint + xpoint; 299 pix = ypoint + xpoint;
300 r = (RGB_UNPACK_RED(*pix) * xap) >> 10; 300 r = (FB_UNPACK_RED(*pix) * xap) >> 10;
301 g = (RGB_UNPACK_GREEN(*pix) * xap) >> 10; 301 g = (FB_UNPACK_GREEN(*pix) * xap) >> 10;
302 b = (RGB_UNPACK_BLUE(*pix) * xap) >> 10; 302 b = (FB_UNPACK_BLUE(*pix) * xap) >> 10;
303 pix++; 303 pix++;
304 for (j = (1 << 14) - xap; j > Cx; j -= Cx) { 304 for (j = (1 << 14) - xap; j > Cx; j -= Cx) {
305 r += (RGB_UNPACK_RED(*pix) * Cx) >> 10; 305 r += (FB_UNPACK_RED(*pix) * Cx) >> 10;
306 g += (RGB_UNPACK_GREEN(*pix) * Cx) >> 10; 306 g += (FB_UNPACK_GREEN(*pix) * Cx) >> 10;
307 b += (RGB_UNPACK_BLUE(*pix) * Cx) >> 10; 307 b += (FB_UNPACK_BLUE(*pix) * Cx) >> 10;
308 pix++; 308 pix++;
309 } 309 }
310 if (j > 0) { 310 if (j > 0) {
311 r += (RGB_UNPACK_RED(*pix) * j) >> 10; 311 r += (FB_UNPACK_RED(*pix) * j) >> 10;
312 g += (RGB_UNPACK_GREEN(*pix) * j) >> 10; 312 g += (FB_UNPACK_GREEN(*pix) * j) >> 10;
313 b += (RGB_UNPACK_BLUE(*pix) * j) >> 10; 313 b += (FB_UNPACK_BLUE(*pix) * j) >> 10;
314 } 314 }
315 if (YAP > 0) { 315 if (YAP > 0) {
316 pix = ypoint + xpoint + sow; 316 pix = ypoint + xpoint + sow;
317 rr = (RGB_UNPACK_RED(*pix) * xap) >> 10; 317 rr = (FB_UNPACK_RED(*pix) * xap) >> 10;
318 gg = (RGB_UNPACK_GREEN(*pix) * xap) >> 10; 318 gg = (FB_UNPACK_GREEN(*pix) * xap) >> 10;
319 bb = (RGB_UNPACK_BLUE(*pix) * xap) >> 10; 319 bb = (FB_UNPACK_BLUE(*pix) * xap) >> 10;
320 pix++; 320 pix++;
321 for (j = (1 << 14) - xap; j > Cx; j -= Cx) { 321 for (j = (1 << 14) - xap; j > Cx; j -= Cx) {
322 rr += (RGB_UNPACK_RED(*pix) * Cx) >> 10; 322 rr += (FB_UNPACK_RED(*pix) * Cx) >> 10;
323 gg += (RGB_UNPACK_GREEN(*pix) * Cx) >> 10; 323 gg += (FB_UNPACK_GREEN(*pix) * Cx) >> 10;
324 bb += (RGB_UNPACK_BLUE(*pix) * Cx) >> 10; 324 bb += (FB_UNPACK_BLUE(*pix) * Cx) >> 10;
325 pix++; 325 pix++;
326 } 326 }
327 if (j > 0) { 327 if (j > 0) {
328 rr += (RGB_UNPACK_RED(*pix) * j) >> 10; 328 rr += (FB_UNPACK_RED(*pix) * j) >> 10;
329 gg += (RGB_UNPACK_GREEN(*pix) * j) >> 10; 329 gg += (FB_UNPACK_GREEN(*pix) * j) >> 10;
330 bb += (RGB_UNPACK_BLUE(*pix) * j) >> 10; 330 bb += (FB_UNPACK_BLUE(*pix) * j) >> 10;
331 } 331 }
332 r = r * INV_YAP; 332 r = r * INV_YAP;
333 g = g * INV_YAP; 333 g = g * INV_YAP;
@@ -340,7 +340,7 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
340 g >>= 4; 340 g >>= 4;
341 b >>= 4; 341 b >>= 4;
342 } 342 }
343 *dptr = LCD_RGBPACK(r, g, b); 343 *dptr = FB_RGBPACK(r, g, b);
344 dptr++; 344 dptr++;
345 } 345 }
346 } 346 }
@@ -378,20 +378,20 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
378 378
379 pix = sptr; 379 pix = sptr;
380 sptr += sow; 380 sptr += sow;
381 rx = (RGB_UNPACK_RED(*pix) * xap) >> 9; 381 rx = (FB_UNPACK_RED(*pix) * xap) >> 9;
382 gx = (RGB_UNPACK_GREEN(*pix) * xap) >> 9; 382 gx = (FB_UNPACK_GREEN(*pix) * xap) >> 9;
383 bx = (RGB_UNPACK_BLUE(*pix) * xap) >> 9; 383 bx = (FB_UNPACK_BLUE(*pix) * xap) >> 9;
384 pix++; 384 pix++;
385 for (i = (1 << 14) - xap; i > Cx; i -= Cx) { 385 for (i = (1 << 14) - xap; i > Cx; i -= Cx) {
386 rx += (RGB_UNPACK_RED(*pix) * Cx) >> 9; 386 rx += (FB_UNPACK_RED(*pix) * Cx) >> 9;
387 gx += (RGB_UNPACK_GREEN(*pix) * Cx) >> 9; 387 gx += (FB_UNPACK_GREEN(*pix) * Cx) >> 9;
388 bx += (RGB_UNPACK_BLUE(*pix) * Cx) >> 9; 388 bx += (FB_UNPACK_BLUE(*pix) * Cx) >> 9;
389 pix++; 389 pix++;
390 } 390 }
391 if (i > 0) { 391 if (i > 0) {
392 rx += (RGB_UNPACK_RED(*pix) * i) >> 9; 392 rx += (FB_UNPACK_RED(*pix) * i) >> 9;
393 gx += (RGB_UNPACK_GREEN(*pix) * i) >> 9; 393 gx += (FB_UNPACK_GREEN(*pix) * i) >> 9;
394 bx += (RGB_UNPACK_BLUE(*pix) * i) >> 9; 394 bx += (FB_UNPACK_BLUE(*pix) * i) >> 9;
395 } 395 }
396 396
397 r = (rx * yap) >> 14; 397 r = (rx * yap) >> 14;
@@ -401,20 +401,20 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
401 for (j = (1 << 14) - yap; j > Cy; j -= Cy) { 401 for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
402 pix = sptr; 402 pix = sptr;
403 sptr += sow; 403 sptr += sow;
404 rx = (RGB_UNPACK_RED(*pix) * xap) >> 9; 404 rx = (FB_UNPACK_RED(*pix) * xap) >> 9;
405 gx = (RGB_UNPACK_GREEN(*pix) * xap) >> 9; 405 gx = (FB_UNPACK_GREEN(*pix) * xap) >> 9;
406 bx = (RGB_UNPACK_BLUE(*pix) * xap) >> 9; 406 bx = (FB_UNPACK_BLUE(*pix) * xap) >> 9;
407 pix++; 407 pix++;
408 for (i = (1 << 14) - xap; i > Cx; i -= Cx) { 408 for (i = (1 << 14) - xap; i > Cx; i -= Cx) {
409 rx += (RGB_UNPACK_RED(*pix) * Cx) >> 9; 409 rx += (FB_UNPACK_RED(*pix) * Cx) >> 9;
410 gx += (RGB_UNPACK_GREEN(*pix) * Cx) >> 9; 410 gx += (FB_UNPACK_GREEN(*pix) * Cx) >> 9;
411 bx += (RGB_UNPACK_BLUE(*pix) * Cx) >> 9; 411 bx += (FB_UNPACK_BLUE(*pix) * Cx) >> 9;
412 pix++; 412 pix++;
413 } 413 }
414 if (i > 0) { 414 if (i > 0) {
415 rx += (RGB_UNPACK_RED(*pix) * i) >> 9; 415 rx += (FB_UNPACK_RED(*pix) * i) >> 9;
416 gx += (RGB_UNPACK_GREEN(*pix) * i) >> 9; 416 gx += (FB_UNPACK_GREEN(*pix) * i) >> 9;
417 bx += (RGB_UNPACK_BLUE(*pix) * i) >> 9; 417 bx += (FB_UNPACK_BLUE(*pix) * i) >> 9;
418 } 418 }
419 419
420 r += (rx * Cy) >> 14; 420 r += (rx * Cy) >> 14;
@@ -424,20 +424,20 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
424 if (j > 0) { 424 if (j > 0) {
425 pix = sptr; 425 pix = sptr;
426 sptr += sow; 426 sptr += sow;
427 rx = (RGB_UNPACK_RED(*pix) * xap) >> 9; 427 rx = (FB_UNPACK_RED(*pix) * xap) >> 9;
428 gx = (RGB_UNPACK_GREEN(*pix) * xap) >> 9; 428 gx = (FB_UNPACK_GREEN(*pix) * xap) >> 9;
429 bx = (RGB_UNPACK_BLUE(*pix) * xap) >> 9; 429 bx = (FB_UNPACK_BLUE(*pix) * xap) >> 9;
430 pix++; 430 pix++;
431 for (i = (1 << 14) - xap; i > Cx; i -= Cx) { 431 for (i = (1 << 14) - xap; i > Cx; i -= Cx) {
432 rx += (RGB_UNPACK_RED(*pix) * Cx) >> 9; 432 rx += (FB_UNPACK_RED(*pix) * Cx) >> 9;
433 gx += (RGB_UNPACK_GREEN(*pix) * Cx) >> 9; 433 gx += (FB_UNPACK_GREEN(*pix) * Cx) >> 9;
434 bx += (RGB_UNPACK_BLUE(*pix) * Cx) >> 9; 434 bx += (FB_UNPACK_BLUE(*pix) * Cx) >> 9;
435 pix++; 435 pix++;
436 } 436 }
437 if (i > 0) { 437 if (i > 0) {
438 rx += (RGB_UNPACK_RED(*pix) * i) >> 9; 438 rx += (FB_UNPACK_RED(*pix) * i) >> 9;
439 gx += (RGB_UNPACK_GREEN(*pix) * i) >> 9; 439 gx += (FB_UNPACK_GREEN(*pix) * i) >> 9;
440 bx += (RGB_UNPACK_BLUE(*pix) * i) >> 9; 440 bx += (FB_UNPACK_BLUE(*pix) * i) >> 9;
441 } 441 }
442 442
443 r += (rx * j) >> 14; 443 r += (rx * j) >> 14;
@@ -445,7 +445,7 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp)
445 b += (bx * j) >> 14; 445 b += (bx * j) >> 14;
446 } 446 }
447 447
448 *dptr = LCD_RGBPACK(r >> 5, g >> 5, b >> 5); 448 *dptr = FB_RGBPACK(r >> 5, g >> 5, b >> 5);
449 dptr++; 449 dptr++;
450 } 450 }
451 } 451 }
diff --git a/apps/plugins/lib/osd.c b/apps/plugins/lib/osd.c
index 598a76759c..e6fc39178a 100644
--- a/apps/plugins/lib/osd.c
+++ b/apps/plugins/lib/osd.c
@@ -112,6 +112,9 @@ static struct osd grey_osd;
112# define _OSD_WIDTH2BYTES(w) ((w)*2) 112# define _OSD_WIDTH2BYTES(w) ((w)*2)
113# define _OSD_BYTES2WIDTH(b) ((b)/2) 113# define _OSD_BYTES2WIDTH(b) ((b)/2)
114# endif /* end stride type selection */ 114# endif /* end stride type selection */
115#elif LCD_DEPTH == 24
116# define _OSD_WIDTH2BYTES(w) ((w)*3)
117# define _OSD_BYTES2WIDTH(b) ((b)/3)
115#else /* other LCD depth */ 118#else /* other LCD depth */
116# error Unknown LCD depth; please define macros 119# error Unknown LCD depth; please define macros
117#endif /* LCD_DEPTH */ 120#endif /* LCD_DEPTH */
diff --git a/apps/plugins/lib/pluginlib_bmp.c b/apps/plugins/lib/pluginlib_bmp.c
index f1dd9b7b38..f3edfbf425 100644
--- a/apps/plugins/lib/pluginlib_bmp.c
+++ b/apps/plugins/lib/pluginlib_bmp.c
@@ -70,9 +70,9 @@ int save_bmp_file( char* filename, struct bitmap *bm )
70 fb_data *d = (fb_data*)( bm->data ) + (x+y*bm->width); 70 fb_data *d = (fb_data*)( bm->data ) + (x+y*bm->width);
71 unsigned char c[] = 71 unsigned char c[] =
72 { 72 {
73 RGB_UNPACK_BLUE( *d ), 73 FB_UNPACK_BLUE( *d ),
74 RGB_UNPACK_GREEN( *d ), 74 FB_UNPACK_GREEN( *d ),
75 RGB_UNPACK_RED( *d ) 75 FB_UNPACK_RED( *d )
76 }; 76 };
77 rb->write( fh, c, 3 ); 77 rb->write( fh, c, 3 );
78 } 78 }
diff --git a/apps/plugins/lib/xlcd_draw.c b/apps/plugins/lib/xlcd_draw.c
index 3be15718f6..83ddf68e5c 100644
--- a/apps/plugins/lib/xlcd_draw.c
+++ b/apps/plugins/lib/xlcd_draw.c
@@ -170,7 +170,7 @@ void xlcd_filltriangle_screen(struct screen* display,
170 xlcd_filltriangle_vertical(display, x1, y1, x2, y2, x3, y3); 170 xlcd_filltriangle_vertical(display, x1, y1, x2, y2, x3, y3);
171} 171}
172 172
173#if LCD_DEPTH >= 8 173#if LCD_DEPTH >= 8 && LCD_DEPTH <= 16
174 174
175#ifdef HAVE_LCD_COLOR 175#ifdef HAVE_LCD_COLOR
176static const fb_data graylut[256] = { 176static const fb_data graylut[256] = {
@@ -244,6 +244,8 @@ static const fb_data graylut[256] = {
244}; 244};
245#endif /* HAVE_LCD_COLOR */ 245#endif /* HAVE_LCD_COLOR */
246 246
247/* unused functions, enable when needed */
248#if 0
247/* Draw a partial greyscale bitmap, canonical 8 bit format */ 249/* Draw a partial greyscale bitmap, canonical 8 bit format */
248void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y, 250void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
249 int stride, int x, int y, int width, int height) 251 int stride, int x, int y, int width, int height)
@@ -286,7 +288,13 @@ void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
286 288
287#ifdef HAVE_LCD_COLOR 289#ifdef HAVE_LCD_COLOR
288 do 290 do
291#if LCD_DEPTH == 16
289 *dst_row++ = graylut[*src_row++]; 292 *dst_row++ = graylut[*src_row++];
293#else
294 /* untested change because this function is completely unused */
295 *dst_row->r = *dst_row->g = *dst_row->b = *src_row++;
296 dst_row++;
297#endif
290 while (src_row < row_end); 298 while (src_row < row_end);
291#endif 299#endif
292 300
@@ -302,6 +310,7 @@ void xlcd_gray_bitmap(const unsigned char *src, int x, int y, int width,
302{ 310{
303 xlcd_gray_bitmap_part(src, 0, 0, width, x, y, width, height); 311 xlcd_gray_bitmap_part(src, 0, 0, width, x, y, width, height);
304} 312}
313#endif
305 314
306#ifdef HAVE_LCD_COLOR 315#ifdef HAVE_LCD_COLOR
307/* Draw a partial colour bitmap, canonical 24 bit RGB format */ 316/* Draw a partial colour bitmap, canonical 24 bit RGB format */
@@ -379,4 +388,3 @@ void xlcd_color_bitmap(const unsigned char *src, int x, int y, int width,
379#endif /* LCD_DEPTH >= 8 */ 388#endif /* LCD_DEPTH >= 8 */
380 389
381#endif /* HAVE_LCD_BITMAP */ 390#endif /* HAVE_LCD_BITMAP */
382
diff --git a/apps/plugins/logo.c b/apps/plugins/logo.c
index aae9e54562..a7257fae4b 100644
--- a/apps/plugins/logo.c
+++ b/apps/plugins/logo.c
@@ -42,14 +42,12 @@ static const struct button_mapping *plugin_contexts[]
42#define REMOTE_LOGO_WIDTH BMPWIDTH_remote_rockboxlogo 42#define REMOTE_LOGO_WIDTH BMPWIDTH_remote_rockboxlogo
43#define REMOTE_LOGO_HEIGHT BMPHEIGHT_remote_rockboxlogo 43#define REMOTE_LOGO_HEIGHT BMPHEIGHT_remote_rockboxlogo
44#define REMOTE_LOGO remote_rockboxlogo 44#define REMOTE_LOGO remote_rockboxlogo
45extern const fb_remote_data remote_rockboxlogo[];
46#endif /* HAVE_REMOTE_LCD */ 45#endif /* HAVE_REMOTE_LCD */
47 46
48#define LOGO rockboxlogo 47#define LOGO rockboxlogo
49#include "pluginbitmaps/rockboxlogo.h" 48#include "pluginbitmaps/rockboxlogo.h"
50#define LOGO_WIDTH BMPWIDTH_rockboxlogo 49#define LOGO_WIDTH BMPWIDTH_rockboxlogo
51#define LOGO_HEIGHT BMPHEIGHT_rockboxlogo 50#define LOGO_HEIGHT BMPHEIGHT_rockboxlogo
52extern const fb_data rockboxlogo[];
53 51
54#else /* !LCD_BITMAP */ 52#else /* !LCD_BITMAP */
55#define DISPLAY_WIDTH 55 53#define DISPLAY_WIDTH 55
@@ -103,10 +101,10 @@ enum plugin_status plugin_start(const void* parameter) {
103 while (1) { 101 while (1) {
104#ifdef HAVE_LCD_BITMAP 102#ifdef HAVE_LCD_BITMAP
105 rb->lcd_clear_display(); 103 rb->lcd_clear_display();
106 rb->lcd_bitmap(LOGO, x, y, LOGO_WIDTH, LOGO_HEIGHT); 104 rb->lcd_bitmap((const fb_data*)LOGO, x, y, LOGO_WIDTH, LOGO_HEIGHT);
107#ifdef REMOTE_LOGO 105#ifdef REMOTE_LOGO
108 rb->lcd_remote_clear_display(); 106 rb->lcd_remote_clear_display();
109 rb->lcd_remote_bitmap(REMOTE_LOGO, 107 rb->lcd_remote_bitmap((const fb_data*)REMOTE_LOGO,
110 (x * (REMOTE_WIDTH - REMOTE_LOGO_WIDTH)) / (DISPLAY_WIDTH - LOGO_WIDTH), 108 (x * (REMOTE_WIDTH - REMOTE_LOGO_WIDTH)) / (DISPLAY_WIDTH - LOGO_WIDTH),
111 (y * (REMOTE_HEIGHT - REMOTE_LOGO_HEIGHT)) / (DISPLAY_HEIGHT - LOGO_HEIGHT), 109 (y * (REMOTE_HEIGHT - REMOTE_LOGO_HEIGHT)) / (DISPLAY_HEIGHT - LOGO_HEIGHT),
112 REMOTE_LOGO_WIDTH, REMOTE_LOGO_HEIGHT); 110 REMOTE_LOGO_WIDTH, REMOTE_LOGO_HEIGHT);
@@ -195,5 +193,3 @@ enum plugin_status plugin_start(const void* parameter) {
195 } 193 }
196 } 194 }
197} 195}
198
199
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index 27c1177748..2268063d3f 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -138,14 +138,14 @@ static fb_data* rli_element(lua_State *L)
138 138
139static int rli_set(lua_State *L) 139static int rli_set(lua_State *L)
140{ 140{
141 fb_data newvalue = (fb_data) luaL_checknumber(L, 4); 141 fb_data newvalue = FB_SCALARPACK((unsigned)luaL_checknumber(L, 4));
142 *rli_element(L) = newvalue; 142 *rli_element(L) = newvalue;
143 return 0; 143 return 0;
144} 144}
145 145
146static int rli_get(lua_State *L) 146static int rli_get(lua_State *L)
147{ 147{
148 lua_pushnumber(L, *rli_element(L)); 148 lua_pushnumber(L, FB_UNPACK_SCALAR_LCD(*rli_element(L)));
149 return 1; 149 return 1;
150} 150}
151 151
diff --git a/apps/plugins/mpegplayer/alloc.c b/apps/plugins/mpegplayer/alloc.c
index eb58c67f44..cbf930a7eb 100644
--- a/apps/plugins/mpegplayer/alloc.c
+++ b/apps/plugins/mpegplayer/alloc.c
@@ -231,4 +231,3 @@ void codec_free(void* ptr)
231#endif 231#endif
232 (void)ptr; 232 (void)ptr;
233} 233}
234
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 2e84a870a9..97fe7d3f4c 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -702,7 +702,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
702 dst_col--; 702 dst_col--;
703 703
704 if (data & 1) 704 if (data & 1)
705 *dst_col = fg_pattern; 705 *dst_col = FB_SCALARPACK(fg_pattern);
706#if 0 706#if 0
707 else 707 else
708 *dst_col = bg_pattern; 708 *dst_col = bg_pattern;
@@ -719,7 +719,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
719 while (src < src_end); 719 while (src < src_end);
720} 720}
721 721
722/* draw alpha bitmap for anti-alias font */ 722
723#define ALPHA_COLOR_FONT_DEPTH 2 723#define ALPHA_COLOR_FONT_DEPTH 2
724#define ALPHA_COLOR_LOOKUP_SHIFT (1 << ALPHA_COLOR_FONT_DEPTH) 724#define ALPHA_COLOR_LOOKUP_SHIFT (1 << ALPHA_COLOR_FONT_DEPTH)
725#define ALPHA_COLOR_LOOKUP_SIZE ((1 << ALPHA_COLOR_LOOKUP_SHIFT) - 1) 725#define ALPHA_COLOR_LOOKUP_SIZE ((1 << ALPHA_COLOR_LOOKUP_SHIFT) - 1)
@@ -727,6 +727,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
727#define ALPHA_COLOR_PIXEL_PER_WORD (32 >> ALPHA_COLOR_FONT_DEPTH) 727#define ALPHA_COLOR_PIXEL_PER_WORD (32 >> ALPHA_COLOR_FONT_DEPTH)
728#ifdef CPU_ARM 728#ifdef CPU_ARM
729#define BLEND_INIT do {} while (0) 729#define BLEND_INIT do {} while (0)
730#define BLEND_FINISH do {} while(0)
730#define BLEND_START(acc, color, alpha) \ 731#define BLEND_START(acc, color, alpha) \
731 asm volatile("mul %0, %1, %2" : "=&r" (acc) : "r" (color), "r" (alpha)) 732 asm volatile("mul %0, %1, %2" : "=&r" (acc) : "r" (color), "r" (alpha))
732#define BLEND_CONT(acc, color, alpha) \ 733#define BLEND_CONT(acc, color, alpha) \
@@ -734,13 +735,18 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
734#define BLEND_OUT(acc) do {} while (0) 735#define BLEND_OUT(acc) do {} while (0)
735#elif defined(CPU_COLDFIRE) 736#elif defined(CPU_COLDFIRE)
736#define ALPHA_BITMAP_READ_WORDS 737#define ALPHA_BITMAP_READ_WORDS
737#define BLEND_INIT coldfire_set_macsr(EMAC_UNSIGNED) 738#define BLEND_INIT \
739 unsigned long _macsr = coldfire_get_macsr(); \
740 coldfire_set_macsr(EMAC_UNSIGNED)
741#define BLEND_FINISH \
742 coldfire_set_macsr(_macsr)
738#define BLEND_START(acc, color, alpha) \ 743#define BLEND_START(acc, color, alpha) \
739 asm volatile("mac.l %0, %1, %%acc0" :: "%d" (color), "d" (alpha)) 744 asm volatile("mac.l %0, %1, %%acc0" :: "%d" (color), "d" (alpha))
740#define BLEND_CONT BLEND_START 745#define BLEND_CONT BLEND_START
741#define BLEND_OUT(acc) asm volatile("movclr.l %%acc0, %0" : "=d" (acc)) 746#define BLEND_OUT(acc) asm volatile("movclr.l %%acc0, %0" : "=d" (acc))
742#else 747#else
743#define BLEND_INIT do {} while (0) 748#define BLEND_INIT do {} while (0)
749#define BLEND_FINISH do {} while(0)
744#define BLEND_START(acc, color, alpha) ((acc) = (color) * (alpha)) 750#define BLEND_START(acc, color, alpha) ((acc) = (color) * (alpha))
745#define BLEND_CONT(acc, color, alpha) ((acc) += (color) * (alpha)) 751#define BLEND_CONT(acc, color, alpha) ((acc) += (color) * (alpha))
746#define BLEND_OUT(acc) do {} while (0) 752#define BLEND_OUT(acc) do {} while (0)
@@ -749,6 +755,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src,
749/* Blend the given two colors */ 755/* Blend the given two colors */
750static inline unsigned blend_two_colors(unsigned c1, unsigned c2, unsigned a) 756static inline unsigned blend_two_colors(unsigned c1, unsigned c2, unsigned a)
751{ 757{
758#if LCD_DEPTH == 16
752 a += a >> (ALPHA_COLOR_LOOKUP_SHIFT - 1); 759 a += a >> (ALPHA_COLOR_LOOKUP_SHIFT - 1);
753#if (LCD_PIXELFORMAT == RGB565SWAPPED) 760#if (LCD_PIXELFORMAT == RGB565SWAPPED)
754 c1 = swap16(c1); 761 c1 = swap16(c1);
@@ -767,6 +774,20 @@ static inline unsigned blend_two_colors(unsigned c1, unsigned c2, unsigned a)
767#else 774#else
768 return p; 775 return p;
769#endif 776#endif
777
778#else /* LCD_DEPTH == 24 */
779 unsigned s = c1;
780 unsigned d = c2;
781 unsigned s1 = s & 0xff00ff;
782 unsigned d1 = d & 0xff00ff;
783 a += a >> (ALPHA_COLOR_LOOKUP_SHIFT - 1);
784 d1 = (d1 + ((s1 - d1) * a >> ALPHA_COLOR_LOOKUP_SHIFT)) & 0xff00ff;
785 s &= 0xff00;
786 d &= 0xff00;
787 d = (d + ((s - d) * a >> ALPHA_COLOR_LOOKUP_SHIFT)) & 0xff00;
788
789 return d1 | d;
790#endif
770} 791}
771 792
772static void draw_oriented_alpha_bitmap_part(const unsigned char *src, 793static void draw_oriented_alpha_bitmap_part(const unsigned char *src,
@@ -849,8 +870,9 @@ static void draw_oriented_alpha_bitmap_part(const unsigned char *src,
849#endif 870#endif
850 do 871 do
851 { 872 {
852 *dst=blend_two_colors(*dst, fg_pattern, 873 unsigned color = blend_two_colors(FB_UNPACK_SCALAR_LCD(*dst), fg_pattern,
853 data & ALPHA_COLOR_LOOKUP_SIZE ); 874 data & ALPHA_COLOR_LOOKUP_SIZE );
875 *dst= FB_SCALARPACK(color);
854 dst += LCD_WIDTH; 876 dst += LCD_WIDTH;
855 UPDATE_SRC_ALPHA; 877 UPDATE_SRC_ALPHA;
856 } 878 }
diff --git a/apps/plugins/pacbox/arcade.c b/apps/plugins/pacbox/arcade.c
index 426a81d487..236b5fc63d 100644
--- a/apps/plugins/pacbox/arcade.c
+++ b/apps/plugins/pacbox/arcade.c
@@ -340,7 +340,7 @@ void decodeROMs(void)
340 for( i=0; i<256; i++ ) { 340 for( i=0; i<256; i++ ) {
341 c = decoded_palette[ color_data_[i] & 0x0F ]; 341 c = decoded_palette[ color_data_[i] & 0x0F ];
342#ifdef HAVE_LCD_COLOR 342#ifdef HAVE_LCD_COLOR
343 palette[i] = LCD_RGBPACK((unsigned char) (c), 343 palette[i] = FB_RGBPACK((unsigned char) (c),
344 (unsigned char) (c >> 8), 344 (unsigned char) (c >> 8),
345 (unsigned char) (c >> 16)); 345 (unsigned char) (c >> 16));
346#else 346#else
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c
index 796b66a48d..1003b0c65c 100644
--- a/apps/plugins/pictureflow/pictureflow.c
+++ b/apps/plugins/pictureflow/pictureflow.c
@@ -470,7 +470,6 @@ static int pf_state;
470 470
471/** code */ 471/** code */
472static bool free_slide_prio(int prio); 472static bool free_slide_prio(int prio);
473static inline unsigned fade_color(pix_t c, unsigned a);
474bool load_new_slide(void); 473bool load_new_slide(void);
475int load_surface(int); 474int load_surface(int);
476 475
@@ -646,10 +645,15 @@ static inline PFreal fcos(int iangle)
646 return fsin(iangle + (IANGLE_MAX >> 2)); 645 return fsin(iangle + (IANGLE_MAX >> 2));
647} 646}
648 647
649static inline unsigned scale_val(unsigned val, unsigned bits) 648/* scales the 8bit subpixel value to native lcd format, indicated by bits */
649static inline unsigned scale_subpixel_lcd(unsigned val, unsigned bits)
650{ 650{
651 (void) bits;
652#if LCD_PIXELFORMAT != RGB888
651 val = val * ((1 << bits) - 1); 653 val = val * ((1 << bits) - 1);
652 return ((val >> 8) + val + 128) >> 8; 654 val = ((val >> 8) + val + 128) >> 8;
655#endif
656 return val;
653} 657}
654 658
655static void output_row_8_transposed(uint32_t row, void * row_in, 659static void output_row_8_transposed(uint32_t row, void * row_in,
@@ -666,10 +670,10 @@ static void output_row_8_transposed(uint32_t row, void * row_in,
666 unsigned r, g, b; 670 unsigned r, g, b;
667 for (; dest < end; dest += ctx->bm->height) 671 for (; dest < end; dest += ctx->bm->height)
668 { 672 {
669 r = scale_val(qp->red, 5); 673 r = scale_subpixel_lcd(qp->red, 5);
670 g = scale_val(qp->green, 6); 674 g = scale_subpixel_lcd(qp->green, 6);
671 b = scale_val((qp++)->blue, 5); 675 b = scale_subpixel_lcd((qp++)->blue, 5);
672 *dest = LCD_RGBPACK_LCD(r,g,b); 676 *dest = FB_RGBPACK_LCD(r,g,b);
673 } 677 }
674#endif 678#endif
675} 679}
@@ -690,11 +694,11 @@ static void output_row_32_transposed(uint32_t row, void * row_in,
690 int r, g, b; 694 int r, g, b;
691 for (; dest < end; dest += ctx->bm->height) 695 for (; dest < end; dest += ctx->bm->height)
692 { 696 {
693 r = scale_val(SC_OUT(qp->r, ctx), 5); 697 r = scale_subpixel_lcd(SC_OUT(qp->r, ctx), 5);
694 g = scale_val(SC_OUT(qp->g, ctx), 6); 698 g = scale_subpixel_lcd(SC_OUT(qp->g, ctx), 6);
695 b = scale_val(SC_OUT(qp->b, ctx), 5); 699 b = scale_subpixel_lcd(SC_OUT(qp->b, ctx), 5);
696 qp++; 700 qp++;
697 *dest = LCD_RGBPACK_LCD(r,g,b); 701 *dest = FB_RGBPACK_LCD(r,g,b);
698 } 702 }
699#endif 703#endif
700} 704}
@@ -714,10 +718,10 @@ static void output_row_32_transposed_fromyuv(uint32_t row, void * row_in,
714 v = SC_OUT(qp->r, ctx); 718 v = SC_OUT(qp->r, ctx);
715 qp++; 719 qp++;
716 yuv_to_rgb(y, u, v, &r, &g, &b); 720 yuv_to_rgb(y, u, v, &r, &g, &b);
717 r = scale_val(r, 5); 721 r = scale_subpixel_lcd(r, 5);
718 g = scale_val(g, 6); 722 g = scale_subpixel_lcd(g, 6);
719 b = scale_val(b, 5); 723 b = scale_subpixel_lcd(b, 5);
720 *dest = LCD_RGBPACK_LCD(r, g, b); 724 *dest = FB_RGBPACK_LCD(r, g, b);
721 } 725 }
722} 726}
723#endif 727#endif
@@ -1793,14 +1797,13 @@ static void recalc_offsets(void)
1793 offsetY = DISPLAY_WIDTH / 2 * (fsin(itilt) + PFREAL_ONE / 2); 1797 offsetY = DISPLAY_WIDTH / 2 * (fsin(itilt) + PFREAL_ONE / 2);
1794} 1798}
1795 1799
1796
1797/** 1800/**
1798 Fade the given color by spreading the fb_data (ushort) 1801 Fade the given color by spreading the fb_data
1799 to an uint, multiply and compress the result back to a ushort. 1802 to an uint, multiply and compress the result back to a fb_data.
1800 */ 1803 */
1801#if (LCD_PIXELFORMAT == RGB565SWAPPED) 1804static inline pix_t fade_color(pix_t c, unsigned a)
1802static inline unsigned fade_color(pix_t c, unsigned a)
1803{ 1805{
1806#if (LCD_PIXELFORMAT == RGB565SWAPPED)
1804 unsigned int result; 1807 unsigned int result;
1805 c = swap16(c); 1808 c = swap16(c);
1806 a = (a + 2) & 0x1fc; 1809 a = (a + 2) & 0x1fc;
@@ -1808,24 +1811,29 @@ static inline unsigned fade_color(pix_t c, unsigned a)
1808 result |= ((c & 0x7e0) * a) & 0x7e000; 1811 result |= ((c & 0x7e0) * a) & 0x7e000;
1809 result >>= 8; 1812 result >>= 8;
1810 return swap16(result); 1813 return swap16(result);
1811} 1814
1812#elif LCD_PIXELFORMAT == RGB565 1815#elif LCD_PIXELFORMAT == RGB565
1813static inline unsigned fade_color(pix_t c, unsigned a)
1814{
1815 unsigned int result; 1816 unsigned int result;
1816 a = (a + 2) & 0x1fc; 1817 a = (a + 2) & 0x1fc;
1817 result = ((c & 0xf81f) * a) & 0xf81f00; 1818 result = ((c & 0xf81f) * a) & 0xf81f00;
1818 result |= ((c & 0x7e0) * a) & 0x7e000; 1819 result |= ((c & 0x7e0) * a) & 0x7e000;
1819 result >>= 8; 1820 result >>= 8;
1820 return result; 1821 return result;
1821} 1822
1823#elif LCD_PIXELFORMAT == RGB888
1824 unsigned int pixel = FB_UNPACK_SCALAR_LCD(c);
1825 unsigned int result;
1826 a = (a + 2) & 0x1fc;
1827 result = ((pixel & 0xff00ff) * a) & 0xff00ff00;
1828 result |= ((pixel & 0x00ff00) * a) & 0x00ff0000;
1829 result >>= 8;
1830 return FB_SCALARPACK(result);
1831
1822#else 1832#else
1823static inline unsigned fade_color(pix_t c, unsigned a)
1824{
1825 unsigned val = c; 1833 unsigned val = c;
1826 return MULUQ(val, a) >> 8; 1834 return MULUQ(val, a) >> 8;
1827}
1828#endif 1835#endif
1836}
1829 1837
1830/** 1838/**
1831 * Render a single slide 1839 * Render a single slide
diff --git a/apps/plugins/plasma.c b/apps/plugins/plasma.c
index 5b2b3ae94d..541d53cdef 100644
--- a/apps/plugins/plasma.c
+++ b/apps/plugins/plasma.c
@@ -105,7 +105,7 @@ static void shades_generate(int time)
105 if (blue > 255) 105 if (blue > 255)
106 blue= 510 - blue; 106 blue= 510 - blue;
107 107
108 colours[i] = LCD_RGBPACK(red, green, blue); 108 colours[i] = FB_RGBPACK(red, green, blue);
109 109
110 r++; g++; b++; 110 r++; g++; b++;
111 } 111 }
diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c
index 77e834e52b..762f5befc4 100644
--- a/apps/plugins/rockblox.c
+++ b/apps/plugins/rockblox.c
@@ -789,7 +789,7 @@ static const short scoring[4] = { /* scoring for each number of lines */
789struct figure 789struct figure
790{ 790{
791#if LCD_DEPTH >= 2 791#if LCD_DEPTH >= 2
792 unsigned short color[3]; /* color of figure (light,middle,shadow) */ 792 unsigned int color[3]; /* color of figure (light,middle,shadow) */
793#endif 793#endif
794 unsigned short max_or; /* max orientations */ 794 unsigned short max_or; /* max orientations */
795 signed short shapeX[4], shapeY[4]; /* implementation of figures */ 795 signed short shapeX[4], shapeY[4]; /* implementation of figures */
diff --git a/apps/plugins/rockboy/lcd-gb.h b/apps/plugins/rockboy/lcd-gb.h
index 36b971a88b..239ccbec74 100644
--- a/apps/plugins/rockboy/lcd-gb.h
+++ b/apps/plugins/rockboy/lcd-gb.h
@@ -3,6 +3,7 @@
3#ifndef __LCD_GB_H__ 3#ifndef __LCD_GB_H__
4#define __LCD_GB_H__ 4#define __LCD_GB_H__
5 5
6#include "lcd.h"
6#include "defs.h" 7#include "defs.h"
7 8
8struct vissprite 9struct vissprite
@@ -23,7 +24,7 @@ struct scan
23#elif LCD_DEPTH > 4 24#elif LCD_DEPTH > 4
24 byte buf[256]; 25 byte buf[256];
25#endif 26#endif
26 un16 pal[64]; 27 fb_data pal[64];
27 byte pri[256]; 28 byte pri[256];
28 struct vissprite vs[16]; 29 struct vissprite vs[16];
29 int ns, l, x, y, s, t, u, v, wx, wy, wt, wv; 30 int ns, l, x, y, s, t, u, v, wx, wy, wt, wv;
@@ -61,6 +62,3 @@ void pal_dirty(void) ICODE_ATTR;
61void lcd_reset(void); 62void lcd_reset(void);
62 63
63#endif 64#endif
64
65
66
diff --git a/apps/plugins/rockboy/lcd.c b/apps/plugins/rockboy/lcd.c
index 2dc983f812..e8d43f772a 100644
--- a/apps/plugins/rockboy/lcd.c
+++ b/apps/plugins/rockboy/lcd.c
@@ -19,7 +19,7 @@ struct scan scan IBSS_ATTR;
19#define BG (scan.bg) 19#define BG (scan.bg)
20#define WND (scan.wnd) 20#define WND (scan.wnd)
21 21
22#if LCD_DEPTH ==16 22#if LCD_DEPTH >= 16
23#define BUF (scan.buf) 23#define BUF (scan.buf)
24#else 24#else
25#define BUF (scan.buf[scanline_ind]) 25#define BUF (scan.buf[scanline_ind])
@@ -1154,6 +1154,7 @@ void set_pal(void)
1154static void updatepalette(int i) 1154static void updatepalette(int i)
1155{ 1155{
1156 int c, r, g, b; 1156 int c, r, g, b;
1157 fb_data px;
1157 1158
1158 c = (lcd.pal[i<<1] | ((int)lcd.pal[(i<<1)|1] << 8)) & 0x7FFF; 1159 c = (lcd.pal[i<<1] | ((int)lcd.pal[(i<<1)|1] << 8)) & 0x7FFF;
1159 r = (c & 0x001F) << 3; 1160 r = (c & 0x001F) << 3;
@@ -1167,18 +1168,16 @@ static void updatepalette(int i)
1167 g = (g >> fb.cc[1].r) << fb.cc[1].l; 1168 g = (g >> fb.cc[1].r) << fb.cc[1].l;
1168 b = (b >> fb.cc[2].r) << fb.cc[2].l; 1169 b = (b >> fb.cc[2].r) << fb.cc[2].l;
1169 1170
1170#if LCD_PIXELFORMAT == RGB565
1171 c = r|g|b; 1171 c = r|g|b;
1172#elif LCD_PIXELFORMAT == RGB565SWAPPED 1172
1173 c = swap16(r|g|b); 1173 px = FB_SCALARPACK_LCD(c);
1174#endif
1175 1174
1176 /* updatepalette might get called, but the pallete does not necessarily 1175 /* updatepalette might get called, but the pallete does not necessarily
1177 * need to be updated. 1176 * need to be updated.
1178 */ 1177 */
1179 if(PAL[i]!=c) 1178 if(memcmp(&PAL[i], &px, sizeof(fb_data)))
1180 { 1179 {
1181 PAL[i] = c; 1180 PAL[i] = px;
1182#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) 1181#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
1183 rb->lcd_pal256_update_pal(PAL); 1182 rb->lcd_pal256_update_pal(PAL);
1184#endif 1183#endif
@@ -1256,4 +1255,3 @@ void lcd_reset(void)
1256 lcd_begin(); 1255 lcd_begin();
1257 vram_dirty(); 1256 vram_dirty();
1258} 1257}
1259
diff --git a/apps/plugins/rockboy/sys_rockbox.c b/apps/plugins/rockboy/sys_rockbox.c
index 1bf63b7a74..a758f73da3 100644
--- a/apps/plugins/rockboy/sys_rockbox.c
+++ b/apps/plugins/rockboy/sys_rockbox.c
@@ -261,12 +261,21 @@ void vid_init(void)
261 fb.enabled=1; 261 fb.enabled=1;
262 262
263#if defined(HAVE_LCD_COLOR) 263#if defined(HAVE_LCD_COLOR)
264#if LCD_DEPTH == 24
265 fb.cc[0].r = 0; /* 8-8 (wasted bits on red) */
266 fb.cc[0].l = 16; /* this is the offset to the R bits (24-8) */
267 fb.cc[1].r = 0; /* 8-6 (wasted bits on green) */
268 fb.cc[1].l = 8; /* This is the offset to the G bits (24-8-8) */
269 fb.cc[2].r = 0; /* 8-5 (wasted bits on red) */
270 fb.cc[2].l = 0; /* This is the offset to the B bits (24-8-8-8) */
271#else
264 fb.cc[0].r = 3; /* 8-5 (wasted bits on red) */ 272 fb.cc[0].r = 3; /* 8-5 (wasted bits on red) */
265 fb.cc[0].l = 11; /* this is the offset to the R bits (16-5) */ 273 fb.cc[0].l = 11; /* this is the offset to the R bits (16-5) */
266 fb.cc[1].r = 2; /* 8-6 (wasted bits on green) */ 274 fb.cc[1].r = 2; /* 8-6 (wasted bits on green) */
267 fb.cc[1].l = 5; /* This is the offset to the G bits (16-5-6) */ 275 fb.cc[1].l = 5; /* This is the offset to the G bits (16-5-6) */
268 fb.cc[2].r = 3; /* 8-5 (wasted bits on red) */ 276 fb.cc[2].r = 3; /* 8-5 (wasted bits on red) */
269 fb.cc[2].l = 0; /* This is the offset to the B bits (16-5-6-5) */ 277 fb.cc[2].l = 0; /* This is the offset to the B bits (16-5-6-5) */
278#endif
270#else 279#else
271 fb.mode=3; 280 fb.mode=3;
272#endif 281#endif
diff --git a/apps/plugins/superdom.c b/apps/plugins/superdom.c
index be480bcbb1..5e1479cd3b 100644
--- a/apps/plugins/superdom.c
+++ b/apps/plugins/superdom.c
@@ -23,8 +23,6 @@
23#include "lib/display_text.h" 23#include "lib/display_text.h"
24#include "pluginbitmaps/superdom_boarditems.h" 24#include "pluginbitmaps/superdom_boarditems.h"
25 25
26
27extern const fb_data superdom_boarditems[];
28char buf[255]; 26char buf[255];
29 27
30#define COLOUR_DARK 0 28#define COLOUR_DARK 0
@@ -32,7 +30,7 @@ char buf[255];
32 30
33#define MARGIN 5 31#define MARGIN 5
34 32
35#if (LCD_DEPTH == 16) 33#if (LCD_DEPTH >= 16)
36#define MY_BITMAP_PART rb->lcd_bitmap_transparent_part 34#define MY_BITMAP_PART rb->lcd_bitmap_transparent_part
37#else 35#else
38#define MY_BITMAP_PART rb->lcd_mono_bitmap_part 36#define MY_BITMAP_PART rb->lcd_mono_bitmap_part
diff --git a/apps/plugins/zxbox/zxvid_16bpp.c b/apps/plugins/zxbox/zxvid_16bpp.c
index 19ac0f2d5c..6380d3d7d7 100644
--- a/apps/plugins/zxbox/zxvid_16bpp.c
+++ b/apps/plugins/zxbox/zxvid_16bpp.c
@@ -12,7 +12,7 @@
12#define IB0 (0xFF-B0) 12#define IB0 (0xFF-B0)
13#define IB1 (0xFF-B1) 13#define IB1 (0xFF-B1)
14 14
15static const fb_data _16bpp_colors[32] = { 15static const unsigned _16bpp_colors[32] = {
16 /* normal */ 16 /* normal */
17 LCD_RGBPACK(N0, N0, N0), LCD_RGBPACK(N0, N0, N1), 17 LCD_RGBPACK(N0, N0, N0), LCD_RGBPACK(N0, N0, N1),
18 LCD_RGBPACK(N1, N0, N0), LCD_RGBPACK(N1, N0, N1), 18 LCD_RGBPACK(N1, N0, N0), LCD_RGBPACK(N1, N0, N1),
@@ -60,7 +60,7 @@ void update_screen(void)
60 */ 60 */
61 frameb = rb->lcd_framebuffer; 61 frameb = rb->lcd_framebuffer;
62 for ( y = 0 ; y < HEIGHT*WIDTH; y++ ){ 62 for ( y = 0 ; y < HEIGHT*WIDTH; y++ ){
63 frameb[y] = _16bpp_colors[(unsigned)sp_image[y]]; 63 frameb[y] = FB_SCALARPACK(_16bpp_colors[(unsigned)sp_image[y]]);
64 } 64 }
65 65
66#else 66#else
@@ -74,7 +74,7 @@ void update_screen(void)
74 srcx = 0; /* reset our x counter before each row... */ 74 srcx = 0; /* reset our x counter before each row... */
75 for(x = 0; x < LCD_WIDTH; x++) 75 for(x = 0; x < LCD_WIDTH; x++)
76 { 76 {
77 *frameb = _16bpp_colors[image[srcx>>16]]; 77 *frameb = FB_SCALARPACK(_16bpp_colors[image[srcx>>16]]);
78 srcx += X_STEP; /* move through source image */ 78 srcx += X_STEP; /* move through source image */
79 frameb++; 79 frameb++;
80 } 80 }
diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c
index a6d6dd71b1..a9cc34b2c6 100644
--- a/apps/recorder/bmp.c
+++ b/apps/recorder/bmp.c
@@ -455,7 +455,7 @@ void output_row_8_native(uint32_t row, void * row_in,
455 *dest++ |= vi_pattern[bright] << shift; 455 *dest++ |= vi_pattern[bright] << shift;
456 } 456 }
457#endif /* LCD_PIXELFORMAT */ 457#endif /* LCD_PIXELFORMAT */
458#elif LCD_DEPTH == 16 458#elif LCD_DEPTH >= 16
459 /* iriver h300, colour iPods, X5 */ 459 /* iriver h300, colour iPods, X5 */
460 (void)fb_width; 460 (void)fb_width;
461 fb_data *dest = STRIDE_MAIN((fb_data *)ctx->bm->data + fb_width * row, 461 fb_data *dest = STRIDE_MAIN((fb_data *)ctx->bm->data + fb_width * row,
@@ -470,15 +470,18 @@ void output_row_8_native(uint32_t row, void * row_in,
470 bm_alpha += ALIGN_UP(ctx->bm->width, 2) * row/2; 470 bm_alpha += ALIGN_UP(ctx->bm->width, 2) * row/2;
471 471
472 for (col = 0; col < ctx->bm->width; col++) { 472 for (col = 0; col < ctx->bm->width; col++) {
473 (void) delta;
473 if (ctx->dither) 474 if (ctx->dither)
474 delta = DITHERXDY(col,dy); 475 delta = DITHERXDY(col,dy);
475 r = qp->red; 476 r = qp->red;
476 g = qp->green; 477 g = qp->green;
477 b = qp->blue; 478 b = qp->blue;
479#if LCD_DEPTH < 24
478 r = (31 * r + (r >> 3) + delta) >> 8; 480 r = (31 * r + (r >> 3) + delta) >> 8;
479 g = (63 * g + (g >> 2) + delta) >> 8; 481 g = (63 * g + (g >> 2) + delta) >> 8;
480 b = (31 * b + (b >> 3) + delta) >> 8; 482 b = (31 * b + (b >> 3) + delta) >> 8;
481 *dest = LCD_RGBPACK_LCD(r, g, b); 483#endif
484 *dest = FB_RGBPACK_LCD(r, g, b);
482 dest += STRIDE_MAIN(1, ctx->bm->height); 485 dest += STRIDE_MAIN(1, ctx->bm->height);
483 if (bm_alpha) { 486 if (bm_alpha) {
484 /* pack alpha channel for 2 pixels into 1 byte and negate 487 /* pack alpha channel for 2 pixels into 1 byte and negate
@@ -526,8 +529,8 @@ int read_bmp_fd(int fd,
526 bool dither = false; 529 bool dither = false;
527#endif 530#endif
528 531
529#ifdef HAVE_REMOTE_LCD
530 bool remote = false; 532 bool remote = false;
533#ifdef HAVE_REMOTE_LCD
531 if (format & FORMAT_REMOTE) { 534 if (format & FORMAT_REMOTE) {
532 remote = true; 535 remote = true;
533#if LCD_REMOTE_DEPTH == 1 536#if LCD_REMOTE_DEPTH == 1
@@ -710,9 +713,7 @@ int read_bmp_fd(int fd,
710 case 16: 713 case 16:
711#if LCD_DEPTH >= 16 714#if LCD_DEPTH >= 16
712 /* don't dither 16 bit BMP to LCD with same or larger depth */ 715 /* don't dither 16 bit BMP to LCD with same or larger depth */
713#ifdef HAVE_REMOTE_LCD
714 if (!remote) 716 if (!remote)
715#endif
716 dither = false; 717 dither = false;
717#endif 718#endif
718 if (compression == 0) { /* BI_RGB, i.e. 15 bit */ 719 if (compression == 0) { /* BI_RGB, i.e. 15 bit */
@@ -755,6 +756,12 @@ int read_bmp_fd(int fd,
755 break; 756 break;
756 } 757 }
757 758
759#if LCD_DEPTH >= 24
760 /* Never dither 24/32 bit BMP to 24 bit LCDs */
761 if (depth >= 24 && !remote)
762 dither = false;
763#endif
764
758 /* Search to the beginning of the image data */ 765 /* Search to the beginning of the image data */
759 lseek(fd, (off_t)letoh32(bmph.off_bits), SEEK_SET); 766 lseek(fd, (off_t)letoh32(bmph.off_bits), SEEK_SET);
760 767
diff --git a/apps/recorder/resize.c b/apps/recorder/resize.c
index 32384537d4..ac6b7a3120 100644
--- a/apps/recorder/resize.c
+++ b/apps/recorder/resize.c
@@ -680,6 +680,7 @@ static void output_row_32_native_fromyuv(uint32_t row, void * row_in,
680 unsigned r, g, b, y, u, v; 680 unsigned r, g, b, y, u, v;
681 681
682 for (col = 0; col < ctx->bm->width; col++) { 682 for (col = 0; col < ctx->bm->width; col++) {
683 (void) delta;
683 if (ctx->dither) 684 if (ctx->dither)
684 delta = DITHERXDY(col,dy); 685 delta = DITHERXDY(col,dy);
685 y = SC_OUT(qp->b, ctx); 686 y = SC_OUT(qp->b, ctx);
@@ -687,10 +688,12 @@ static void output_row_32_native_fromyuv(uint32_t row, void * row_in,
687 v = SC_OUT(qp->r, ctx); 688 v = SC_OUT(qp->r, ctx);
688 qp++; 689 qp++;
689 yuv_to_rgb(y, u, v, &r, &g, &b); 690 yuv_to_rgb(y, u, v, &r, &g, &b);
691#if LCD_DEPTH < 24
690 r = (31 * r + (r >> 3) + delta) >> 8; 692 r = (31 * r + (r >> 3) + delta) >> 8;
691 g = (63 * g + (g >> 2) + delta) >> 8; 693 g = (63 * g + (g >> 2) + delta) >> 8;
692 b = (31 * b + (b >> 3) + delta) >> 8; 694 b = (31 * b + (b >> 3) + delta) >> 8;
693 *dest = LCD_RGBPACK_LCD(r, g, b); 695#endif
696 *dest = FB_RGBPACK_LCD(r, g, b);
694 dest += DEST_STEP; 697 dest += DEST_STEP;
695 } 698 }
696} 699}
@@ -764,7 +767,7 @@ static void output_row_32_native(uint32_t row, void * row_in,
764 *dest++ |= vi_pattern[bright] << shift; 767 *dest++ |= vi_pattern[bright] << shift;
765 } 768 }
766#endif /* LCD_PIXELFORMAT */ 769#endif /* LCD_PIXELFORMAT */
767#elif LCD_DEPTH == 16 770#elif LCD_DEPTH >= 16
768 /* iriver h300, colour iPods, X5 */ 771 /* iriver h300, colour iPods, X5 */
769 (void)fb_width; 772 (void)fb_width;
770 fb_data *dest = STRIDE_MAIN((fb_data *)ctx->bm->data + fb_width * row, 773 fb_data *dest = STRIDE_MAIN((fb_data *)ctx->bm->data + fb_width * row,
@@ -780,16 +783,19 @@ static void output_row_32_native(uint32_t row, void * row_in,
780 bm_alpha += ALIGN_UP(ctx->bm->width, 2)*row/2; 783 bm_alpha += ALIGN_UP(ctx->bm->width, 2)*row/2;
781 784
782 for (col = 0; col < ctx->bm->width; col++) { 785 for (col = 0; col < ctx->bm->width; col++) {
786 (void) delta;
783 if (ctx->dither) 787 if (ctx->dither)
784 delta = DITHERXDY(col,dy); 788 delta = DITHERXDY(col,dy);
785 q0 = *qp++; 789 q0 = *qp++;
786 r = SC_OUT(q0.r, ctx); 790 r = SC_OUT(q0.r, ctx);
787 g = SC_OUT(q0.g, ctx); 791 g = SC_OUT(q0.g, ctx);
788 b = SC_OUT(q0.b, ctx); 792 b = SC_OUT(q0.b, ctx);
793#if LCD_DEPTH < 24
789 r = (31 * r + (r >> 3) + delta) >> 8; 794 r = (31 * r + (r >> 3) + delta) >> 8;
790 g = (63 * g + (g >> 2) + delta) >> 8; 795 g = (63 * g + (g >> 2) + delta) >> 8;
791 b = (31 * b + (b >> 3) + delta) >> 8; 796 b = (31 * b + (b >> 3) + delta) >> 8;
792 *dest = LCD_RGBPACK_LCD(r, g, b); 797#endif
798 *dest = FB_RGBPACK_LCD(r, g, b);
793 dest += STRIDE_MAIN(1, ctx->bm->height); 799 dest += STRIDE_MAIN(1, ctx->bm->height);
794 if (bm_alpha) { 800 if (bm_alpha) {
795 /* pack alpha channel for 2 pixels into 1 byte */ 801 /* pack alpha channel for 2 pixels into 1 byte */
diff --git a/firmware/SOURCES b/firmware/SOURCES
index ef71a2b048..b8471dc37d 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -218,6 +218,8 @@ drivers/lcd-16bit-vert.c
218#else 218#else
219drivers/lcd-16bit.c 219drivers/lcd-16bit.c
220#endif 220#endif
221#elif LCD_DEPTH == 24
222drivers/lcd-24bit.c
221#endif /* LCD_DEPTH */ 223#endif /* LCD_DEPTH */
222common/diacritic.c 224common/diacritic.c
223#endif /* HAVE_LCD_BITMAP */ 225#endif /* HAVE_LCD_BITMAP */
diff --git a/firmware/asm/SOURCES b/firmware/asm/SOURCES
index 0cd351efdd..d74d4d3c60 100644
--- a/firmware/asm/SOURCES
+++ b/firmware/asm/SOURCES
@@ -12,5 +12,9 @@ strlen.c
12 defined(COWON_D2) || defined(MINI2440) || defined(SAMSUNG_YPR0) || \ 12 defined(COWON_D2) || defined(MINI2440) || defined(SAMSUNG_YPR0) || \
13 defined(SAMSUNG_YPR1) || (defined(MROBE_500) && !defined(LCD_USE_DMA))) && \ 13 defined(SAMSUNG_YPR1) || (defined(MROBE_500) && !defined(LCD_USE_DMA))) && \
14 !defined(SIMULATOR) 14 !defined(SIMULATOR)
15#if LCD_DEPTH == 24
16lcd-as-memframe-24bit.c
17#else
15lcd-as-memframe.c 18lcd-as-memframe.c
16#endif 19#endif
20#endif
diff --git a/firmware/asm/lcd-as-memframe-24bit.c b/firmware/asm/lcd-as-memframe-24bit.c
new file mode 100644
index 0000000000..2cca575799
--- /dev/null
+++ b/firmware/asm/lcd-as-memframe-24bit.c
@@ -0,0 +1,3 @@
1
2/* The ASM version of lcd-as-memframe.c isn't 24bit capable */
3#include "lcd-as-memframe.c"
diff --git a/firmware/asm/lcd-as-memframe.c b/firmware/asm/lcd-as-memframe.c
index 5f4917b721..032022d7ec 100644
--- a/firmware/asm/lcd-as-memframe.c
+++ b/firmware/asm/lcd-as-memframe.c
@@ -78,7 +78,7 @@ extern void lcd_write_yuv420_lines(fb_data *dst,
78 b = clamp(b, 0, 64*256-1); 78 b = clamp(b, 0, 64*256-1);
79 } 79 }
80 80
81 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 81 *dst = FB_RGBPACK(r >> 6, g >> 6, b >> 6);
82 82
83#if LCD_WIDTH >= LCD_HEIGHT 83#if LCD_WIDTH >= LCD_HEIGHT
84 dst++; 84 dst++;
@@ -98,7 +98,7 @@ extern void lcd_write_yuv420_lines(fb_data *dst,
98 b = clamp(b, 0, 64*256-1); 98 b = clamp(b, 0, 64*256-1);
99 } 99 }
100 100
101 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 101 *dst = FB_RGBPACK(r >> 6, g >> 6, b >> 6);
102 102
103#if LCD_WIDTH >= LCD_HEIGHT 103#if LCD_WIDTH >= LCD_HEIGHT
104 dst++; 104 dst++;
@@ -143,7 +143,7 @@ extern void lcd_write_yuv420_lines(fb_data *dst,
143 b = clamp(b, 0, 64*256-1); 143 b = clamp(b, 0, 64*256-1);
144 } 144 }
145 145
146 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 146 *dst = FB_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
147 147
148#if LCD_WIDTH >= LCD_HEIGHT 148#if LCD_WIDTH >= LCD_HEIGHT
149 dst++; 149 dst++;
@@ -163,7 +163,7 @@ extern void lcd_write_yuv420_lines(fb_data *dst,
163 b = clamp(b, 0, 64*256-1); 163 b = clamp(b, 0, 64*256-1);
164 } 164 }
165 165
166 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 166 *dst = FB_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
167 167
168#if LCD_WIDTH >= LCD_HEIGHT 168#if LCD_WIDTH >= LCD_HEIGHT
169 dst++; 169 dst++;
diff --git a/firmware/drivers/lcd-24bit.c b/firmware/drivers/lcd-24bit.c
new file mode 100644
index 0000000000..f87d63aaa3
--- /dev/null
+++ b/firmware/drivers/lcd-24bit.c
@@ -0,0 +1,1129 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 by Dave Chapman
11 * Copyright (C) 2009 by Karl Kurbjun
12 *
13 * Rockbox driver for 16-bit colour LCDs
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
19 *
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
22 *
23 ****************************************************************************/
24
25#include <stdio.h>
26#include "config.h"
27
28#include "cpu.h"
29#include "lcd.h"
30#include "kernel.h"
31#include "thread.h"
32#include <stdlib.h>
33#include "string-extra.h" /* mem*() */
34#include "file.h"
35#include "debug.h"
36#include "system.h"
37#include "font.h"
38#include "rbunicode.h"
39#include "bidi.h"
40#include "scroll_engine.h"
41
42#define ROW_INC LCD_WIDTH
43#define COL_INC 1
44
45extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[];
46extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_bgcolor[];
47
48static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image,
49 const unsigned char *src, int src_x,
50 int src_y, int x, int y,
51 int width, int height,
52 int stride_image, int stride_src);
53
54#include "lcd-color-common.c"
55#include "lcd-bitmap-common.c"
56
57
58/* Clear the current viewport */
59void lcd_clear_viewport(void)
60{
61 fb_data *dst, *dst_end;
62 int x, y, width, height;
63 int len, step;
64
65 x = current_vp->x;
66 y = current_vp->y;
67 width = current_vp->width;
68 height = current_vp->height;
69
70#if defined(HAVE_VIEWPORT_CLIP)
71 /********************* Viewport on screen clipping ********************/
72 /* nothing to draw? */
73 if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
74 || (x + width <= 0) || (y + height <= 0))
75 return;
76
77 /* clip image in viewport in screen */
78 if (x < 0)
79 {
80 width += x;
81 x = 0;
82 }
83 if (y < 0)
84 {
85 height += y;
86 y = 0;
87 }
88 if (x + width > LCD_WIDTH)
89 width = LCD_WIDTH - x;
90 if (y + height > LCD_HEIGHT)
91 height = LCD_HEIGHT - y;
92#endif
93
94 len = STRIDE_MAIN(width, height);
95 step = STRIDE_MAIN(ROW_INC, COL_INC);
96
97 dst = FBADDR(x, y);
98 dst_end = FBADDR(x + width - 1 , y + height - 1);
99
100 if (current_vp->drawmode & DRMODE_INVERSEVID)
101 {
102 fb_data px = FB_SCALARPACK(current_vp->fg_pattern);
103 do
104 {
105 fb_data *end = dst + len;
106 do {
107 *dst++ = px;
108 } while (dst < end);
109 dst += step - len;
110 }
111 while (dst <= dst_end);
112 }
113 else
114 {
115 if (!lcd_backdrop)
116 {
117 fb_data px = FB_SCALARPACK(current_vp->bg_pattern);
118 do
119 {
120 fb_data *end = dst + len;
121 do {
122 *dst++ = px;
123 } while (dst < end);
124 dst += step - len;
125 }
126 while (dst <= dst_end);
127 }
128 else
129 {
130 do
131 {
132 memcpy(dst, (void *)((long)dst + lcd_backdrop_offset),
133 len * sizeof(fb_data));
134 dst += step;
135 }
136 while (dst <= dst_end);
137 }
138 }
139
140 if (current_vp == &default_vp)
141 lcd_scroll_stop();
142 else
143 lcd_scroll_stop_viewport(current_vp);
144}
145
146/*** low-level drawing functions ***/
147
148static void ICODE_ATTR setpixel(fb_data *address)
149{
150 *address = FB_SCALARPACK(current_vp->fg_pattern);
151}
152
153static void ICODE_ATTR clearpixel(fb_data *address)
154{
155 *address = FB_SCALARPACK(current_vp->bg_pattern);
156}
157
158static void ICODE_ATTR clearimgpixel(fb_data *address)
159{
160 *address = *(fb_data *)((long)address + lcd_backdrop_offset);
161}
162
163static void ICODE_ATTR flippixel(fb_data *address)
164{
165 unsigned px = FB_UNPACK_SCALAR_LCD(*address);
166 *address = FB_SCALARPACK(~px);
167}
168
169static void ICODE_ATTR nopixel(fb_data *address)
170{
171 (void)address;
172}
173
174lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_bgcolor[8] = {
175 flippixel, nopixel, setpixel, setpixel,
176 nopixel, clearpixel, nopixel, clearpixel
177};
178
179lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[8] = {
180 flippixel, nopixel, setpixel, setpixel,
181 nopixel, clearimgpixel, nopixel, clearimgpixel
182};
183
184lcd_fastpixelfunc_type* const * lcd_fastpixelfuncs = lcd_fastpixelfuncs_bgcolor;
185
186/* Fill a rectangular area */
187void lcd_fillrect(int x, int y, int width, int height)
188{
189 enum fill_opt fillopt = OPT_NONE;
190 fb_data *dst, *dst_end;
191 int len, step;
192 fb_data bits = { 0 };
193
194 /******************** In viewport clipping **********************/
195 /* nothing to draw? */
196 if ((width <= 0) || (height <= 0) || (x >= current_vp->width) ||
197 (y >= current_vp->height) || (x + width <= 0) || (y + height <= 0))
198 return;
199
200 if (x < 0)
201 {
202 width += x;
203 x = 0;
204 }
205 if (y < 0)
206 {
207 height += y;
208 y = 0;
209 }
210 if (x + width > current_vp->width)
211 width = current_vp->width - x;
212 if (y + height > current_vp->height)
213 height = current_vp->height - y;
214
215 /* adjust for viewport */
216 x += current_vp->x;
217 y += current_vp->y;
218
219#if defined(HAVE_VIEWPORT_CLIP)
220 /********************* Viewport on screen clipping ********************/
221 /* nothing to draw? */
222 if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
223 || (x + width <= 0) || (y + height <= 0))
224 return;
225
226 /* clip image in viewport in screen */
227 if (x < 0)
228 {
229 width += x;
230 x = 0;
231 }
232 if (y < 0)
233 {
234 height += y;
235 y = 0;
236 }
237 if (x + width > LCD_WIDTH)
238 width = LCD_WIDTH - x;
239 if (y + height > LCD_HEIGHT)
240 height = LCD_HEIGHT - y;
241#endif
242
243 /* drawmode and optimisation */
244 if (current_vp->drawmode & DRMODE_INVERSEVID)
245 {
246 if (current_vp->drawmode & DRMODE_BG)
247 {
248 if (!lcd_backdrop)
249 {
250 fillopt = OPT_SET;
251 bits = FB_SCALARPACK(current_vp->bg_pattern);
252 }
253 else
254 fillopt = OPT_COPY;
255 }
256 }
257 else
258 {
259 if (current_vp->drawmode & DRMODE_FG)
260 {
261 fillopt = OPT_SET;
262 bits = FB_SCALARPACK(current_vp->fg_pattern);
263 }
264 }
265 if (fillopt == OPT_NONE && current_vp->drawmode != DRMODE_COMPLEMENT)
266 return;
267
268 dst = FBADDR(x, y);
269 dst_end = FBADDR(x + width - 1, y + height - 1);
270
271 len = STRIDE_MAIN(width, height);
272 step = STRIDE_MAIN(ROW_INC, COL_INC);
273
274 do
275 {
276 switch (fillopt)
277 {
278 case OPT_SET:
279 {
280 fb_data *start = dst;
281 fb_data *end = start + len;
282 do {
283 *start = bits;
284 } while (++start < end);
285 break;
286 }
287
288 case OPT_COPY:
289 memcpy(dst, (void *)((long)dst + lcd_backdrop_offset),
290 len * sizeof(fb_data));
291 break;
292
293 case OPT_NONE: /* DRMODE_COMPLEMENT */
294 {
295 fb_data *start = dst;
296 fb_data *end = start + len;
297 do {
298 flippixel(start);
299 } while (++start < end);
300 break;
301 }
302 }
303 dst += step;
304 }
305 while (dst <= dst_end);
306}
307
308/* About Rockbox' internal monochrome bitmap format:
309 *
310 * A bitmap contains one bit for every pixel that defines if that pixel is
311 * black (1) or white (0). Bits within a byte are arranged vertically, LSB
312 * at top.
313 * The bytes are stored in row-major order, with byte 0 being top left,
314 * byte 1 2nd from left etc. The first row of bytes defines pixel rows
315 * 0..7, the second row defines pixel row 8..15 etc.
316 *
317 * This is the mono bitmap format used on all other targets so far; the
318 * pixel packing doesn't really matter on a 8bit+ target. */
319
320/* Draw a partial monochrome bitmap */
321
322void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
323 int src_y, int stride, int x, int y,
324 int width, int height)
325{
326 const unsigned char *src_end;
327 fb_data *dst, *dst_col;
328 unsigned dmask = 0x100; /* bit 8 == sentinel */
329 int drmode = current_vp->drawmode;
330 int row;
331
332 /******************** Image in viewport clipping **********************/
333 /* nothing to draw? */
334 if ((width <= 0) || (height <= 0) || (x >= current_vp->width) ||
335 (y >= current_vp->height) || (x + width <= 0) || (y + height <= 0))
336 return;
337
338 if (x < 0)
339 {
340 width += x;
341 src_x -= x;
342 x = 0;
343 }
344 if (y < 0)
345 {
346 height += y;
347 src_y -= y;
348 y = 0;
349 }
350 if (x + width > current_vp->width)
351 width = current_vp->width - x;
352 if (y + height > current_vp->height)
353 height = current_vp->height - y;
354
355 /* adjust for viewport */
356 x += current_vp->x;
357 y += current_vp->y;
358
359#if defined(HAVE_VIEWPORT_CLIP)
360 /********************* Viewport on screen clipping ********************/
361 /* nothing to draw? */
362 if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
363 || (x + width <= 0) || (y + height <= 0))
364 return;
365
366 /* clip image in viewport in screen */
367 if (x < 0)
368 {
369 width += x;
370 src_x -= x;
371 x = 0;
372 }
373 if (y < 0)
374 {
375 height += y;
376 src_y -= y;
377 y = 0;
378 }
379 if (x + width > LCD_WIDTH)
380 width = LCD_WIDTH - x;
381 if (y + height > LCD_HEIGHT)
382 height = LCD_HEIGHT - y;
383#endif
384
385 src += stride * (src_y >> 3) + src_x; /* move starting point */
386 src_y &= 7;
387 src_end = src + width;
388 dst_col = FBADDR(x, y);
389
390
391 if (drmode & DRMODE_INVERSEVID)
392 {
393 dmask = 0x1ff; /* bit 8 == sentinel */
394 drmode &= DRMODE_SOLID; /* mask out inversevid */
395 }
396
397 /* Use extra bit to avoid if () in the switch-cases below */
398 if ((drmode & DRMODE_BG) && lcd_backdrop)
399 drmode |= DRMODE_INT_BD;
400
401 /* go through each column and update each pixel */
402 do
403 {
404 const unsigned char *src_col = src++;
405 unsigned data = (*src_col ^ dmask) >> src_y;
406 fb_data fg, bg;
407 uintptr_t bo;
408
409 dst = dst_col;
410 dst_col += COL_INC;
411 row = height;
412
413#define UPDATE_SRC do { \
414 data >>= 1; \
415 if (data == 0x001) { \
416 src_col += stride; \
417 data = *src_col ^ dmask; \
418 } \
419 } while (0)
420
421 switch (drmode)
422 {
423 case DRMODE_COMPLEMENT:
424 do
425 {
426 if (data & 0x01)
427 flippixel(dst);
428
429 dst += ROW_INC;
430 UPDATE_SRC;
431 }
432 while (--row);
433 break;
434
435 case DRMODE_BG|DRMODE_INT_BD:
436 bo = lcd_backdrop_offset;
437 do
438 {
439 if (!(data & 0x01))
440 *dst = *(fb_data *)((long)dst + bo);
441
442 dst += ROW_INC;
443 UPDATE_SRC;
444 }
445 while (--row);
446 break;
447
448 case DRMODE_BG:
449 bg = FB_SCALARPACK(current_vp->bg_pattern);
450 do
451 {
452 if (!(data & 0x01))
453 *dst = bg;
454
455 dst += ROW_INC;
456 UPDATE_SRC;
457 }
458 while (--row);
459 break;
460
461 case DRMODE_FG:
462 fg = FB_SCALARPACK(current_vp->fg_pattern);
463 do
464 {
465 if (data & 0x01)
466 *dst = fg;
467
468 dst += ROW_INC;
469 UPDATE_SRC;
470 }
471 while (--row);
472 break;
473
474 case DRMODE_SOLID|DRMODE_INT_BD:
475 fg = FB_SCALARPACK(current_vp->fg_pattern);
476 bo = lcd_backdrop_offset;
477 do
478 {
479 *dst = (data & 0x01) ? fg
480 : *(fb_data *)((long)dst + bo);
481 dst += ROW_INC;
482 UPDATE_SRC;
483 }
484 while (--row);
485 break;
486
487 case DRMODE_SOLID:
488 fg = FB_SCALARPACK(current_vp->fg_pattern);
489 bg = FB_SCALARPACK(current_vp->bg_pattern);
490 do
491 {
492 *dst = (data & 0x01) ? fg : bg;
493 dst += ROW_INC;
494 UPDATE_SRC;
495 }
496 while (--row);
497 break;
498 }
499 }
500 while (src < src_end);
501}
502/* Draw a full monochrome bitmap */
503void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int height)
504{
505 lcd_mono_bitmap_part(src, 0, 0, width, x, y, width, height);
506}
507
508
509/* About Rockbox' internal alpha channel format (for ALPHA_COLOR_FONT_DEPTH == 2)
510 *
511 * For each pixel, 4bit of alpha information is stored in a byte-stream,
512 * so two pixels are packed into one byte.
513 * The lower nibble is the first pixel, the upper one the second. The stride is
514 * horizontal. E.g row0: pixel0: byte0[0:3], pixel1: byte0[4:7], pixel2: byte1[0:3],...
515 * The format is independant of the internal display orientation and color
516 * representation, as to support the same font files on all displays.
517 * The values go linear from 0 (fully opaque) to 15 (fully transparent)
518 * (note how this is the opposite of the alpha channel in the ARGB format).
519 *
520 * This might suggest that rows need to have an even number of pixels.
521 * However this is generally not the case. lcd_alpha_bitmap_part_mix() can deal
522 * with uneven colums (i.e. two rows can share one byte). And font files do
523 * exploit this.
524 * However, this is difficult to do for image files, especially bottom-up bitmaps,
525 * so lcd_bmp() do expect even rows.
526 */
527
528#define ALPHA_COLOR_FONT_DEPTH 2
529#define ALPHA_COLOR_LOOKUP_SHIFT (1 << ALPHA_COLOR_FONT_DEPTH)
530#define ALPHA_COLOR_LOOKUP_SIZE ((1 << ALPHA_COLOR_LOOKUP_SHIFT) - 1)
531#define ALPHA_COLOR_PIXEL_PER_BYTE (8 >> ALPHA_COLOR_FONT_DEPTH)
532#define ALPHA_COLOR_PIXEL_PER_WORD (32 >> ALPHA_COLOR_FONT_DEPTH)
533
534/* This is based on SDL (src/video/SDL_RLEaccel.c) ALPHA_BLIT32_888() macro */
535static inline fb_data blend_two_colors(unsigned c1, unsigned c2, unsigned a)
536{
537 unsigned s = c1;
538 unsigned d = c2;
539 unsigned s1 = s & 0xff00ff;
540 unsigned d1 = d & 0xff00ff;
541 a += a >> (ALPHA_COLOR_LOOKUP_SHIFT - 1);
542 d1 = (d1 + ((s1 - d1) * a >> ALPHA_COLOR_LOOKUP_SHIFT)) & 0xff00ff;
543 s &= 0xff00;
544 d &= 0xff00;
545 d = (d + ((s - d) * a >> ALPHA_COLOR_LOOKUP_SHIFT)) & 0xff00;
546
547 return FB_SCALARPACK(d1 | d);
548}
549
550/* Blend an image with an alpha channel
551 * if image is NULL, drawing will happen according to the drawmode
552 * src is the alpha channel (4bit per pixel) */
553static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image,
554 const unsigned char *src, int src_x,
555 int src_y, int x, int y,
556 int width, int height,
557 int stride_image, int stride_src)
558{
559 fb_data *dst, *dst_row;
560 unsigned dmask = 0x00000000;
561 int drmode = current_vp->drawmode;
562 /* nothing to draw? */
563 if ((width <= 0) || (height <= 0) || (x >= current_vp->width) ||
564 (y >= current_vp->height) || (x + width <= 0) || (y + height <= 0))
565 return;
566
567 /* clipping */
568 if (x < 0)
569 {
570 width += x;
571 src_x -= x;
572 x = 0;
573 }
574 if (y < 0)
575 {
576 height += y;
577 src_y -= y;
578 y = 0;
579 }
580 if (x + width > current_vp->width)
581 width = current_vp->width - x;
582 if (y + height > current_vp->height)
583 height = current_vp->height - y;
584
585 /* adjust for viewport */
586 x += current_vp->x;
587 y += current_vp->y;
588
589#if defined(HAVE_VIEWPORT_CLIP)
590 /********************* Viewport on screen clipping ********************/
591 /* nothing to draw? */
592 if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
593 || (x + width <= 0) || (y + height <= 0))
594 return;
595
596 /* clip image in viewport in screen */
597 if (x < 0)
598 {
599 width += x;
600 src_x -= x;
601 x = 0;
602 }
603 if (y < 0)
604 {
605 height += y;
606 src_y -= y;
607 y = 0;
608 }
609 if (x + width > LCD_WIDTH)
610 width = LCD_WIDTH - x;
611 if (y + height > LCD_HEIGHT)
612 height = LCD_HEIGHT - y;
613#endif
614
615 /* the following drawmode combinations are possible:
616 * 1) COMPLEMENT: just negates the framebuffer contents
617 * 2) BG and BG+backdrop: draws _only_ background pixels with either
618 * the background color or the backdrop (if any). The backdrop
619 * is an image in native lcd format
620 * 3) FG and FG+image: draws _only_ foreground pixels with either
621 * the foreground color or an image buffer. The image is in
622 * native lcd format
623 * 4) SOLID, SOLID+backdrop, SOLID+image, SOLID+backdrop+image, i.e. all
624 * possible combinations of 2) and 3). Draws both, fore- and background,
625 * pixels. The rules of 2) and 3) apply.
626 *
627 * INVERSEVID swaps fore- and background pixels, i.e. background pixels
628 * become foreground ones and vice versa.
629 */
630 if (drmode & DRMODE_INVERSEVID)
631 {
632 dmask = 0xffffffff;
633 drmode &= DRMODE_SOLID; /* mask out inversevid */
634 }
635
636 /* Use extra bits to avoid if () in the switch-cases below */
637 if (image != NULL)
638 drmode |= DRMODE_INT_IMG;
639
640 if ((drmode & DRMODE_BG) && lcd_backdrop)
641 drmode |= DRMODE_INT_BD;
642
643 dst_row = FBADDR(x, y);
644
645 int col, row = height;
646 unsigned data, pixels;
647 unsigned skip_end = (stride_src - width);
648 unsigned skip_start = src_y * stride_src + src_x;
649 unsigned skip_start_image = STRIDE_MAIN(src_y * stride_image + src_x,
650 src_x * stride_image + src_y);
651
652#ifdef ALPHA_BITMAP_READ_WORDS
653 uint32_t *src_w = (uint32_t *)((uintptr_t)src & ~3);
654 skip_start += ALPHA_COLOR_PIXEL_PER_BYTE * ((uintptr_t)src & 3);
655 src_w += skip_start / ALPHA_COLOR_PIXEL_PER_WORD;
656 data = letoh32(*src_w++) ^ dmask;
657 pixels = skip_start % ALPHA_COLOR_PIXEL_PER_WORD;
658#else
659 src += skip_start / ALPHA_COLOR_PIXEL_PER_BYTE;
660 data = *src ^ dmask;
661 pixels = skip_start % ALPHA_COLOR_PIXEL_PER_BYTE;
662#endif
663 data >>= pixels * ALPHA_COLOR_LOOKUP_SHIFT;
664#ifdef ALPHA_BITMAP_READ_WORDS
665 pixels = 8 - pixels;
666#endif
667
668 /* image is only accessed in DRMODE_INT_IMG cases, i.e. when non-NULL.
669 * Therefore NULL accesses are impossible and we can increment
670 * unconditionally (applies for stride at the end of the loop as well) */
671 image += skip_start_image;
672 /* go through the rows and update each pixel */
673 do
674 {
675 /* saving current_vp->fg/bg_pattern and lcd_backdrop_offset into these
676 * temp vars just before the loop helps gcc to opimize the loop better
677 * (testing showed ~15% speedup) */
678 unsigned fg, bg;
679 ptrdiff_t bo, img_offset;
680 col = width;
681 dst = dst_row;
682 dst_row += ROW_INC;
683#ifdef ALPHA_BITMAP_READ_WORDS
684#define UPDATE_SRC_ALPHA do { \
685 if (--pixels) \
686 data >>= ALPHA_COLOR_LOOKUP_SHIFT; \
687 else \
688 { \
689 data = letoh32(*src_w++) ^ dmask; \
690 pixels = ALPHA_COLOR_PIXEL_PER_WORD; \
691 } \
692 } while (0)
693#elif ALPHA_COLOR_PIXEL_PER_BYTE == 2
694#define UPDATE_SRC_ALPHA do { \
695 if (pixels ^= 1) \
696 data >>= ALPHA_COLOR_LOOKUP_SHIFT; \
697 else \
698 data = *(++src) ^ dmask; \
699 } while (0)
700#else
701#define UPDATE_SRC_ALPHA do { \
702 if (pixels = (++pixels % ALPHA_COLOR_PIXEL_PER_BYTE)) \
703 data >>= ALPHA_COLOR_LOOKUP_SHIFT; \
704 else \
705 data = *(++src) ^ dmask; \
706 } while (0)
707#endif
708
709 switch (drmode)
710 {
711 case DRMODE_COMPLEMENT:
712 do
713 {
714 unsigned px = FB_UNPACK_SCALAR_LCD(*dst);
715 *dst = blend_two_colors(px, ~px,
716 data & ALPHA_COLOR_LOOKUP_SIZE );
717 dst += COL_INC;
718 UPDATE_SRC_ALPHA;
719 }
720 while (--col);
721 break;
722 case DRMODE_BG|DRMODE_INT_BD:
723 bo = lcd_backdrop_offset;
724 do
725 {
726 unsigned px = FB_UNPACK_SCALAR_LCD(*dst);
727 unsigned c = FB_UNPACK_SCALAR_LCD(*(fb_data *)((uintptr_t)dst + bo));
728 *dst = blend_two_colors(c, px, data & ALPHA_COLOR_LOOKUP_SIZE );
729 dst += COL_INC;
730 image += STRIDE_MAIN(1, stride_image);
731 UPDATE_SRC_ALPHA;
732 }
733 while (--col);
734 break;
735 case DRMODE_BG:
736 bg = current_vp->bg_pattern;
737 do
738 {
739 unsigned px = FB_UNPACK_SCALAR_LCD(*dst);
740 *dst = blend_two_colors(bg, px, data & ALPHA_COLOR_LOOKUP_SIZE );
741 dst += COL_INC;
742 UPDATE_SRC_ALPHA;
743 }
744 while (--col);
745 break;
746 case DRMODE_FG|DRMODE_INT_IMG:
747 img_offset = image - dst;
748 do
749 {
750 unsigned px1 = FB_UNPACK_SCALAR_LCD(*dst);
751 unsigned px2 = FB_UNPACK_SCALAR_LCD(*(dst + img_offset));
752 *dst = blend_two_colors(px1, px2, data & ALPHA_COLOR_LOOKUP_SIZE );
753 dst += COL_INC;
754 UPDATE_SRC_ALPHA;
755 }
756 while (--col);
757 break;
758 case DRMODE_FG:
759 fg = current_vp->fg_pattern;
760 do
761 {
762 unsigned px = FB_UNPACK_SCALAR_LCD(*dst);
763 *dst = blend_two_colors(px, fg, data & ALPHA_COLOR_LOOKUP_SIZE );
764 dst += COL_INC;
765 UPDATE_SRC_ALPHA;
766 }
767 while (--col);
768 break;
769 case DRMODE_SOLID|DRMODE_INT_BD:
770 bo = lcd_backdrop_offset;
771 fg = current_vp->fg_pattern;
772 do
773 {
774 unsigned c = FB_UNPACK_SCALAR_LCD(*(fb_data *)((uintptr_t)dst + bo));
775 *dst = blend_two_colors(c, fg, data & ALPHA_COLOR_LOOKUP_SIZE );
776 dst += COL_INC;
777 UPDATE_SRC_ALPHA;
778 }
779 while (--col);
780 break;
781 case DRMODE_SOLID|DRMODE_INT_IMG:
782 bg = current_vp->bg_pattern;
783 img_offset = image - dst;
784 do
785 {
786 unsigned c = FB_UNPACK_SCALAR_LCD(*(dst + img_offset));
787 *dst = blend_two_colors(bg, c, data & ALPHA_COLOR_LOOKUP_SIZE );
788 dst += COL_INC;
789 UPDATE_SRC_ALPHA;
790 }
791 while (--col);
792 break;
793 case DRMODE_SOLID|DRMODE_INT_BD|DRMODE_INT_IMG:
794 bo = lcd_backdrop_offset;
795 img_offset = image - dst;
796 do
797 {
798 unsigned px = FB_UNPACK_SCALAR_LCD(*(fb_data *)((uintptr_t)dst + bo));
799 unsigned c = FB_UNPACK_SCALAR_LCD(*(dst + img_offset));
800 *dst = blend_two_colors(px, c, data & ALPHA_COLOR_LOOKUP_SIZE );
801 dst += COL_INC;
802 UPDATE_SRC_ALPHA;
803 }
804 while (--col);
805 break;
806 case DRMODE_SOLID:
807 bg = current_vp->bg_pattern;
808 fg = current_vp->fg_pattern;
809 do
810 {
811 *dst = blend_two_colors(bg, fg, data & ALPHA_COLOR_LOOKUP_SIZE );
812 dst += COL_INC;
813 UPDATE_SRC_ALPHA;
814 }
815 while (--col);
816 break;
817 }
818#ifdef ALPHA_BITMAP_READ_WORDS
819 if (skip_end < pixels)
820 {
821 pixels -= skip_end;
822 data >>= skip_end * ALPHA_COLOR_LOOKUP_SHIFT;
823 } else {
824 pixels = skip_end - pixels;
825 src_w += pixels / ALPHA_COLOR_PIXEL_PER_WORD;
826 pixels %= ALPHA_COLOR_PIXEL_PER_WORD;
827 data = letoh32(*src_w++) ^ dmask;
828 data >>= pixels * ALPHA_COLOR_LOOKUP_SHIFT;
829 pixels = 8 - pixels;
830 }
831#else
832 if (skip_end)
833 {
834 pixels += skip_end;
835 if (pixels >= ALPHA_COLOR_PIXEL_PER_BYTE)
836 {
837 src += pixels / ALPHA_COLOR_PIXEL_PER_BYTE;
838 pixels %= ALPHA_COLOR_PIXEL_PER_BYTE;
839 data = *src ^ dmask;
840 data >>= pixels * ALPHA_COLOR_LOOKUP_SHIFT;
841 } else
842 data >>= skip_end * ALPHA_COLOR_LOOKUP_SHIFT;
843 }
844#endif
845
846 image += STRIDE_MAIN(stride_image,1);
847 } while (--row);
848}
849
850/*** drawing functions ***/
851
852/* Draw a horizontal line (optimised) */
853void lcd_hline(int x1, int x2, int y)
854{
855 int x, width;
856 fb_data *dst, *dst_end;
857 lcd_fastpixelfunc_type *pfunc = lcd_fastpixelfuncs[current_vp->drawmode];
858
859 /* direction flip */
860 if (x2 < x1)
861 {
862 x = x1;
863 x1 = x2;
864 x2 = x;
865 }
866
867 /******************** In viewport clipping **********************/
868 /* nothing to draw? */
869 if (((unsigned)y >= (unsigned)current_vp->height) ||
870 (x1 >= current_vp->width) ||
871 (x2 < 0))
872 return;
873
874 if (x1 < 0)
875 x1 = 0;
876 if (x2 >= current_vp->width)
877 x2 = current_vp->width-1;
878
879 /* Adjust x1 and y to viewport */
880 x1 += current_vp->x;
881 x2 += current_vp->x;
882 y += current_vp->y;
883
884#if defined(HAVE_VIEWPORT_CLIP)
885 /********************* Viewport on screen clipping ********************/
886 /* nothing to draw? */
887 if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH)
888 || (x2 < 0))
889 return;
890
891 /* clipping */
892 if (x1 < 0)
893 x1 = 0;
894 if (x2 >= LCD_WIDTH)
895 x2 = LCD_WIDTH-1;
896#endif
897
898 width = x2 - x1 + 1;
899
900 dst = FBADDR(x1 , y);
901 dst_end = dst + width;
902 do
903 {
904 pfunc(dst);
905 }
906 while (++dst < dst_end);
907}
908
909/* Draw a vertical line (optimised) */
910void lcd_vline(int x, int y1, int y2)
911{
912 int y;
913 fb_data *dst, *dst_end;
914 lcd_fastpixelfunc_type *pfunc = lcd_fastpixelfuncs[current_vp->drawmode];
915
916 /* direction flip */
917 if (y2 < y1)
918 {
919 y = y1;
920 y1 = y2;
921 y2 = y;
922 }
923
924 /******************** In viewport clipping **********************/
925 /* nothing to draw? */
926 if (((unsigned)x >= (unsigned)current_vp->width) ||
927 (y1 >= current_vp->height) ||
928 (y2 < 0))
929 return;
930
931 if (y1 < 0)
932 y1 = 0;
933 if (y2 >= current_vp->height)
934 y2 = current_vp->height-1;
935
936 /* adjust for viewport */
937 x += current_vp->x;
938 y1 += current_vp->y;
939 y2 += current_vp->y;
940
941#if defined(HAVE_VIEWPORT_CLIP)
942 /********************* Viewport on screen clipping ********************/
943 /* nothing to draw? */
944 if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT)
945 || (y2 < 0))
946 return;
947
948 /* clipping */
949 if (y1 < 0)
950 y1 = 0;
951 if (y2 >= LCD_HEIGHT)
952 y2 = LCD_HEIGHT-1;
953#endif
954
955 dst = FBADDR(x , y1);
956 dst_end = dst + (y2 - y1) * LCD_WIDTH;
957
958 do
959 {
960 pfunc(dst);
961 dst += LCD_WIDTH;
962 }
963 while (dst <= dst_end);
964}
965
966/* Draw a partial native bitmap */
967void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
968 int stride, int x, int y, int width,
969 int height)
970{
971 fb_data *dst;
972
973 /******************** Image in viewport clipping **********************/
974 /* nothing to draw? */
975 if ((width <= 0) || (height <= 0) || (x >= current_vp->width) ||
976 (y >= current_vp->height) || (x + width <= 0) || (y + height <= 0))
977 return;
978
979 if (x < 0)
980 {
981 width += x;
982 src_x -= x;
983 x = 0;
984 }
985 if (y < 0)
986 {
987 height += y;
988 src_y -= y;
989 y = 0;
990 }
991
992 if (x + width > current_vp->width)
993 width = current_vp->width - x;
994 if (y + height > current_vp->height)
995 height = current_vp->height - y;
996
997 /* adjust for viewport */
998 x += current_vp->x;
999 y += current_vp->y;
1000
1001#if defined(HAVE_VIEWPORT_CLIP)
1002 /********************* Viewport on screen clipping ********************/
1003 /* nothing to draw? */
1004 if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
1005 || (x + width <= 0) || (y + height <= 0))
1006 return;
1007
1008 /* clip image in viewport in screen */
1009 if (x < 0)
1010 {
1011 width += x;
1012 src_x -= x;
1013 x = 0;
1014 }
1015 if (y < 0)
1016 {
1017 height += y;
1018 src_y -= y;
1019 y = 0;
1020 }
1021 if (x + width > LCD_WIDTH)
1022 width = LCD_WIDTH - x;
1023 if (y + height > LCD_HEIGHT)
1024 height = LCD_HEIGHT - y;
1025#endif
1026
1027 src += stride * src_y + src_x; /* move starting point */
1028 dst = FBADDR(x, y);
1029
1030 do
1031 {
1032 memcpy(dst, src, width * sizeof(fb_data));
1033 src += stride;
1034 dst += LCD_WIDTH;
1035 }
1036 while (--height > 0);
1037}
1038
1039/* Draw a partial native bitmap with transparency and foreground colors */
1040void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
1041 int src_y, int stride, int x,
1042 int y, int width, int height)
1043{
1044 fb_data *dst;
1045 fb_data fg, transparent, replacewithfg;
1046
1047 /******************** Image in viewport clipping **********************/
1048 /* nothing to draw? */
1049 if ((width <= 0) || (height <= 0) || (x >= current_vp->width) ||
1050 (y >= current_vp->height) || (x + width <= 0) || (y + height <= 0))
1051 return;
1052
1053 if (x < 0)
1054 {
1055 width += x;
1056 src_x -= x;
1057 x = 0;
1058 }
1059 if (y < 0)
1060 {
1061 height += y;
1062 src_y -= y;
1063 y = 0;
1064 }
1065
1066 if (x + width > current_vp->width)
1067 width = current_vp->width - x;
1068 if (y + height > current_vp->height)
1069 height = current_vp->height - y;
1070
1071 /* adjust for viewport */
1072 x += current_vp->x;
1073 y += current_vp->y;
1074
1075#if defined(HAVE_VIEWPORT_CLIP)
1076 /********************* Viewport on screen clipping ********************/
1077 /* nothing to draw? */
1078 if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
1079 || (x + width <= 0) || (y + height <= 0))
1080 return;
1081
1082 /* clip image in viewport in screen */
1083 if (x < 0)
1084 {
1085 width += x;
1086 src_x -= x;
1087 x = 0;
1088 }
1089 if (y < 0)
1090 {
1091 height += y;
1092 src_y -= y;
1093 y = 0;
1094 }
1095 if (x + width > LCD_WIDTH)
1096 width = LCD_WIDTH - x;
1097 if (y + height > LCD_HEIGHT)
1098 height = LCD_HEIGHT - y;
1099#endif
1100
1101 src += stride * src_y + src_x; /* move starting point */
1102 dst = FBADDR(x, y);
1103
1104 transparent = FB_SCALARPACK(TRANSPARENT_COLOR);
1105 replacewithfg = FB_SCALARPACK(REPLACEWITHFG_COLOR);
1106 fg = FB_SCALARPACK(current_vp->fg_pattern);
1107#define CMP(c1, c2) (c1.r == c2.r && c1.g == c2.g && c1.b == c2.b)
1108
1109 do
1110 {
1111 const fb_data *src_row = src;
1112 fb_data *dst_row = dst;
1113 fb_data *row_end = dst_row + width;
1114 do
1115 {
1116 fb_data data = *src_row++;
1117 if (!CMP(data, transparent))
1118 {
1119 if (CMP(data, replacewithfg))
1120 data = fg;
1121 *dst_row = data;
1122 }
1123 }
1124 while (++dst_row < row_end);
1125 src += stride;
1126 dst += LCD_WIDTH;
1127 }
1128 while (--height > 0);
1129}
diff --git a/firmware/drivers/lcd-color-common.c b/firmware/drivers/lcd-color-common.c
index e171f08465..b5b0f58eb3 100644
--- a/firmware/drivers/lcd-color-common.c
+++ b/firmware/drivers/lcd-color-common.c
@@ -422,7 +422,7 @@ void lcd_blit_yuv(unsigned char * const src[3],
422 b = clamp(b, 0, 64*256-1); 422 b = clamp(b, 0, 64*256-1);
423 } 423 }
424 424
425 *dst = FB_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 425 *dst = FB_RGBPACK(r >> 6, g >> 6, b >> 6);
426 426
427#if LCD_WIDTH >= LCD_HEIGHT 427#if LCD_WIDTH >= LCD_HEIGHT
428 dst++; 428 dst++;
@@ -442,7 +442,7 @@ void lcd_blit_yuv(unsigned char * const src[3],
442 b = clamp(b, 0, 64*256-1); 442 b = clamp(b, 0, 64*256-1);
443 } 443 }
444 444
445 *dst = FB_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 445 *dst = FB_RGBPACK(r >> 6, g >> 6, b >> 6);
446 446
447#if LCD_WIDTH >= LCD_HEIGHT 447#if LCD_WIDTH >= LCD_HEIGHT
448 dst++; 448 dst++;
@@ -487,7 +487,7 @@ void lcd_blit_yuv(unsigned char * const src[3],
487 b = clamp(b, 0, 64*256-1); 487 b = clamp(b, 0, 64*256-1);
488 } 488 }
489 489
490 *dst = FB_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 490 *dst = FB_RGBPACK(r >> 6, g >> 6, b >> 6);
491 491
492#if LCD_WIDTH >= LCD_HEIGHT 492#if LCD_WIDTH >= LCD_HEIGHT
493 dst++; 493 dst++;
@@ -507,7 +507,7 @@ void lcd_blit_yuv(unsigned char * const src[3],
507 b = clamp(b, 0, 64*256-1); 507 b = clamp(b, 0, 64*256-1);
508 } 508 }
509 509
510 *dst = FB_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); 510 *dst = FB_RGBPACK(r >> 6, g >> 6, b >> 6);
511 511
512#if LCD_WIDTH >= LCD_HEIGHT 512#if LCD_WIDTH >= LCD_HEIGHT
513 dst++; 513 dst++;
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 9c1a8dbf57..5e4178cd4c 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -275,6 +275,7 @@
275#define VERTICAL_INTERLEAVED 4 275#define VERTICAL_INTERLEAVED 4
276#define RGB565 565 276#define RGB565 565
277#define RGB565SWAPPED 3553 277#define RGB565SWAPPED 3553
278#define RGB888 888
278 279
279/* LCD_STRIDEFORMAT */ 280/* LCD_STRIDEFORMAT */
280#define VERTICAL_STRIDE 1 281#define VERTICAL_STRIDE 1
diff --git a/firmware/export/config/samsungypr0.h b/firmware/export/config/samsungypr0.h
index 049caa01b6..0fce70e1fe 100644
--- a/firmware/export/config/samsungypr0.h
+++ b/firmware/export/config/samsungypr0.h
@@ -47,7 +47,7 @@
47/* sqrt(240^2 + 320^2) / 2.6 = 153.8 */ 47/* sqrt(240^2 + 320^2) / 2.6 = 153.8 */
48#define LCD_DPI 154 48#define LCD_DPI 154
49 49
50#define LCD_DEPTH 16 50#define LCD_DEPTH 24
51/* Check that but should not matter */ 51/* Check that but should not matter */
52#define LCD_PIXELFORMAT RGB565 52#define LCD_PIXELFORMAT RGB565
53 53
diff --git a/firmware/export/config/samsungypr1.h b/firmware/export/config/samsungypr1.h
index 1aaf85dcb5..42b46e0699 100644
--- a/firmware/export/config/samsungypr1.h
+++ b/firmware/export/config/samsungypr1.h
@@ -53,11 +53,11 @@
53#define LCD_HEIGHT 240 53#define LCD_HEIGHT 240
54#endif 54#endif
55 55
56#define LCD_DEPTH 16 56#define LCD_DEPTH 24
57/* Calculated value, important for touch sensor */ 57/* Calculated value, important for touch sensor */
58#define LCD_DPI 180 58#define LCD_DPI 180
59/* Check that but should not matter */ 59/* Check that but should not matter */
60#define LCD_PIXELFORMAT RGB565 60#define LCD_PIXELFORMAT RGB888
61 61
62/* Capacitive touchscreen */ 62/* Capacitive touchscreen */
63#define HAVE_TOUCHSCREEN 63#define HAVE_TOUCHSCREEN
diff --git a/firmware/export/config/sansae200v2.h b/firmware/export/config/sansae200v2.h
index c703439e7f..e70b409d51 100644
--- a/firmware/export/config/sansae200v2.h
+++ b/firmware/export/config/sansae200v2.h
@@ -53,8 +53,8 @@
53#define LCD_HEIGHT 220 53#define LCD_HEIGHT 220
54/* sqrt(176^2 + 220^2) / 1.8 = 156.5 */ 54/* sqrt(176^2 + 220^2) / 1.8 = 156.5 */
55#define LCD_DPI 157 55#define LCD_DPI 157
56#define LCD_DEPTH 16 /* 65536 colours */ 56#define LCD_DEPTH 24 /* 65536 colours */
57#define LCD_PIXELFORMAT RGB565 /* rgb565 */ 57#define LCD_PIXELFORMAT RGB888 /* rgb565 */
58 58
59#ifndef BOOTLOADER 59#ifndef BOOTLOADER
60/* define this if you have LCD enable function */ 60/* define this if you have LCD enable function */
diff --git a/firmware/export/config/sdlapp.h b/firmware/export/config/sdlapp.h
index cd973fcf73..626bd5c99f 100644
--- a/firmware/export/config/sdlapp.h
+++ b/firmware/export/config/sdlapp.h
@@ -44,8 +44,8 @@
44#define LCD_HEIGHT 480 44#define LCD_HEIGHT 480
45#endif 45#endif
46 46
47#define LCD_DEPTH 16 47#define LCD_DEPTH 24
48#define LCD_PIXELFORMAT RGB565 48#define LCD_PIXELFORMAT RGB888
49 49
50/* define this to indicate your device's keypad */ 50/* define this to indicate your device's keypad */
51#define HAVE_TOUCHSCREEN 51#define HAVE_TOUCHSCREEN
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 673ce069af..cf6a16572a 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -127,7 +127,13 @@ typedef unsigned char fb_data;
127#elif LCD_DEPTH <= 16 127#elif LCD_DEPTH <= 16
128typedef unsigned short fb_data; 128typedef unsigned short fb_data;
129#define FB_DATA_SZ 2 129#define FB_DATA_SZ 2
130#else /* LCD_DEPTH > 16 */ 130#elif LCD_DEPTH <= 24
131struct _fb_pixel {
132 unsigned char b, g, r;
133};
134typedef struct _fb_pixel fb_data;
135#define FB_DATA_SZ 3
136#else /* LCD_DEPTH > 24 */
131typedef unsigned long fb_data; 137typedef unsigned long fb_data;
132#define FB_DATA_SZ 4 138#define FB_DATA_SZ 4
133#endif /* LCD_DEPTH */ 139#endif /* LCD_DEPTH */
@@ -341,6 +347,31 @@ static inline unsigned lcd_color_to_native(unsigned color)
341#define RGB_UNPACK_GREEN_LCD(x) _RGB_UNPACK_GREEN_LCD(x) 347#define RGB_UNPACK_GREEN_LCD(x) _RGB_UNPACK_GREEN_LCD(x)
342#define RGB_UNPACK_BLUE_LCD(x) _RGB_UNPACK_BLUE_LCD(x) 348#define RGB_UNPACK_BLUE_LCD(x) _RGB_UNPACK_BLUE_LCD(x)
343#endif /* RGB565* */ 349#endif /* RGB565* */
350
351#elif LCD_PIXELFORMAT == RGB888
352#define LCD_MAX_RED 255
353#define LCD_MAX_GREEN 255
354#define LCD_MAX_BLUE 255
355#define LCD_RED_BITS 8
356#define LCD_GREEN_BITS 8
357#define LCD_BLUE_BITS 8
358
359/* pack/unpack native RGB values */
360#define _RGBPACK(r, g, b) ( r << 16 | g << 8 | b )
361#define _RGB_UNPACK_RED(x) ((x >> 16) & 0xff)
362#define _RGB_UNPACK_GREEN(x) ((x >> 8) & 0xff)
363#define _RGB_UNPACK_BLUE(x) ((x >> 0) & 0xff)
364
365#define _LCD_UNSWAP_COLOR(x) (x)
366#define LCD_RGBPACK(r, g, b) _RGBPACK((r), (g), (b))
367#define LCD_RGBPACK_LCD(r, g, b) _RGBPACK((r), (g), (b))
368#define RGB_UNPACK_RED(x) _RGB_UNPACK_RED(x)
369#define RGB_UNPACK_GREEN(x) _RGB_UNPACK_GREEN(x)
370#define RGB_UNPACK_BLUE(x) _RGB_UNPACK_BLUE(x)
371#define RGB_UNPACK_RED_LCD(x) _RGB_UNPACK_RED(x)
372#define RGB_UNPACK_GREEN_LCD(x) _RGB_UNPACK_GREEN(x)
373#define RGB_UNPACK_BLUE_LCD(x) _RGB_UNPACK_BLUE(x)
374
344#else 375#else
345/* other colour depths */ 376/* other colour depths */
346#endif 377#endif
@@ -367,6 +398,58 @@ static inline unsigned lcd_color_to_native(unsigned color)
367 398
368#endif /* HAVE_LCD_COLOR */ 399#endif /* HAVE_LCD_COLOR */
369 400
401/* Framebuffer conversion macros: Convert from and to the native display data
402 * format (fb_data).
403 *
404 * FB_RGBPACK: Convert the three r,g,b values to fb_data. r,g,b are
405 * assumed to in 8-bit format.
406 * FB_RGBPACK_LCD Like FB_RGBPACK, except r,g,b shall be in display-native
407 * bit format (e.g. 5-bit r for RGB565)
408 * FB_UNPACK_RED Extract the red component of fb_data into 8-bit red value.
409 * FB_UNPACK_GREEN Like FB_UNPACK_RED, just for the green component.
410 * FB_UNPACK_BLIE Like FB_UNPACK_RED, just for the green component.
411 * FB_SCALARPACK Similar to FB_RGBPACK, except that the channels are already
412 * combined into a single scalar value. Again, 8-bit per channel.
413 * FB_SCALARPACK_LCD Like FB_SCALARPACK, except the channels shall be in
414 * display-native format (i.e. the scalar is 16bits on RGB565)
415 * FB_UNPACK_SCALAR_LCD Converts an fb_data to a scalar value in display-native
416 * format, so it's the reverse of FB_SCALARPACK_LCD
417 */
418#if LCD_DEPTH >= 24
419static inline fb_data scalar_to_fb(unsigned p)
420{
421 union { fb_data st; unsigned sc; } convert;
422 convert.sc = p; return convert.st;
423}
424static inline unsigned fb_to_scalar(fb_data p)
425{
426 union { fb_data st; unsigned sc; } convert;
427 convert.st = p; return convert.sc;
428}
429#define FB_RGBPACK(r_, g_, b_) ((fb_data){.r = r_, .g = g_, .b = b_})
430#define FB_RGBPACK_LCD(r_, g_, b_) FB_RGBPACK(r_, g_, b_)
431#define FB_UNPACK_RED(fb) ((fb).r)
432#define FB_UNPACK_GREEN(fb) ((fb).g)
433#define FB_UNPACK_BLUE(fb) ((fb).b)
434#define FB_SCALARPACK(c) scalar_to_fb(c)
435#define FB_SCALARPACK_LCD(c) scalar_to_fb(c)
436#define FB_UNPACK_SCALAR_LCD(fb) fb_to_scalar(fb)
437#elif defined(HAVE_LCD_COLOR)
438#define FB_RGBPACK(r_, g_, b_) LCD_RGBPACK(r_, g_, b_)
439#define FB_RGBPACK_LCD(r_, g_, b_) LCD_RGBPACK_LCD(r_, g_, b_)
440#define FB_UNPACK_RED(fb) RGB_UNPACK_RED(fb)
441#define FB_UNPACK_GREEN(fb) RGB_UNPACK_GREEN(fb)
442#define FB_UNPACK_BLUE(fb) RGB_UNPACK_BLUE(fb)
443#define FB_SCALARPACK(c) LCD_RGBPACK(RGB_UNPACK_RED(c), RGB_UNPACK_GREEN(c), RGB_UNPACK_BLUE(c))
444#define FB_SCALARPACK_LCD(c) (c)
445#define FB_UNPACK_SCALAR_LCD(fb) (fb)
446#else
447#define FB_SCALARPACK(c) (c)
448#define FB_SCALARPACK_LCD(c) (c)
449#define FB_UNPACK_SCALAR_LCD(fb) (fb)
450#endif
451
452
370/* Frame buffer dimensions */ 453/* Frame buffer dimensions */
371#if LCD_DEPTH == 1 454#if LCD_DEPTH == 1
372#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 455#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
diff --git a/firmware/screendump.c b/firmware/screendump.c
index 28c37610af..2916cc1c9f 100644
--- a/firmware/screendump.c
+++ b/firmware/screendump.c
@@ -118,6 +118,9 @@ void screen_dump(void)
118#elif LCD_DEPTH <= 16 118#elif LCD_DEPTH <= 16
119 unsigned short *dst, *dst_end; 119 unsigned short *dst, *dst_end;
120 unsigned short linebuf[DUMP_BMP_LINESIZE/2]; 120 unsigned short linebuf[DUMP_BMP_LINESIZE/2];
121#else /* 24bit */
122 unsigned char *dst, *dst_end;
123 unsigned char linebuf[DUMP_BMP_LINESIZE * 3];
121#endif 124#endif
122 125
123#if CONFIG_RTC 126#if CONFIG_RTC
@@ -227,6 +230,17 @@ void screen_dump(void)
227#endif 230#endif
228 } 231 }
229 while (dst < dst_end); 232 while (dst < dst_end);
233#elif LCD_DEPTH == 24
234 dst_end = dst + LCD_WIDTH*3;
235 src = FBADDR(0, y);
236 do
237 {
238 *dst++ = src->b;
239 *dst++ = src->g;
240 *dst++ = src->r;
241 ++src;
242 }
243 while (dst < dst_end);
230 244
231#endif /* LCD_DEPTH */ 245#endif /* LCD_DEPTH */
232 write(fd, linebuf, DUMP_BMP_LINESIZE); 246 write(fd, linebuf, DUMP_BMP_LINESIZE);
diff --git a/firmware/target/hosted/sdl/lcd-bitmap.c b/firmware/target/hosted/sdl/lcd-bitmap.c
index 7e9bc297ef..5add2367a0 100644
--- a/firmware/target/hosted/sdl/lcd-bitmap.c
+++ b/firmware/target/hosted/sdl/lcd-bitmap.c
@@ -112,6 +112,8 @@ static unsigned long get_lcd_pixel(int x, int y)
112#else 112#else
113 return *FBADDR(x, y); 113 return *FBADDR(x, y);
114#endif 114#endif
115#elif LCD_DEPTH == 24
116 return FB_UNPACK_SCALAR_LCD(*FBADDR(x, y));
115#endif 117#endif
116} 118}
117 119
@@ -172,7 +174,7 @@ void sim_backlight(int value)
172/* initialise simulator lcd driver */ 174/* initialise simulator lcd driver */
173void lcd_init_device(void) 175void lcd_init_device(void)
174{ 176{
175#if LCD_DEPTH == 16 177#if LCD_DEPTH >= 16
176 lcd_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, 178 lcd_surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
177 SIM_LCD_WIDTH * display_zoom, 179 SIM_LCD_WIDTH * display_zoom,
178 SIM_LCD_HEIGHT * display_zoom, 180 SIM_LCD_HEIGHT * display_zoom,
diff --git a/tools/bmp2rb.c b/tools/bmp2rb.c
index 2a7dcdee92..24ea1a8026 100644
--- a/tools/bmp2rb.c
+++ b/tools/bmp2rb.c
@@ -491,14 +491,6 @@ void generate_c_source(char *id, char* header_dir, int width, int height,
491 bool have_header = header_dir && header_dir[0]; 491 bool have_header = header_dir && header_dir[0];
492 create_bm = have_header && create_bm; 492 create_bm = have_header && create_bm;
493 493
494 if (t_depth > 16)
495 {
496 fprintf(stderr, "Generating C source not supported for this format\n");
497 fprintf(stderr, "because Rockbox does not support this display depth yet.\n");
498 fprintf(stderr, "However you are welcome to fix this!\n");
499 return;
500 }
501
502 if (!id || !id[0]) 494 if (!id || !id[0])
503 id = "bitmap"; 495 id = "bitmap";
504 496
@@ -520,8 +512,11 @@ void generate_c_source(char *id, char* header_dir, int width, int height,
520 id, height, id, width); 512 id, height, id, width);
521 if (t_depth <= 8) 513 if (t_depth <= 8)
522 fprintf(fh, "extern const unsigned char %s[];\n", id); 514 fprintf(fh, "extern const unsigned char %s[];\n", id);
523 else 515 else if (t_depth <= 16)
524 fprintf(fh, "extern const unsigned short %s[];\n", id); 516 fprintf(fh, "extern const unsigned short %s[];\n", id);
517 else
518 fprintf(fh, "extern const fb_data %s[];\n", id);
519
525 520
526 if (create_bm) 521 if (create_bm)
527 { 522 {
@@ -542,8 +537,10 @@ void generate_c_source(char *id, char* header_dir, int width, int height,
542 537
543 if (t_depth <= 8) 538 if (t_depth <= 8)
544 fprintf(f, "const unsigned char %s[] = {\n", id); 539 fprintf(f, "const unsigned char %s[] = {\n", id);
545 else 540 else if (t_depth == 16)
546 fprintf(f, "const unsigned short %s[] = {\n", id); 541 fprintf(f, "const unsigned short %s[] = {\n", id);
542 else if (t_depth == 24)
543 fprintf(f, "const fb_data %s[] = {\n", id);
547 544
548 for (i = 0; i < t_height; i++) 545 for (i = 0; i < t_height; i++)
549 { 546 {
@@ -555,6 +552,12 @@ void generate_c_source(char *id, char* header_dir, int width, int height,
555 else if (t_depth == 16) 552 else if (t_depth == 16)
556 fprintf(f, "0x%04x,%c", t_bitmap->d16[i * t_width + a], 553 fprintf(f, "0x%04x,%c", t_bitmap->d16[i * t_width + a],
557 (a + 1) % 10 ? ' ' : '\n'); 554 (a + 1) % 10 ? ' ' : '\n');
555 else if (t_depth == 24)
556 fprintf(f, "{ .r = 0x%02x, .g = 0x%02x, .b = 0x%02x },%c",
557 t_bitmap->d24[i * t_width + a].r,
558 t_bitmap->d24[i * t_width + a].g,
559 t_bitmap->d24[i * t_width + a].b,
560 (a + 1) % 4 ? ' ' : '\n');
558 } 561 }
559 fprintf(f, "\n"); 562 fprintf(f, "\n");
560 } 563 }
@@ -651,7 +654,7 @@ void print_usage(void)
651 "\t 6 Greyscale iPod 4-grey\n" 654 "\t 6 Greyscale iPod 4-grey\n"
652 "\t 7 Greyscale X5 remote 4-grey\n" 655 "\t 7 Greyscale X5 remote 4-grey\n"
653 "\t 8 16-bit packed 5-6-5 RGB with a vertical stride\n" 656 "\t 8 16-bit packed 5-6-5 RGB with a vertical stride\n"
654 "\t 9 24-bit BGR (raw only for now)\n"); 657 "\t 9 24-bit BGR\n");
655 printf("build date: " __DATE__ "\n\n"); 658 printf("build date: " __DATE__ "\n\n");
656} 659}
657 660
diff --git a/wps/WPSLIST b/wps/WPSLIST
index 93a173a18a..d26370214f 100644
--- a/wps/WPSLIST
+++ b/wps/WPSLIST
@@ -79,58 +79,58 @@ RSBS: no
79<main> 79<main>
80 80
81# override implicit .wps filename 81# override implicit .wps filename
82wps.800x480x16: cabbiev2.800x480x16.wps 82wps.800x480x(16|24): cabbiev2.800x480x16.wps
83wps.480x800x16: cabbiev2.480x800x16.wps 83wps.480x800x(16|24): cabbiev2.480x800x16.wps
84wps.400x240x16: cabbiev2.400x240x16.wps 84wps.400x240x(16|24): cabbiev2.400x240x16.wps
85wps.320x480x16: cabbiev2.320x480x16.wps 85wps.320x480x(16|24): cabbiev2.320x480x16.wps
86wps.320x240x16: cabbiev2.320x240x16.wps 86wps.320x240x(16|24): cabbiev2.320x240x16.wps
87wps.240x400x16: cabbiev2.240x400x16.wps 87wps.240x400x(16|24): cabbiev2.240x400x16.wps
88wps.240x320x16: cabbiev2.240x320x16.wps 88wps.240x320x(16|24): cabbiev2.240x320x16.wps
89wps.220x176x16: cabbiev2.220x176x16.wps 89wps.220x176x(16|24): cabbiev2.220x176x16.wps
90wps.176x220x16: cabbiev2.176x220x16.wps 90wps.176x220x(16|24): cabbiev2.176x220x16.wps
91wps.176x132x16: cabbiev2.176x132x16.wps 91wps.176x132x(16|24): cabbiev2.176x132x16.wps
92wps.160x128x16: cabbiev2.160x128x16.wps 92wps.160x128x(16|24): cabbiev2.160x128x16.wps
93wps.160x128x2: cabbiev2.160x128x2.wps 93wps.160x128x2: cabbiev2.160x128x2.wps
94wps.160x128x1: cabbiev2.160x128x1.wps 94wps.160x128x1: cabbiev2.160x128x1.wps
95wps.138x110x2: cabbiev2.138x110x2.wps 95wps.138x110x2: cabbiev2.138x110x2.wps
96wps.128x128x16: cabbiev2.128x128x16.wps 96wps.128x128x(16|24): cabbiev2.128x128x16.wps
97wps.128x128x2: cabbiev2.128x128x2.wps 97wps.128x128x2: cabbiev2.128x128x2.wps
98wps.128x160x16: cabbiev2.128x160x16.wps 98wps.128x160x(16|24): cabbiev2.128x160x16.wps
99wps.132x80x16: cabbiev2.132x80x16.wps 99wps.132x80x(16|24): cabbiev2.132x80x16.wps
100wps.128x96x16: cabbiev2.128x96x16.wps 100wps.128x96x(16|24): cabbiev2.128x96x16.wps
101wps.128x96x2: cabbiev2.128x96x2.wps 101wps.128x96x2: cabbiev2.128x96x2.wps
102wps.128x64x1: cabbiev2.128x64x1.wps 102wps.128x64x1: cabbiev2.128x64x1.wps
103wps.112x64x1: cabbiev2.112x64x1.wps 103wps.112x64x1: cabbiev2.112x64x1.wps
104wps.96x96x16: cabbiev2.96x96x16.wps 104wps.96x96x(16|24): cabbiev2.96x96x16.wps
105 105
106# override implicit .fms filename 106# override implicit .fms filename
107fms.160x128x2: cabbiev2-160x128x2.fms 107fms.160x128x2: cabbiev2-160x128x2.fms
108fms.128x128x2: cabbiev2-128x128x2.fms 108fms.128x128x2: cabbiev2-128x128x2.fms
109 109
110# Preferred font (including .fnt extension - leave blank for player): 110# Preferred font (including .fnt extension - leave blank for player):
111Font.800x480x16: 35-Adobe-Helvetica.fnt 111Font.800x480x(16|24): 35-Adobe-Helvetica.fnt
112Font.480x800x16: 35-Adobe-Helvetica.fnt 112Font.480x800x(16|24): 35-Adobe-Helvetica.fnt
113Font.400x240x16: 15-Adobe-Helvetica.fnt 113Font.400x240x(16|24): 15-Adobe-Helvetica.fnt
114Font.320x480x16: 27-Adobe-Helvetica.fnt 114Font.320x480x(16|24): 27-Adobe-Helvetica.fnt
115Font.320x240x16: 15-Adobe-Helvetica.fnt 115Font.320x240x(16|24): 15-Adobe-Helvetica.fnt
116Font.240x400x16: 16-Adobe-Helvetica.fnt 116Font.240x400x(16|24): 16-Adobe-Helvetica.fnt
117Font.240x320x16: 15-Adobe-Helvetica.fnt 117Font.240x320x(16|24): 15-Adobe-Helvetica.fnt
118Font.220x176x16: 12-Adobe-Helvetica.fnt 118Font.220x176x(16|24): 12-Adobe-Helvetica.fnt
119Font.176x220x16: 12-Adobe-Helvetica.fnt 119Font.176x220x(16|24): 12-Adobe-Helvetica.fnt
120Font.176x132x16: 12-Adobe-Helvetica.fnt 120Font.176x132x(16|24): 12-Adobe-Helvetica.fnt
121Font.160x128x16: 12-Adobe-Helvetica.fnt 121Font.160x128x(16|24): 12-Adobe-Helvetica.fnt
122Font.160x128x2: 12-Adobe-Helvetica.fnt 122Font.160x128x2: 12-Adobe-Helvetica.fnt
123Font.160x128x1: 12-Adobe-Helvetica.fnt 123Font.160x128x1: 12-Adobe-Helvetica.fnt
124Font.138x110x2: 12-Adobe-Helvetica.fnt 124Font.138x110x2: 12-Adobe-Helvetica.fnt
125Font.128x128x16: 12-Adobe-Helvetica.fnt 125Font.128x128x(16|24): 12-Adobe-Helvetica.fnt
126Font.128x128x2: 12-Adobe-Helvetica.fnt 126Font.128x128x2: 12-Adobe-Helvetica.fnt
127Font.128x160x16: 12-Adobe-Helvetica.fnt 127Font.128x160x(16|24): 12-Adobe-Helvetica.fnt
128Font.132x80x16: 11-Sazanami-Mincho.fnt 128Font.132x80x(16|24): 11-Sazanami-Mincho.fnt
129Font.128x96x16: 08-Rockfont.fnt 129Font.128x96x(16|24): 08-Rockfont.fnt
130Font.128x96x2: 12-Adobe-Helvetica.fnt 130Font.128x96x2: 12-Adobe-Helvetica.fnt
131Font.128x64x1: 08-Rockfont.fnt 131Font.128x64x1: 08-Rockfont.fnt
132Font.112x64x1: 08-Rockfont.fnt 132Font.112x64x1: 08-Rockfont.fnt
133Font.96x96x16: 08-Rockfont.fnt 133Font.96x96x(16|24): 08-Rockfont.fnt
134 134
135#misc settings that should be ignored on grayscale targets 135#misc settings that should be ignored on grayscale targets
136foreground color: CCCCCC 136foreground color: CCCCCC
@@ -141,68 +141,68 @@ line selector text color: 000000
141filetype colours: - 141filetype colours: -
142 142
143#backdrop - remember this is the source file name in your SVN folder, not dest name! 143#backdrop - remember this is the source file name in your SVN folder, not dest name!
144backdrop.800x480x16: backdrops/cabbiev2.800x480x16.bmp 144backdrop.800x480x(16|24): backdrops/cabbiev2.800x480x16.bmp
145backdrop.480x800x16: backdrops/cabbiev2.480x800x16.bmp 145backdrop.480x800x(16|24): backdrops/cabbiev2.480x800x16.bmp
146backdrop.400x240x16: backdrops/cabbiev2.400x240x16.bmp 146backdrop.400x240x(16|24): backdrops/cabbiev2.400x240x16.bmp
147backdrop.320x480x16: backdrops/cabbiev2.320x480x16.bmp 147backdrop.320x480x(16|24): backdrops/cabbiev2.320x480x16.bmp
148backdrop.320x240x16: backdrops/cabbiev2.320x240x16.bmp 148backdrop.320x240x(16|24): backdrops/cabbiev2.320x240x16.bmp
149backdrop.128x128x16: backdrops/cabbiev2.128x128x16.bmp 149backdrop.128x128x(16|24): backdrops/cabbiev2.128x128x16.bmp
150backdrop.128x128x2: backdrops/cabbiev2.128x128x2.bmp 150backdrop.128x128x2: backdrops/cabbiev2.128x128x2.bmp
151backdrop.128x160x16: backdrops/cabbiev2.128x160x16.bmp 151backdrop.128x160x(16|24): backdrops/cabbiev2.128x160x16.bmp
152backdrop.132x80x16: backdrops/cabbiev2.132x80x16.bmp 152backdrop.132x80x(16|24): backdrops/cabbiev2.132x80x16.bmp
153backdrop.138x110x2: backdrops/cabbiev2.138x110x2.bmp 153backdrop.138x110x2: backdrops/cabbiev2.138x110x2.bmp
154backdrop.160x128x16: backdrops/cabbiev2.160x128x16.bmp 154backdrop.160x128x(16|24): backdrops/cabbiev2.160x128x16.bmp
155backdrop.160x128x2: backdrops/cabbiev2.160x128x2.bmp 155backdrop.160x128x2: backdrops/cabbiev2.160x128x2.bmp
156backdrop.176x132x16: backdrops/cabbiev2.176x132x16.bmp 156backdrop.176x132x(16|24): backdrops/cabbiev2.176x132x16.bmp
157backdrop.176x220x16: backdrops/cabbiev2.176x220x16.bmp 157backdrop.176x220x(16|24): backdrops/cabbiev2.176x220x16.bmp
158backdrop.220x176x16: backdrops/cabbiev2.220x176x16.bmp 158backdrop.220x176x(16|24): backdrops/cabbiev2.220x176x16.bmp
159backdrop.240x320x16: backdrops/cabbiev2.240x320x16.bmp 159backdrop.240x320x(16|24): backdrops/cabbiev2.240x320x16.bmp
160backdrop.240x400x16: backdrops/cabbiev2.240x400x16.bmp 160backdrop.240x400x(16|24): backdrops/cabbiev2.240x400x16.bmp
161backdrop.96x96x16: backdrops/cabbiev2.96x96x16.bmp 161backdrop.96x96x(16|24): backdrops/cabbiev2.96x96x16.bmp
162backdrop.128x96x16: backdrops/cabbiev2.128x96x16.bmp 162backdrop.128x96x(16|24): backdrops/cabbiev2.128x96x16.bmp
163backdrop.128x96x2: backdrops/cabbiev2.128x96x2.bmp 163backdrop.128x96x2: backdrops/cabbiev2.128x96x2.bmp
164 164
165#selection bar settings for color targets 165#selection bar settings for color targets
166selector type..+x16: bar (gradient) 166selector type..+x16: bar (gradient)
167selector type..+x2: bar (inverse) 167selector type..+x2: bar (inverse)
168 168
169#icons 169#icons
170iconset.800x480x16: icons/tango_icons.32x32.bmp 170iconset.800x480x(16|24): icons/tango_icons.32x32.bmp
171iconset.480x800x16: icons/tango_icons.32x32.bmp 171iconset.480x800x(16|24): icons/tango_icons.32x32.bmp
172iconset.400x240x16: icons/tango_icons.16x16.bmp 172iconset.400x240x(16|24): icons/tango_icons.16x16.bmp
173iconset.320x480x16: icons/tango_icons.24x24.bmp 173iconset.320x480x(16|24): icons/tango_icons.24x24.bmp
174iconset.320x240x16: icons/tango_icons.16x16.bmp 174iconset.320x240x(16|24): icons/tango_icons.16x16.bmp
175iconset.128x128x16: icons/tango_icons.12x12.bmp 175iconset.128x128x(16|24): icons/tango_icons.12x12.bmp
176iconset.128x160x16: icons/tango_icons.12x12.bmp 176iconset.128x160x(16|24): icons/tango_icons.12x12.bmp
177iconset.132x80x16: icons/tango_icons.12x12.bmp 177iconset.132x80x(16|24): icons/tango_icons.12x12.bmp
178iconset.160x128x16: icons/tango_icons.12x12.bmp 178iconset.160x128x(16|24): icons/tango_icons.12x12.bmp
179iconset.176x132x16: icons/tango_icons.12x12.bmp 179iconset.176x132x(16|24): icons/tango_icons.12x12.bmp
180iconset.176x220x16: icons/tango_icons.12x12.bmp 180iconset.176x220x(16|24): icons/tango_icons.12x12.bmp
181iconset.220x176x16: icons/tango_icons.12x12.bmp 181iconset.220x176x(16|24): icons/tango_icons.12x12.bmp
182iconset.240x320x16: icons/tango_icons.16x16.bmp 182iconset.240x320x(16|24): icons/tango_icons.16x16.bmp
183iconset.240x400x16: icons/tango_icons.16x16.bmp 183iconset.240x400x(16|24): icons/tango_icons.16x16.bmp
184iconset.128x96x16: icons/tango_icons.8x8.bmp 184iconset.128x96x(16|24): icons/tango_icons.8x8.bmp
185iconset.96x96x16: icons/tango_icons.8x8.bmp 185iconset.96x96x(16|24): icons/tango_icons.8x8.bmp
186iconset..+x2: icons/tango_small_mono.bmp 186iconset..+x2: icons/tango_small_mono.bmp
187 187
188#viewer icons 188#viewer icons
189viewers iconset.800x480x16: icons/tango_icons_viewers.32x32.bmp 189viewers iconset.800x480x(16|24): icons/tango_icons_viewers.32x32.bmp
190viewers iconset.480x800x16: icons/tango_icons_viewers.32x32.bmp 190viewers iconset.480x800x(16|24): icons/tango_icons_viewers.32x32.bmp
191viewers iconset.400x240x16: icons/tango_icons_viewers.16x16.bmp 191viewers iconset.400x240x(16|24): icons/tango_icons_viewers.16x16.bmp
192viewers iconset.320x480x16: icons/tango_icons_viewers.24x24.bmp 192viewers iconset.320x480x(16|24): icons/tango_icons_viewers.24x24.bmp
193viewers iconset.320x240x16: icons/tango_icons_viewers.16x16.bmp 193viewers iconset.320x240x(16|24): icons/tango_icons_viewers.16x16.bmp
194viewers iconset.128x128x16: icons/tango_icons_viewers.12x12.bmp 194viewers iconset.128x128x(16|24): icons/tango_icons_viewers.12x12.bmp
195viewers iconset.128x160x16: icons/tango_icons_viewers.12x12.bmp 195viewers iconset.128x160x(16|24): icons/tango_icons_viewers.12x12.bmp
196viewers iconset.132x80x16: icons/tango_icons_viewers.12x12.bmp 196viewers iconset.132x80x(16|24): icons/tango_icons_viewers.12x12.bmp
197viewers iconset.160x128x16: icons/tango_icons_viewers.12x12.bmp 197viewers iconset.160x128x(16|24): icons/tango_icons_viewers.12x12.bmp
198viewers iconset.176x132x16: icons/tango_icons_viewers.12x12.bmp 198viewers iconset.176x132x(16|24): icons/tango_icons_viewers.12x12.bmp
199viewers iconset.176x220x16: icons/tango_icons_viewers.12x12.bmp 199viewers iconset.176x220x(16|24): icons/tango_icons_viewers.12x12.bmp
200viewers iconset.220x176x16: icons/tango_icons_viewers.12x12.bmp 200viewers iconset.220x176x(16|24): icons/tango_icons_viewers.12x12.bmp
201viewers iconset.240x320x16: icons/tango_icons_viewers.16x16.bmp 201viewers iconset.240x320x(16|24): icons/tango_icons_viewers.16x16.bmp
202viewers iconset.240x400x16: icons/tango_icons_viewers.16x16.bmp 202viewers iconset.240x400x(16|24): icons/tango_icons_viewers.16x16.bmp
203viewers iconset.128x96x16: icons/tango_icons_viewers.8x8.bmp 203viewers iconset.128x96x(16|24): icons/tango_icons_viewers.8x8.bmp
204viewers iconset.96x96x16: icons/tango_icons_viewers.8x8.bmp 204viewers iconset.96x96x(16|24): icons/tango_icons_viewers.8x8.bmp
205viewers iconset..+x2: icons/tango_small_viewers_mono.bmp 205viewers iconset..+x2: icons/tango_small_viewers_mono.bmp
206 206
207show icons: on 207show icons: on
208statusbar: top 208statusbar: top