diff options
author | Thomas Martitz <kugel@rockbox.org> | 2014-06-18 07:15:00 +0200 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2014-06-21 00:15:53 +0200 |
commit | a1842c04f9cb73210d4cacde61a9e4b115050765 (patch) | |
tree | a37af61ef9285b763a42cd33797e2f3d634fbf9f | |
parent | 0250be1d6799db7b5ddc99cb33f31bf9cff01ed2 (diff) | |
download | rockbox-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
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 /* list of primary colors */ #define SB_PRIM 0 #define SB_FILL 1 -static const fb_data prim_rgb[][3] = +static const unsigned prim_rgb[][3] = { /* Foreground colors for sliders */ { @@ -87,13 +87,13 @@ static const unsigned char rgb_max[3] = /* Unpacks the color value into native rgb values and 24 bit rgb values */ static void unpack_rgb(struct rgb_pick *rgb) { - unsigned color = _LCD_UNSWAP_COLOR(rgb->color); - rgb->red = _RGB_UNPACK_RED(color); - rgb->green = _RGB_UNPACK_GREEN(color); - rgb->blue = _RGB_UNPACK_BLUE(color); - rgb->r = _RGB_UNPACK_RED_LCD(color); - rgb->g = _RGB_UNPACK_GREEN_LCD(color); - rgb->b = _RGB_UNPACK_BLUE_LCD(color); + unsigned color = rgb->color; + rgb->red = RGB_UNPACK_RED(color); + rgb->green = RGB_UNPACK_GREEN(color); + rgb->blue = RGB_UNPACK_BLUE(color); + rgb->r = RGB_UNPACK_RED_LCD(color); + rgb->g = RGB_UNPACK_GREEN_LCD(color); + rgb->b = RGB_UNPACK_BLUE_LCD(color); } /* Packs the native rgb colors into a color value */ @@ -159,6 +159,7 @@ static void draw_screen(struct screen *display, char *title, int max_label_width; int text_x, text_top; int slider_x, slider_width; + int value_width; bool display_three_rows; struct viewport vp; @@ -185,7 +186,12 @@ static void draw_screen(struct screen *display, char *title, TITLE_MARGIN_BOTTOM + SELECTOR_TB_MARGIN; text_x = SELECTOR_WIDTH; slider_x = text_x + max_label_width + SLIDER_TEXT_MARGIN; - slider_width = vp.width - slider_x*2 - max_label_width; + slider_width = vp.width - text_x - slider_x - SLIDER_TEXT_MARGIN; + if (display->depth >= 24) + display->getstringsize("255", &value_width, NULL); + else + display->getstringsize("63", &value_width, NULL); + slider_width -= value_width; line_height = char_height + 2*SELECTOR_TB_MARGIN; /* 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, vp.flags &= ~VP_FLAG_ALIGNMENT_MASK; display->putsxy(text_x, text_top, buf); /* Draw color value */ - snprintf(buf, 3, "%02d", rgb->rgb_val[i]); + if (display->depth >= 24) + snprintf(buf, 4, "%03d", rgb->rgb_val[i]); + else + snprintf(buf, 3, "%02d", rgb->rgb_val[i]); vp.flags |= VP_FLAG_ALIGN_RIGHT; display->putsxy(text_x, text_top, buf); @@ -324,7 +333,7 @@ static int touchscreen_slider(struct screen *display, { short x, y; int char_height, line_height; - int max_label_width; + int max_label_width, value_width; int text_top, slider_x, slider_width; bool display_three_rows; int button; @@ -345,7 +354,12 @@ static int touchscreen_slider(struct screen *display, text_top = MARGIN_TOP + char_height + TITLE_MARGIN_BOTTOM + SELECTOR_TB_MARGIN; slider_x = SELECTOR_WIDTH + max_label_width + SLIDER_TEXT_MARGIN; - slider_width = vp.width - slider_x*2 - max_label_width; + slider_width = vp.width - SELECTOR_WIDTH - slider_x - SLIDER_TEXT_MARGIN; + if (display->depth >= 24) + display->getstringsize("255", &value_width, NULL); + else + display->getstringsize("63", &value_width, NULL); + slider_width -= value_width; line_height = char_height + 2*SELECTOR_TB_MARGIN; /* 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 { int16_t line; /* line text color if STYLE_COLORED is specified, in native * lcd format (convert with LCD_RGBPACK() if necessary) */ - fb_data text_color; + unsigned text_color; /* line color if STYLE_COLORBAR or STYLE_GRADIENT is specified, in native * lcd format (convert with LCD_RGBPACK() if necessary) */ - fb_data line_color, line_end_color; + unsigned line_color, line_end_color; /* line decorations, see STYLE_DEFAULT etc. */ enum line_styles style; /* 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, * come before the text style tag color fields need to be preserved */ if (data->style & STYLE_GRADIENT) { - fb_data tc = linedes->text_color, - lc = linedes->line_color, - lec = linedes->line_end_color; + unsigned tc = linedes->text_color, + lc = linedes->line_color, + lec = linedes->line_end_color; *linedes = *data; linedes->text_color = tc; 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 = { lcd_get_backdrop, lcd_set_backdrop, #endif -#if LCD_DEPTH == 16 +#if LCD_DEPTH >= 16 lcd_bitmap_transparent_part, lcd_bitmap_transparent, #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 { fb_data* (*lcd_get_backdrop)(void); void (*lcd_set_backdrop)(fb_data* backdrop); #endif -#if LCD_DEPTH == 16 +#if LCD_DEPTH >= 16 void (*lcd_bitmap_transparent_part)(const fb_data *src, int src_x, int src_y, int stride, 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 fireworks.c #endif -#if LCD_DEPTH >= 16 +#if LCD_DEPTH == 16 +/* FIXME: make it work with 24bit (needs lot of memory) */ rockpaint.c #endif 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 rockboy #endif -#ifdef HAVE_TAGCACHE +#if defined(HAVE_TAGCACHE) pictureflow #endif 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) #ifndef HAVE_LCD_COLOR paldata[i]=(3*r+6*g+b)/10; #else - paldata[i] = LCD_RGBPACK(r,g,b); + paldata[i] = FB_RGBPACK(r,g,b); #endif } 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) if(bins_acc >= ARRAYLEN_PLOT) { unsigned index = (SHADES-1)*bins_max / graph_max; + unsigned color; /* These happen because we exaggerate the graph a little for * linear mode */ if(index >= SHADES) index = SHADES-1; - mylcd_set_foreground(SPECTROGRAPH_PALETTE(index)); + color = FB_UNPACK_SCALAR_LCD(SPECTROGRAPH_PALETTE(index)); + mylcd_set_foreground(color); mylcd_drawpixel(fft_spectrogram_pos, y); if(--y < 0) @@ -973,13 +975,15 @@ static void draw_spectrogram_horizontal(unsigned this_max, unsigned graph_max) if(bins_acc >= ARRAYLEN_PLOT) { unsigned index = (SHADES-1)*bins_max / graph_max; + unsigned color; /* These happen because we exaggerate the graph a little for * linear mode */ if(index >= SHADES) index = SHADES-1; - mylcd_set_foreground(SPECTROGRAPH_PALETTE(index)); + color = FB_UNPACK_SCALAR_LCD(SPECTROGRAPH_PALETTE(index)); + mylcd_set_foreground(color); mylcd_drawpixel(x, fft_spectrogram_pos); 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) int i; for (i = 0; i < 32; i++){ /* black to blue, 32 values*/ - palette[i]=LCD_RGBPACK(0, 0, 2*i); + palette[i]=FB_RGBPACK(0, 0, 2*i); /* blue to red, 32 values*/ - palette[i + 32]=LCD_RGBPACK(8*i, 0, 64 - 2*i); + palette[i + 32]=FB_RGBPACK(8*i, 0, 64 - 2*i); /* red to yellow, 32 values*/ - palette[i + 64]=LCD_RGBPACK(255, 8*i, 0); + palette[i + 64]=FB_RGBPACK(255, 8*i, 0); /* yellow to white, 162 values */ - palette[i + 96]=LCD_RGBPACK(255, 255, 0 + 4*i); - palette[i + 128]=LCD_RGBPACK(255, 255, 64 + 4*i); - palette[i + 160]=LCD_RGBPACK(255, 255, 128 + 4*i); - palette[i + 192]=LCD_RGBPACK(255, 255, 192 + i); - palette[i + 224]=LCD_RGBPACK(255, 255, 224 + i); + palette[i + 96]=FB_RGBPACK(255, 255, 0 + 4*i); + palette[i + 128]=FB_RGBPACK(255, 255, 64 + 4*i); + palette[i + 160]=FB_RGBPACK(255, 255, 128 + 4*i); + palette[i + 192]=FB_RGBPACK(255, 255, 192 + i); + palette[i + 224]=FB_RGBPACK(255, 255, 224 + i); } #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) 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]; #endif #ifdef HAVE_LCD_COLOR -#define COLOR(iter) (fb_data)LCOLOR(iter) -#define CONVERGENCE_COLOR LCD_RGBPACK(0, 0, 0) +#define COLOR(iter) FB_SCALARPACK(LCOLOR(iter)) +#define CONVERGENCE_COLOR FB_RGBPACK(0, 0, 0) #else /* greyscale */ #define COLOR(iter) (unsigned char)LCOLOR(iter) #define CONVERGENCE_COLOR 0 @@ -413,4 +413,3 @@ static int mandelbrot_precision(int d) return changed; } - 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) b = component_to_lcd(p->b, LCD_BLUE_BITS, NODITHER_DELTA); b = clamp_component_bits(b, LCD_BLUE_BITS); - return LCD_RGBPACK_LCD(r, g, b); + return FB_RGBPACK_LCD(r, g, b); } /** write a monochrome pixel to the colour LCD **/ @@ -119,7 +119,7 @@ static fb_data pixel_to_lcd_gray(void) b = component_to_lcd(g, LCD_BLUE_BITS, NODITHER_DELTA); g = component_to_lcd(g, LCD_GREEN_BITS, NODITHER_DELTA); - return LCD_RGBPACK_LCD(r, g, b); + return FB_RGBPACK_LCD(r, g, b); } /** @@ -163,7 +163,7 @@ static fb_data pixel_odither_to_lcd(void) p->col += p->inc; - return LCD_RGBPACK_LCD(r, g, b); + return FB_RGBPACK_LCD(r, g, b); } /** @@ -217,7 +217,7 @@ static fb_data pixel_fsdither_to_lcd(void) distribute_error(&p->ce[BLU], &p->e[BLU], bc, epos, inc); /* Pack and return pixel */ - return LCD_RGBPACK_LCD(r, g, b); + return FB_RGBPACK_LCD(r, g, b); } /* 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) { return PLUGIN_ERROR; } - *dst = LCD_RGBPACK( + *dst = FB_RGBPACK( (255 * r)/ppm->maxval, (255 * g)/ppm->maxval, (255 * b)/ppm->maxval); @@ -216,7 +216,7 @@ static int read_ppm_row(int fd, struct ppm_info *ppm, int row) { return PLUGIN_ERROR; } - *dst = LCD_RGBPACK( + *dst = FB_RGBPACK( (255 * r)/ppm->maxval, (255 * g)/ppm->maxval, (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) } -static inline void fire_alpha(int xc, int yc, fb_data color) +static inline void fire_alpha(int xc, int yc, unsigned color) { int oldmode = rb->lcd_get_drawmode(); @@ -1128,12 +1128,12 @@ static void move_fire(void) /* Check for hit*/ for (i = FIRE_SPEED; i >= 0; i--) { pix = get_pixel(fire_x, fire_y + i); - if(pix == screen_white) { + if(!memcmp(&pix, &screen_white, sizeof(fb_data))) { hit_white = true; fire_y += i; break; } - if(pix == screen_green) { + if(!memcmp(&pix, &screen_green, sizeof(fb_data))) { hit_green = true; fire_y += i; break; @@ -1336,7 +1336,8 @@ static void move_bombs(void) /* Check for green (ship or shield) */ for (j = BOMB_HEIGHT; j >= BOMB_HEIGHT - BOMB_SPEED; j--) { bombs[i].target = 0; - if(get_pixel(bombs[i].x + BOMB_WIDTH / 2, bombs[i].y + j) == screen_green) { + fb_data pix = get_pixel(bombs[i].x + BOMB_WIDTH / 2, bombs[i].y + j); + if(!memcmp(&pix, &screen_green, sizeof(fb_data))) { /* Move to hit pixel */ bombs[i].x += BOMB_WIDTH / 2; 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) if (XAP > 0) { pix = ypoint + xpoint; - r = RGB_UNPACK_RED(*pix) * INV_XAP; - g = RGB_UNPACK_GREEN(*pix) * INV_XAP; - b = RGB_UNPACK_BLUE(*pix) * INV_XAP; + r = FB_UNPACK_RED(*pix) * INV_XAP; + g = FB_UNPACK_GREEN(*pix) * INV_XAP; + b = FB_UNPACK_BLUE(*pix) * INV_XAP; pix++; - r += RGB_UNPACK_RED(*pix) * XAP; - g += RGB_UNPACK_GREEN(*pix) * XAP; - b += RGB_UNPACK_BLUE(*pix) * XAP; + r += FB_UNPACK_RED(*pix) * XAP; + g += FB_UNPACK_GREEN(*pix) * XAP; + b += FB_UNPACK_BLUE(*pix) * XAP; pix += sow; - rr = RGB_UNPACK_RED(*pix) * XAP; - gg = RGB_UNPACK_GREEN(*pix) * XAP; - bb = RGB_UNPACK_BLUE(*pix) * XAP; + rr = FB_UNPACK_RED(*pix) * XAP; + gg = FB_UNPACK_GREEN(*pix) * XAP; + bb = FB_UNPACK_BLUE(*pix) * XAP; pix--; - rr += RGB_UNPACK_RED(*pix) * INV_XAP; - gg += RGB_UNPACK_GREEN(*pix) * INV_XAP; - bb += RGB_UNPACK_BLUE(*pix) * INV_XAP; + rr += FB_UNPACK_RED(*pix) * INV_XAP; + gg += FB_UNPACK_GREEN(*pix) * INV_XAP; + bb += FB_UNPACK_BLUE(*pix) * INV_XAP; r = ((rr * YAP) + (r * INV_YAP)) >> 16; g = ((gg * YAP) + (g * INV_YAP)) >> 16; b = ((bb * YAP) + (b * INV_YAP)) >> 16; - *dptr++ = LCD_RGBPACK(r, g, b); + *dptr++ = FB_RGBPACK(r, g, b); } else { pix = ypoint + xpoint; - r = RGB_UNPACK_RED(*pix) * INV_YAP; - g = RGB_UNPACK_GREEN(*pix) * INV_YAP; - b = RGB_UNPACK_BLUE(*pix) * INV_YAP; + r = FB_UNPACK_RED(*pix) * INV_YAP; + g = FB_UNPACK_GREEN(*pix) * INV_YAP; + b = FB_UNPACK_BLUE(*pix) * INV_YAP; pix += sow; - r += RGB_UNPACK_RED(*pix) * YAP; - g += RGB_UNPACK_GREEN(*pix) * YAP; - b += RGB_UNPACK_BLUE(*pix) * YAP; + r += FB_UNPACK_RED(*pix) * YAP; + g += FB_UNPACK_GREEN(*pix) * YAP; + b += FB_UNPACK_BLUE(*pix) * YAP; r >>= 8; g >>= 8; b >>= 8; - *dptr++ = LCD_RGBPACK(r, g, b); + *dptr++ = FB_RGBPACK(r, g, b); } } } else { @@ -176,17 +176,17 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp) if (XAP > 0) { pix = ypoint + xpoint; - r = RGB_UNPACK_RED(*pix) * INV_XAP; - g = RGB_UNPACK_GREEN(*pix) * INV_XAP; - b = RGB_UNPACK_BLUE(*pix) * INV_XAP; + r = FB_UNPACK_RED(*pix) * INV_XAP; + g = FB_UNPACK_GREEN(*pix) * INV_XAP; + b = FB_UNPACK_BLUE(*pix) * INV_XAP; pix++; - r += RGB_UNPACK_RED(*pix) * XAP; - g += RGB_UNPACK_GREEN(*pix) * XAP; - b += RGB_UNPACK_BLUE(*pix) * XAP; + r += FB_UNPACK_RED(*pix) * XAP; + g += FB_UNPACK_GREEN(*pix) * XAP; + b += FB_UNPACK_BLUE(*pix) * XAP; r >>= 8; g >>= 8; b >>= 8; - *dptr++ = LCD_RGBPACK(r, g, b); + *dptr++ = FB_RGBPACK(r, g, b); } else *dptr++ = sptr[xpoint]; } @@ -221,37 +221,37 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp) val_x += inc_x; pix = ypoint + xpoint; - r = (RGB_UNPACK_RED(*pix) * yap) >> 10; - g = (RGB_UNPACK_GREEN(*pix) * yap) >> 10; - b = (RGB_UNPACK_BLUE(*pix) * yap) >> 10; + r = (FB_UNPACK_RED(*pix) * yap) >> 10; + g = (FB_UNPACK_GREEN(*pix) * yap) >> 10; + b = (FB_UNPACK_BLUE(*pix) * yap) >> 10; pix += sow; for (j = (1 << 14) - yap; j > Cy; j -= Cy) { - r += (RGB_UNPACK_RED(*pix) * Cy) >> 10; - g += (RGB_UNPACK_GREEN(*pix) * Cy) >> 10; - b += (RGB_UNPACK_BLUE(*pix) * Cy) >> 10; + r += (FB_UNPACK_RED(*pix) * Cy) >> 10; + g += (FB_UNPACK_GREEN(*pix) * Cy) >> 10; + b += (FB_UNPACK_BLUE(*pix) * Cy) >> 10; pix += sow; } if (j > 0) { - r += (RGB_UNPACK_RED(*pix) * j) >> 10; - g += (RGB_UNPACK_GREEN(*pix) * j) >> 10; - b += (RGB_UNPACK_BLUE(*pix) * j) >> 10; + r += (FB_UNPACK_RED(*pix) * j) >> 10; + g += (FB_UNPACK_GREEN(*pix) * j) >> 10; + b += (FB_UNPACK_BLUE(*pix) * j) >> 10; } if (XAP > 0) { pix = ypoint + xpoint + 1; - rr = (RGB_UNPACK_RED(*pix) * yap) >> 10; - gg = (RGB_UNPACK_GREEN(*pix) * yap) >> 10; - bb = (RGB_UNPACK_BLUE(*pix) * yap) >> 10; + rr = (FB_UNPACK_RED(*pix) * yap) >> 10; + gg = (FB_UNPACK_GREEN(*pix) * yap) >> 10; + bb = (FB_UNPACK_BLUE(*pix) * yap) >> 10; pix += sow; for (j = (1 << 14) - yap; j > Cy; j -= Cy) { - rr += (RGB_UNPACK_RED(*pix) * Cy) >> 10; - gg += (RGB_UNPACK_GREEN(*pix) * Cy) >> 10; - bb += (RGB_UNPACK_BLUE(*pix) * Cy) >> 10; + rr += (FB_UNPACK_RED(*pix) * Cy) >> 10; + gg += (FB_UNPACK_GREEN(*pix) * Cy) >> 10; + bb += (FB_UNPACK_BLUE(*pix) * Cy) >> 10; pix += sow; } if (j > 0) { - rr += (RGB_UNPACK_RED(*pix) * j) >> 10; - gg += (RGB_UNPACK_GREEN(*pix) * j) >> 10; - bb += (RGB_UNPACK_BLUE(*pix) * j) >> 10; + rr += (FB_UNPACK_RED(*pix) * j) >> 10; + gg += (FB_UNPACK_GREEN(*pix) * j) >> 10; + bb += (FB_UNPACK_BLUE(*pix) * j) >> 10; } r = r * INV_XAP; g = g * INV_XAP; @@ -264,7 +264,7 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp) g >>= 4; b >>= 4; } - *dptr = LCD_RGBPACK(r, g, b); + *dptr = FB_RGBPACK(r, g, b); dptr++; } } @@ -297,37 +297,37 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp) xap = XAP & 0xffff; pix = ypoint + xpoint; - r = (RGB_UNPACK_RED(*pix) * xap) >> 10; - g = (RGB_UNPACK_GREEN(*pix) * xap) >> 10; - b = (RGB_UNPACK_BLUE(*pix) * xap) >> 10; + r = (FB_UNPACK_RED(*pix) * xap) >> 10; + g = (FB_UNPACK_GREEN(*pix) * xap) >> 10; + b = (FB_UNPACK_BLUE(*pix) * xap) >> 10; pix++; for (j = (1 << 14) - xap; j > Cx; j -= Cx) { - r += (RGB_UNPACK_RED(*pix) * Cx) >> 10; - g += (RGB_UNPACK_GREEN(*pix) * Cx) >> 10; - b += (RGB_UNPACK_BLUE(*pix) * Cx) >> 10; + r += (FB_UNPACK_RED(*pix) * Cx) >> 10; + g += (FB_UNPACK_GREEN(*pix) * Cx) >> 10; + b += (FB_UNPACK_BLUE(*pix) * Cx) >> 10; pix++; } if (j > 0) { - r += (RGB_UNPACK_RED(*pix) * j) >> 10; - g += (RGB_UNPACK_GREEN(*pix) * j) >> 10; - b += (RGB_UNPACK_BLUE(*pix) * j) >> 10; + r += (FB_UNPACK_RED(*pix) * j) >> 10; + g += (FB_UNPACK_GREEN(*pix) * j) >> 10; + b += (FB_UNPACK_BLUE(*pix) * j) >> 10; } if (YAP > 0) { pix = ypoint + xpoint + sow; - rr = (RGB_UNPACK_RED(*pix) * xap) >> 10; - gg = (RGB_UNPACK_GREEN(*pix) * xap) >> 10; - bb = (RGB_UNPACK_BLUE(*pix) * xap) >> 10; + rr = (FB_UNPACK_RED(*pix) * xap) >> 10; + gg = (FB_UNPACK_GREEN(*pix) * xap) >> 10; + bb = (FB_UNPACK_BLUE(*pix) * xap) >> 10; pix++; for (j = (1 << 14) - xap; j > Cx; j -= Cx) { - rr += (RGB_UNPACK_RED(*pix) * Cx) >> 10; - gg += (RGB_UNPACK_GREEN(*pix) * Cx) >> 10; - bb += (RGB_UNPACK_BLUE(*pix) * Cx) >> 10; + rr += (FB_UNPACK_RED(*pix) * Cx) >> 10; + gg += (FB_UNPACK_GREEN(*pix) * Cx) >> 10; + bb += (FB_UNPACK_BLUE(*pix) * Cx) >> 10; pix++; } if (j > 0) { - rr += (RGB_UNPACK_RED(*pix) * j) >> 10; - gg += (RGB_UNPACK_GREEN(*pix) * j) >> 10; - bb += (RGB_UNPACK_BLUE(*pix) * j) >> 10; + rr += (FB_UNPACK_RED(*pix) * j) >> 10; + gg += (FB_UNPACK_GREEN(*pix) * j) >> 10; + bb += (FB_UNPACK_BLUE(*pix) * j) >> 10; } r = r * INV_YAP; g = g * INV_YAP; @@ -340,7 +340,7 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp) g >>= 4; b >>= 4; } - *dptr = LCD_RGBPACK(r, g, b); + *dptr = FB_RGBPACK(r, g, b); dptr++; } } @@ -378,20 +378,20 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp) pix = sptr; sptr += sow; - rx = (RGB_UNPACK_RED(*pix) * xap) >> 9; - gx = (RGB_UNPACK_GREEN(*pix) * xap) >> 9; - bx = (RGB_UNPACK_BLUE(*pix) * xap) >> 9; + rx = (FB_UNPACK_RED(*pix) * xap) >> 9; + gx = (FB_UNPACK_GREEN(*pix) * xap) >> 9; + bx = (FB_UNPACK_BLUE(*pix) * xap) >> 9; pix++; for (i = (1 << 14) - xap; i > Cx; i -= Cx) { - rx += (RGB_UNPACK_RED(*pix) * Cx) >> 9; - gx += (RGB_UNPACK_GREEN(*pix) * Cx) >> 9; - bx += (RGB_UNPACK_BLUE(*pix) * Cx) >> 9; + rx += (FB_UNPACK_RED(*pix) * Cx) >> 9; + gx += (FB_UNPACK_GREEN(*pix) * Cx) >> 9; + bx += (FB_UNPACK_BLUE(*pix) * Cx) >> 9; pix++; } if (i > 0) { - rx += (RGB_UNPACK_RED(*pix) * i) >> 9; - gx += (RGB_UNPACK_GREEN(*pix) * i) >> 9; - bx += (RGB_UNPACK_BLUE(*pix) * i) >> 9; + rx += (FB_UNPACK_RED(*pix) * i) >> 9; + gx += (FB_UNPACK_GREEN(*pix) * i) >> 9; + bx += (FB_UNPACK_BLUE(*pix) * i) >> 9; } r = (rx * yap) >> 14; @@ -401,20 +401,20 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp) for (j = (1 << 14) - yap; j > Cy; j -= Cy) { pix = sptr; sptr += sow; - rx = (RGB_UNPACK_RED(*pix) * xap) >> 9; - gx = (RGB_UNPACK_GREEN(*pix) * xap) >> 9; - bx = (RGB_UNPACK_BLUE(*pix) * xap) >> 9; + rx = (FB_UNPACK_RED(*pix) * xap) >> 9; + gx = (FB_UNPACK_GREEN(*pix) * xap) >> 9; + bx = (FB_UNPACK_BLUE(*pix) * xap) >> 9; pix++; for (i = (1 << 14) - xap; i > Cx; i -= Cx) { - rx += (RGB_UNPACK_RED(*pix) * Cx) >> 9; - gx += (RGB_UNPACK_GREEN(*pix) * Cx) >> 9; - bx += (RGB_UNPACK_BLUE(*pix) * Cx) >> 9; + rx += (FB_UNPACK_RED(*pix) * Cx) >> 9; + gx += (FB_UNPACK_GREEN(*pix) * Cx) >> 9; + bx += (FB_UNPACK_BLUE(*pix) * Cx) >> 9; pix++; } if (i > 0) { - rx += (RGB_UNPACK_RED(*pix) * i) >> 9; - gx += (RGB_UNPACK_GREEN(*pix) * i) >> 9; - bx += (RGB_UNPACK_BLUE(*pix) * i) >> 9; + rx += (FB_UNPACK_RED(*pix) * i) >> 9; + gx += (FB_UNPACK_GREEN(*pix) * i) >> 9; + bx += (FB_UNPACK_BLUE(*pix) * i) >> 9; } r += (rx * Cy) >> 14; @@ -424,20 +424,20 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp) if (j > 0) { pix = sptr; sptr += sow; - rx = (RGB_UNPACK_RED(*pix) * xap) >> 9; - gx = (RGB_UNPACK_GREEN(*pix) * xap) >> 9; - bx = (RGB_UNPACK_BLUE(*pix) * xap) >> 9; + rx = (FB_UNPACK_RED(*pix) * xap) >> 9; + gx = (FB_UNPACK_GREEN(*pix) * xap) >> 9; + bx = (FB_UNPACK_BLUE(*pix) * xap) >> 9; pix++; for (i = (1 << 14) - xap; i > Cx; i -= Cx) { - rx += (RGB_UNPACK_RED(*pix) * Cx) >> 9; - gx += (RGB_UNPACK_GREEN(*pix) * Cx) >> 9; - bx += (RGB_UNPACK_BLUE(*pix) * Cx) >> 9; + rx += (FB_UNPACK_RED(*pix) * Cx) >> 9; + gx += (FB_UNPACK_GREEN(*pix) * Cx) >> 9; + bx += (FB_UNPACK_BLUE(*pix) * Cx) >> 9; pix++; } if (i > 0) { - rx += (RGB_UNPACK_RED(*pix) * i) >> 9; - gx += (RGB_UNPACK_GREEN(*pix) * i) >> 9; - bx += (RGB_UNPACK_BLUE(*pix) * i) >> 9; + rx += (FB_UNPACK_RED(*pix) * i) >> 9; + gx += (FB_UNPACK_GREEN(*pix) * i) >> 9; + bx += (FB_UNPACK_BLUE(*pix) * i) >> 9; } r += (rx * j) >> 14; @@ -445,7 +445,7 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp) b += (bx * j) >> 14; } - *dptr = LCD_RGBPACK(r >> 5, g >> 5, b >> 5); + *dptr = FB_RGBPACK(r >> 5, g >> 5, b >> 5); dptr++; } } 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; # define _OSD_WIDTH2BYTES(w) ((w)*2) # define _OSD_BYTES2WIDTH(b) ((b)/2) # endif /* end stride type selection */ +#elif LCD_DEPTH == 24 +# define _OSD_WIDTH2BYTES(w) ((w)*3) +# define _OSD_BYTES2WIDTH(b) ((b)/3) #else /* other LCD depth */ # error Unknown LCD depth; please define macros #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 ) fb_data *d = (fb_data*)( bm->data ) + (x+y*bm->width); unsigned char c[] = { - RGB_UNPACK_BLUE( *d ), - RGB_UNPACK_GREEN( *d ), - RGB_UNPACK_RED( *d ) + FB_UNPACK_BLUE( *d ), + FB_UNPACK_GREEN( *d ), + FB_UNPACK_RED( *d ) }; rb->write( fh, c, 3 ); } 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, xlcd_filltriangle_vertical(display, x1, y1, x2, y2, x3, y3); } -#if LCD_DEPTH >= 8 +#if LCD_DEPTH >= 8 && LCD_DEPTH <= 16 #ifdef HAVE_LCD_COLOR static const fb_data graylut[256] = { @@ -244,6 +244,8 @@ static const fb_data graylut[256] = { }; #endif /* HAVE_LCD_COLOR */ +/* unused functions, enable when needed */ +#if 0 /* Draw a partial greyscale bitmap, canonical 8 bit format */ void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y, 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, #ifdef HAVE_LCD_COLOR do +#if LCD_DEPTH == 16 *dst_row++ = graylut[*src_row++]; +#else + /* untested change because this function is completely unused */ + *dst_row->r = *dst_row->g = *dst_row->b = *src_row++; + dst_row++; +#endif while (src_row < row_end); #endif @@ -302,6 +310,7 @@ void xlcd_gray_bitmap(const unsigned char *src, int x, int y, int width, { xlcd_gray_bitmap_part(src, 0, 0, width, x, y, width, height); } +#endif #ifdef HAVE_LCD_COLOR /* 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, #endif /* LCD_DEPTH >= 8 */ #endif /* HAVE_LCD_BITMAP */ - 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[] #define REMOTE_LOGO_WIDTH BMPWIDTH_remote_rockboxlogo #define REMOTE_LOGO_HEIGHT BMPHEIGHT_remote_rockboxlogo #define REMOTE_LOGO remote_rockboxlogo -extern const fb_remote_data remote_rockboxlogo[]; #endif /* HAVE_REMOTE_LCD */ #define LOGO rockboxlogo #include "pluginbitmaps/rockboxlogo.h" #define LOGO_WIDTH BMPWIDTH_rockboxlogo #define LOGO_HEIGHT BMPHEIGHT_rockboxlogo -extern const fb_data rockboxlogo[]; #else /* !LCD_BITMAP */ #define DISPLAY_WIDTH 55 @@ -103,10 +101,10 @@ enum plugin_status plugin_start(const void* parameter) { while (1) { #ifdef HAVE_LCD_BITMAP rb->lcd_clear_display(); - rb->lcd_bitmap(LOGO, x, y, LOGO_WIDTH, LOGO_HEIGHT); + rb->lcd_bitmap((const fb_data*)LOGO, x, y, LOGO_WIDTH, LOGO_HEIGHT); #ifdef REMOTE_LOGO rb->lcd_remote_clear_display(); - rb->lcd_remote_bitmap(REMOTE_LOGO, + rb->lcd_remote_bitmap((const fb_data*)REMOTE_LOGO, (x * (REMOTE_WIDTH - REMOTE_LOGO_WIDTH)) / (DISPLAY_WIDTH - LOGO_WIDTH), (y * (REMOTE_HEIGHT - REMOTE_LOGO_HEIGHT)) / (DISPLAY_HEIGHT - LOGO_HEIGHT), REMOTE_LOGO_WIDTH, REMOTE_LOGO_HEIGHT); @@ -195,5 +193,3 @@ enum plugin_status plugin_start(const void* parameter) { } } } - - 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) static int rli_set(lua_State *L) { - fb_data newvalue = (fb_data) luaL_checknumber(L, 4); + fb_data newvalue = FB_SCALARPACK((unsigned)luaL_checknumber(L, 4)); *rli_element(L) = newvalue; return 0; } static int rli_get(lua_State *L) { - lua_pushnumber(L, *rli_element(L)); + lua_pushnumber(L, FB_UNPACK_SCALAR_LCD(*rli_element(L))); return 1; } 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) #endif (void)ptr; } - 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, dst_col--; if (data & 1) - *dst_col = fg_pattern; + *dst_col = FB_SCALARPACK(fg_pattern); #if 0 else *dst_col = bg_pattern; @@ -719,7 +719,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src, while (src < src_end); } -/* draw alpha bitmap for anti-alias font */ + #define ALPHA_COLOR_FONT_DEPTH 2 #define ALPHA_COLOR_LOOKUP_SHIFT (1 << ALPHA_COLOR_FONT_DEPTH) #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, #define ALPHA_COLOR_PIXEL_PER_WORD (32 >> ALPHA_COLOR_FONT_DEPTH) #ifdef CPU_ARM #define BLEND_INIT do {} while (0) +#define BLEND_FINISH do {} while(0) #define BLEND_START(acc, color, alpha) \ asm volatile("mul %0, %1, %2" : "=&r" (acc) : "r" (color), "r" (alpha)) #define BLEND_CONT(acc, color, alpha) \ @@ -734,13 +735,18 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src, #define BLEND_OUT(acc) do {} while (0) #elif defined(CPU_COLDFIRE) #define ALPHA_BITMAP_READ_WORDS -#define BLEND_INIT coldfire_set_macsr(EMAC_UNSIGNED) +#define BLEND_INIT \ + unsigned long _macsr = coldfire_get_macsr(); \ + coldfire_set_macsr(EMAC_UNSIGNED) +#define BLEND_FINISH \ + coldfire_set_macsr(_macsr) #define BLEND_START(acc, color, alpha) \ asm volatile("mac.l %0, %1, %%acc0" :: "%d" (color), "d" (alpha)) #define BLEND_CONT BLEND_START #define BLEND_OUT(acc) asm volatile("movclr.l %%acc0, %0" : "=d" (acc)) #else #define BLEND_INIT do {} while (0) +#define BLEND_FINISH do {} while(0) #define BLEND_START(acc, color, alpha) ((acc) = (color) * (alpha)) #define BLEND_CONT(acc, color, alpha) ((acc) += (color) * (alpha)) #define BLEND_OUT(acc) do {} while (0) @@ -749,6 +755,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src, /* Blend the given two colors */ static inline unsigned blend_two_colors(unsigned c1, unsigned c2, unsigned a) { +#if LCD_DEPTH == 16 a += a >> (ALPHA_COLOR_LOOKUP_SHIFT - 1); #if (LCD_PIXELFORMAT == RGB565SWAPPED) c1 = swap16(c1); @@ -767,6 +774,20 @@ static inline unsigned blend_two_colors(unsigned c1, unsigned c2, unsigned a) #else return p; #endif + +#else /* LCD_DEPTH == 24 */ + unsigned s = c1; + unsigned d = c2; + unsigned s1 = s & 0xff00ff; + unsigned d1 = d & 0xff00ff; + a += a >> (ALPHA_COLOR_LOOKUP_SHIFT - 1); + d1 = (d1 + ((s1 - d1) * a >> ALPHA_COLOR_LOOKUP_SHIFT)) & 0xff00ff; + s &= 0xff00; + d &= 0xff00; + d = (d + ((s - d) * a >> ALPHA_COLOR_LOOKUP_SHIFT)) & 0xff00; + + return d1 | d; +#endif } static 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, #endif do { - *dst=blend_two_colors(*dst, fg_pattern, - data & ALPHA_COLOR_LOOKUP_SIZE ); + unsigned color = blend_two_colors(FB_UNPACK_SCALAR_LCD(*dst), fg_pattern, + data & ALPHA_COLOR_LOOKUP_SIZE ); + *dst= FB_SCALARPACK(color); dst += LCD_WIDTH; UPDATE_SRC_ALPHA; } 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) for( i=0; i<256; i++ ) { c = decoded_palette[ color_data_[i] & 0x0F ]; #ifdef HAVE_LCD_COLOR - palette[i] = LCD_RGBPACK((unsigned char) (c), + palette[i] = FB_RGBPACK((unsigned char) (c), (unsigned char) (c >> 8), (unsigned char) (c >> 16)); #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; /** code */ static bool free_slide_prio(int prio); -static inline unsigned fade_color(pix_t c, unsigned a); bool load_new_slide(void); int load_surface(int); @@ -646,10 +645,15 @@ static inline PFreal fcos(int iangle) return fsin(iangle + (IANGLE_MAX >> 2)); } -static inline unsigned scale_val(unsigned val, unsigned bits) +/* scales the 8bit subpixel value to native lcd format, indicated by bits */ +static inline unsigned scale_subpixel_lcd(unsigned val, unsigned bits) { + (void) bits; +#if LCD_PIXELFORMAT != RGB888 val = val * ((1 << bits) - 1); - return ((val >> 8) + val + 128) >> 8; + val = ((val >> 8) + val + 128) >> 8; +#endif + return val; } static 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, unsigned r, g, b; for (; dest < end; dest += ctx->bm->height) { - r = scale_val(qp->red, 5); - g = scale_val(qp->green, 6); - b = scale_val((qp++)->blue, 5); - *dest = LCD_RGBPACK_LCD(r,g,b); + r = scale_subpixel_lcd(qp->red, 5); + g = scale_subpixel_lcd(qp->green, 6); + b = scale_subpixel_lcd((qp++)->blue, 5); + *dest = FB_RGBPACK_LCD(r,g,b); } #endif } @@ -690,11 +694,11 @@ static void output_row_32_transposed(uint32_t row, void * row_in, int r, g, b; for (; dest < end; dest += ctx->bm->height) { - r = scale_val(SC_OUT(qp->r, ctx), 5); - g = scale_val(SC_OUT(qp->g, ctx), 6); - b = scale_val(SC_OUT(qp->b, ctx), 5); + r = scale_subpixel_lcd(SC_OUT(qp->r, ctx), 5); + g = scale_subpixel_lcd(SC_OUT(qp->g, ctx), 6); + b = scale_subpixel_lcd(SC_OUT(qp->b, ctx), 5); qp++; - *dest = LCD_RGBPACK_LCD(r,g,b); + *dest = FB_RGBPACK_LCD(r,g,b); } #endif } @@ -714,10 +718,10 @@ static void output_row_32_transposed_fromyuv(uint32_t row, void * row_in, v = SC_OUT(qp->r, ctx); qp++; yuv_to_rgb(y, u, v, &r, &g, &b); - r = scale_val(r, 5); - g = scale_val(g, 6); - b = scale_val(b, 5); - *dest = LCD_RGBPACK_LCD(r, g, b); + r = scale_subpixel_lcd(r, 5); + g = scale_subpixel_lcd(g, 6); + b = scale_subpixel_lcd(b, 5); + *dest = FB_RGBPACK_LCD(r, g, b); } } #endif @@ -1793,14 +1797,13 @@ static void recalc_offsets(void) offsetY = DISPLAY_WIDTH / 2 * (fsin(itilt) + PFREAL_ONE / 2); } - /** - Fade the given color by spreading the fb_data (ushort) - to an uint, multiply and compress the result back to a ushort. + Fade the given color by spreading the fb_data + to an uint, multiply and compress the result back to a fb_data. */ -#if (LCD_PIXELFORMAT == RGB565SWAPPED) -static inline unsigned fade_color(pix_t c, unsigned a) +static inline pix_t fade_color(pix_t c, unsigned a) { +#if (LCD_PIXELFORMAT == RGB565SWAPPED) unsigned int result; c = swap16(c); a = (a + 2) & 0x1fc; @@ -1808,24 +1811,29 @@ static inline unsigned fade_color(pix_t c, unsigned a) result |= ((c & 0x7e0) * a) & 0x7e000; result >>= 8; return swap16(result); -} + #elif LCD_PIXELFORMAT == RGB565 -static inline unsigned fade_color(pix_t c, unsigned a) -{ unsigned int result; a = (a + 2) & 0x1fc; result = ((c & 0xf81f) * a) & 0xf81f00; result |= ((c & 0x7e0) * a) & 0x7e000; result >>= 8; return result; -} + +#elif LCD_PIXELFORMAT == RGB888 + unsigned int pixel = FB_UNPACK_SCALAR_LCD(c); + unsigned int result; + a = (a + 2) & 0x1fc; + result = ((pixel & 0xff00ff) * a) & 0xff00ff00; + result |= ((pixel & 0x00ff00) * a) & 0x00ff0000; + result >>= 8; + return FB_SCALARPACK(result); + #else -static inline unsigned fade_color(pix_t c, unsigned a) -{ unsigned val = c; return MULUQ(val, a) >> 8; -} #endif +} /** * 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) if (blue > 255) blue= 510 - blue; - colours[i] = LCD_RGBPACK(red, green, blue); + colours[i] = FB_RGBPACK(red, green, blue); r++; g++; b++; } 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 */ struct figure { #if LCD_DEPTH >= 2 - unsigned short color[3]; /* color of figure (light,middle,shadow) */ + unsigned int color[3]; /* color of figure (light,middle,shadow) */ #endif unsigned short max_or; /* max orientations */ 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 @@ #ifndef __LCD_GB_H__ #define __LCD_GB_H__ +#include "lcd.h" #include "defs.h" struct vissprite @@ -23,7 +24,7 @@ struct scan #elif LCD_DEPTH > 4 byte buf[256]; #endif - un16 pal[64]; + fb_data pal[64]; byte pri[256]; struct vissprite vs[16]; int ns, l, x, y, s, t, u, v, wx, wy, wt, wv; @@ -61,6 +62,3 @@ void pal_dirty(void) ICODE_ATTR; void lcd_reset(void); #endif - - - 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; #define BG (scan.bg) #define WND (scan.wnd) -#if LCD_DEPTH ==16 +#if LCD_DEPTH >= 16 #define BUF (scan.buf) #else #define BUF (scan.buf[scanline_ind]) @@ -1154,6 +1154,7 @@ void set_pal(void) static void updatepalette(int i) { int c, r, g, b; + fb_data px; c = (lcd.pal[i<<1] | ((int)lcd.pal[(i<<1)|1] << 8)) & 0x7FFF; r = (c & 0x001F) << 3; @@ -1167,18 +1168,16 @@ static void updatepalette(int i) g = (g >> fb.cc[1].r) << fb.cc[1].l; b = (b >> fb.cc[2].r) << fb.cc[2].l; -#if LCD_PIXELFORMAT == RGB565 c = r|g|b; -#elif LCD_PIXELFORMAT == RGB565SWAPPED - c = swap16(r|g|b); -#endif + + px = FB_SCALARPACK_LCD(c); /* updatepalette might get called, but the pallete does not necessarily * need to be updated. */ - if(PAL[i]!=c) + if(memcmp(&PAL[i], &px, sizeof(fb_data))) { - PAL[i] = c; + PAL[i] = px; #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) rb->lcd_pal256_update_pal(PAL); #endif @@ -1256,4 +1255,3 @@ void lcd_reset(void) lcd_begin(); vram_dirty(); } - 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) fb.enabled=1; #if defined(HAVE_LCD_COLOR) +#if LCD_DEPTH == 24 + fb.cc[0].r = 0; /* 8-8 (wasted bits on red) */ + fb.cc[0].l = 16; /* this is the offset to the R bits (24-8) */ + fb.cc[1].r = 0; /* 8-6 (wasted bits on green) */ + fb.cc[1].l = 8; /* This is the offset to the G bits (24-8-8) */ + fb.cc[2].r = 0; /* 8-5 (wasted bits on red) */ + fb.cc[2].l = 0; /* This is the offset to the B bits (24-8-8-8) */ +#else fb.cc[0].r = 3; /* 8-5 (wasted bits on red) */ fb.cc[0].l = 11; /* this is the offset to the R bits (16-5) */ fb.cc[1].r = 2; /* 8-6 (wasted bits on green) */ fb.cc[1].l = 5; /* This is the offset to the G bits (16-5-6) */ fb.cc[2].r = 3; /* 8-5 (wasted bits on red) */ fb.cc[2].l = 0; /* This is the offset to the B bits (16-5-6-5) */ +#endif #else fb.mode=3; #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 @@ #include "lib/display_text.h" #include "pluginbitmaps/superdom_boarditems.h" - -extern const fb_data superdom_boarditems[]; char buf[255]; #define COLOUR_DARK 0 @@ -32,7 +30,7 @@ char buf[255]; #define MARGIN 5 -#if (LCD_DEPTH == 16) +#if (LCD_DEPTH >= 16) #define MY_BITMAP_PART rb->lcd_bitmap_transparent_part #else #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 @@ #define IB0 (0xFF-B0) #define IB1 (0xFF-B1) -static const fb_data _16bpp_colors[32] = { +static const unsigned _16bpp_colors[32] = { /* normal */ LCD_RGBPACK(N0, N0, N0), LCD_RGBPACK(N0, N0, N1), LCD_RGBPACK(N1, N0, N0), LCD_RGBPACK(N1, N0, N1), @@ -60,7 +60,7 @@ void update_screen(void) */ frameb = rb->lcd_framebuffer; for ( y = 0 ; y < HEIGHT*WIDTH; y++ ){ - frameb[y] = _16bpp_colors[(unsigned)sp_image[y]]; + frameb[y] = FB_SCALARPACK(_16bpp_colors[(unsigned)sp_image[y]]); } #else @@ -74,7 +74,7 @@ void update_screen(void) srcx = 0; /* reset our x counter before each row... */ for(x = 0; x < LCD_WIDTH; x++) { - *frameb = _16bpp_colors[image[srcx>>16]]; + *frameb = FB_SCALARPACK(_16bpp_colors[image[srcx>>16]]); srcx += X_STEP; /* move through source image */ frameb++; } 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, *dest++ |= vi_pattern[bright] << shift; } #endif /* LCD_PIXELFORMAT */ -#elif LCD_DEPTH == 16 +#elif LCD_DEPTH >= 16 /* iriver h300, colour iPods, X5 */ (void)fb_width; 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, bm_alpha += ALIGN_UP(ctx->bm->width, 2) * row/2; for (col = 0; col < ctx->bm->width; col++) { + (void) delta; if (ctx->dither) delta = DITHERXDY(col,dy); r = qp->red; g = qp->green; b = qp->blue; +#if LCD_DEPTH < 24 r = (31 * r + (r >> 3) + delta) >> 8; g = (63 * g + (g >> 2) + delta) >> 8; b = (31 * b + (b >> 3) + delta) >> 8; - *dest = LCD_RGBPACK_LCD(r, g, b); +#endif + *dest = FB_RGBPACK_LCD(r, g, b); dest += STRIDE_MAIN(1, ctx->bm->height); if (bm_alpha) { /* pack alpha channel for 2 pixels into 1 byte and negate @@ -526,8 +529,8 @@ int read_bmp_fd(int fd, bool dither = false; #endif -#ifdef HAVE_REMOTE_LCD bool remote = false; +#ifdef HAVE_REMOTE_LCD if (format & FORMAT_REMOTE) { remote = true; #if LCD_REMOTE_DEPTH == 1 @@ -710,9 +713,7 @@ int read_bmp_fd(int fd, case 16: #if LCD_DEPTH >= 16 /* don't dither 16 bit BMP to LCD with same or larger depth */ -#ifdef HAVE_REMOTE_LCD if (!remote) -#endif dither = false; #endif if (compression == 0) { /* BI_RGB, i.e. 15 bit */ @@ -755,6 +756,12 @@ int read_bmp_fd(int fd, break; } +#if LCD_DEPTH >= 24 + /* Never dither 24/32 bit BMP to 24 bit LCDs */ + if (depth >= 24 && !remote) + dither = false; +#endif + /* Search to the beginning of the image data */ lseek(fd, (off_t)letoh32(bmph.off_bits), SEEK_SET); 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, unsigned r, g, b, y, u, v; for (col = 0; col < ctx->bm->width; col++) { + (void) delta; if (ctx->dither) delta = DITHERXDY(col,dy); y = SC_OUT(qp->b, ctx); @@ -687,10 +688,12 @@ static void output_row_32_native_fromyuv(uint32_t row, void * row_in, v = SC_OUT(qp->r, ctx); qp++; yuv_to_rgb(y, u, v, &r, &g, &b); +#if LCD_DEPTH < 24 r = (31 * r + (r >> 3) + delta) >> 8; g = (63 * g + (g >> 2) + delta) >> 8; b = (31 * b + (b >> 3) + delta) >> 8; - *dest = LCD_RGBPACK_LCD(r, g, b); +#endif + *dest = FB_RGBPACK_LCD(r, g, b); dest += DEST_STEP; } } @@ -764,7 +767,7 @@ static void output_row_32_native(uint32_t row, void * row_in, *dest++ |= vi_pattern[bright] << shift; } #endif /* LCD_PIXELFORMAT */ -#elif LCD_DEPTH == 16 +#elif LCD_DEPTH >= 16 /* iriver h300, colour iPods, X5 */ (void)fb_width; 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, bm_alpha += ALIGN_UP(ctx->bm->width, 2)*row/2; for (col = 0; col < ctx->bm->width; col++) { + (void) delta; if (ctx->dither) delta = DITHERXDY(col,dy); q0 = *qp++; r = SC_OUT(q0.r, ctx); g = SC_OUT(q0.g, ctx); b = SC_OUT(q0.b, ctx); +#if LCD_DEPTH < 24 r = (31 * r + (r >> 3) + delta) >> 8; g = (63 * g + (g >> 2) + delta) >> 8; b = (31 * b + (b >> 3) + delta) >> 8; - *dest = LCD_RGBPACK_LCD(r, g, b); +#endif + *dest = FB_RGBPACK_LCD(r, g, b); dest += STRIDE_MAIN(1, ctx->bm->height); if (bm_alpha) { /* 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 #else drivers/lcd-16bit.c #endif +#elif LCD_DEPTH == 24 +drivers/lcd-24bit.c #endif /* LCD_DEPTH */ common/diacritic.c #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 defined(COWON_D2) || defined(MINI2440) || defined(SAMSUNG_YPR0) || \ defined(SAMSUNG_YPR1) || (defined(MROBE_500) && !defined(LCD_USE_DMA))) && \ !defined(SIMULATOR) +#if LCD_DEPTH == 24 +lcd-as-memframe-24bit.c +#else lcd-as-memframe.c #endif +#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 @@ + +/* The ASM version of lcd-as-memframe.c isn't 24bit capable */ +#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, b = clamp(b, 0, 64*256-1); } - *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); + *dst = FB_RGBPACK(r >> 6, g >> 6, b >> 6); #if LCD_WIDTH >= LCD_HEIGHT dst++; @@ -98,7 +98,7 @@ extern void lcd_write_yuv420_lines(fb_data *dst, b = clamp(b, 0, 64*256-1); } - *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); + *dst = FB_RGBPACK(r >> 6, g >> 6, b >> 6); #if LCD_WIDTH >= LCD_HEIGHT dst++; @@ -143,7 +143,7 @@ extern void lcd_write_yuv420_lines(fb_data *dst, b = clamp(b, 0, 64*256-1); } - *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); + *dst = FB_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); #if LCD_WIDTH >= LCD_HEIGHT dst++; @@ -163,7 +163,7 @@ extern void lcd_write_yuv420_lines(fb_data *dst, b = clamp(b, 0, 64*256-1); } - *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); + *dst = FB_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); #if LCD_WIDTH >= LCD_HEIGHT 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 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2005 by Dave Chapman + * Copyright (C) 2009 by Karl Kurbjun + * + * Rockbox driver for 16-bit colour LCDs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include <stdio.h> +#include "config.h" + +#include "cpu.h" +#include "lcd.h" +#include "kernel.h" +#include "thread.h" +#include <stdlib.h> +#include "string-extra.h" /* mem*() */ +#include "file.h" +#include "debug.h" +#include "system.h" +#include "font.h" +#include "rbunicode.h" +#include "bidi.h" +#include "scroll_engine.h" + +#define ROW_INC LCD_WIDTH +#define COL_INC 1 + +extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[]; +extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_bgcolor[]; + +static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, + const unsigned char *src, int src_x, + int src_y, int x, int y, + int width, int height, + int stride_image, int stride_src); + +#include "lcd-color-common.c" +#include "lcd-bitmap-common.c" + + +/* Clear the current viewport */ +void lcd_clear_viewport(void) +{ + fb_data *dst, *dst_end; + int x, y, width, height; + int len, step; + + x = current_vp->x; + y = current_vp->y; + width = current_vp->width; + height = current_vp->height; + +#if defined(HAVE_VIEWPORT_CLIP) + /********************* Viewport on screen clipping ********************/ + /* nothing to draw? */ + if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) + || (x + width <= 0) || (y + height <= 0)) + return; + + /* clip image in viewport in screen */ + if (x < 0) + { + width += x; + x = 0; + } + if (y < 0) + { + height += y; + y = 0; + } + if (x + width > LCD_WIDTH) + width = LCD_WIDTH - x; + if (y + height > LCD_HEIGHT) + height = LCD_HEIGHT - y; +#endif + + len = STRIDE_MAIN(width, height); + step = STRIDE_MAIN(ROW_INC, COL_INC); + + dst = FBADDR(x, y); + dst_end = FBADDR(x + width - 1 , y + height - 1); + + if (current_vp->drawmode & DRMODE_INVERSEVID) + { + fb_data px = FB_SCALARPACK(current_vp->fg_pattern); + do + { + fb_data *end = dst + len; + do { + *dst++ = px; + } while (dst < end); + dst += step - len; + } + while (dst <= dst_end); + } + else + { + if (!lcd_backdrop) + { + fb_data px = FB_SCALARPACK(current_vp->bg_pattern); + do + { + fb_data *end = dst + len; + do { + *dst++ = px; + } while (dst < end); + dst += step - len; + } + while (dst <= dst_end); + } + else + { + do + { + memcpy(dst, (void *)((long)dst + lcd_backdrop_offset), + len * sizeof(fb_data)); + dst += step; + } + while (dst <= dst_end); + } + } + + if (current_vp == &default_vp) + lcd_scroll_stop(); + else + lcd_scroll_stop_viewport(current_vp); +} + +/*** low-level drawing functions ***/ + +static void ICODE_ATTR setpixel(fb_data *address) +{ + *address = FB_SCALARPACK(current_vp->fg_pattern); +} + +static void ICODE_ATTR clearpixel(fb_data *address) +{ + *address = FB_SCALARPACK(current_vp->bg_pattern); +} + +static void ICODE_ATTR clearimgpixel(fb_data *address) +{ + *address = *(fb_data *)((long)address + lcd_backdrop_offset); +} + +static void ICODE_ATTR flippixel(fb_data *address) +{ + unsigned px = FB_UNPACK_SCALAR_LCD(*address); + *address = FB_SCALARPACK(~px); +} + +static void ICODE_ATTR nopixel(fb_data *address) +{ + (void)address; +} + +lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_bgcolor[8] = { + flippixel, nopixel, setpixel, setpixel, + nopixel, clearpixel, nopixel, clearpixel +}; + +lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[8] = { + flippixel, nopixel, setpixel, setpixel, + nopixel, clearimgpixel, nopixel, clearimgpixel +}; + +lcd_fastpixelfunc_type* const * lcd_fastpixelfuncs = lcd_fastpixelfuncs_bgcolor; + +/* Fill a rectangular area */ +void lcd_fillrect(int x, int y, int width, int height) +{ + enum fill_opt fillopt = OPT_NONE; + fb_data *dst, *dst_end; + int len, step; + fb_data bits = { 0 }; + + /******************** In viewport clipping **********************/ + /* nothing to draw? */ + if ((width <= 0) || (height <= 0) || (x >= current_vp->width) || + (y >= current_vp->height) || (x + width <= 0) || (y + height <= 0)) + return; + + if (x < 0) + { + width += x; + x = 0; + } + if (y < 0) + { + height += y; + y = 0; + } + if (x + width > current_vp->width) + width = current_vp->width - x; + if (y + height > current_vp->height) + height = current_vp->height - y; + + /* adjust for viewport */ + x += current_vp->x; + y += current_vp->y; + +#if defined(HAVE_VIEWPORT_CLIP) + /********************* Viewport on screen clipping ********************/ + /* nothing to draw? */ + if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) + || (x + width <= 0) || (y + height <= 0)) + return; + + /* clip image in viewport in screen */ + if (x < 0) + { + width += x; + x = 0; + } + if (y < 0) + { + height += y; + y = 0; + } + if (x + width > LCD_WIDTH) + width = LCD_WIDTH - x; + if (y + height > LCD_HEIGHT) + height = LCD_HEIGHT - y; +#endif + + /* drawmode and optimisation */ + if (current_vp->drawmode & DRMODE_INVERSEVID) + { + if (current_vp->drawmode & DRMODE_BG) + { + if (!lcd_backdrop) + { + fillopt = OPT_SET; + bits = FB_SCALARPACK(current_vp->bg_pattern); + } + else + fillopt = OPT_COPY; + } + } + else + { + if (current_vp->drawmode & DRMODE_FG) + { + fillopt = OPT_SET; + bits = FB_SCALARPACK(current_vp->fg_pattern); + } + } + if (fillopt == OPT_NONE && current_vp->drawmode != DRMODE_COMPLEMENT) + return; + + dst = FBADDR(x, y); + dst_end = FBADDR(x + width - 1, y + height - 1); + + len = STRIDE_MAIN(width, height); + step = STRIDE_MAIN(ROW_INC, COL_INC); + + do + { + switch (fillopt) + { + case OPT_SET: + { + fb_data *start = dst; + fb_data *end = start + len; + do { + *start = bits; + } while (++start < end); + break; + } + + case OPT_COPY: + memcpy(dst, (void *)((long)dst + lcd_backdrop_offset), + len * sizeof(fb_data)); + break; + + case OPT_NONE: /* DRMODE_COMPLEMENT */ + { + fb_data *start = dst; + fb_data *end = start + len; + do { + flippixel(start); + } while (++start < end); + break; + } + } + dst += step; + } + while (dst <= dst_end); +} + +/* About Rockbox' internal monochrome bitmap format: + * + * A bitmap contains one bit for every pixel that defines if that pixel is + * black (1) or white (0). Bits within a byte are arranged vertically, LSB + * at top. + * The bytes are stored in row-major order, with byte 0 being top left, + * byte 1 2nd from left etc. The first row of bytes defines pixel rows + * 0..7, the second row defines pixel row 8..15 etc. + * + * This is the mono bitmap format used on all other targets so far; the + * pixel packing doesn't really matter on a 8bit+ target. */ + +/* Draw a partial monochrome bitmap */ + +void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, + int src_y, int stride, int x, int y, + int width, int height) +{ + const unsigned char *src_end; + fb_data *dst, *dst_col; + unsigned dmask = 0x100; /* bit 8 == sentinel */ + int drmode = current_vp->drawmode; + int row; + + /******************** Image in viewport clipping **********************/ + /* nothing to draw? */ + if ((width <= 0) || (height <= 0) || (x >= current_vp->width) || + (y >= current_vp->height) || (x + width <= 0) || (y + height <= 0)) + return; + + if (x < 0) + { + width += x; + src_x -= x; + x = 0; + } + if (y < 0) + { + height += y; + src_y -= y; + y = 0; + } + if (x + width > current_vp->width) + width = current_vp->width - x; + if (y + height > current_vp->height) + height = current_vp->height - y; + + /* adjust for viewport */ + x += current_vp->x; + y += current_vp->y; + +#if defined(HAVE_VIEWPORT_CLIP) + /********************* Viewport on screen clipping ********************/ + /* nothing to draw? */ + if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) + || (x + width <= 0) || (y + height <= 0)) + return; + + /* clip image in viewport in screen */ + if (x < 0) + { + width += x; + src_x -= x; + x = 0; + } + if (y < 0) + { + height += y; + src_y -= y; + y = 0; + } + if (x + width > LCD_WIDTH) + width = LCD_WIDTH - x; + if (y + height > LCD_HEIGHT) + height = LCD_HEIGHT - y; +#endif + + src += stride * (src_y >> 3) + src_x; /* move starting point */ + src_y &= 7; + src_end = src + width; + dst_col = FBADDR(x, y); + + + if (drmode & DRMODE_INVERSEVID) + { + dmask = 0x1ff; /* bit 8 == sentinel */ + drmode &= DRMODE_SOLID; /* mask out inversevid */ + } + + /* Use extra bit to avoid if () in the switch-cases below */ + if ((drmode & DRMODE_BG) && lcd_backdrop) + drmode |= DRMODE_INT_BD; + + /* go through each column and update each pixel */ + do + { + const unsigned char *src_col = src++; + unsigned data = (*src_col ^ dmask) >> src_y; + fb_data fg, bg; + uintptr_t bo; + + dst = dst_col; + dst_col += COL_INC; + row = height; + +#define UPDATE_SRC do { \ + data >>= 1; \ + if (data == 0x001) { \ + src_col += stride; \ + data = *src_col ^ dmask; \ + } \ + } while (0) + + switch (drmode) + { + case DRMODE_COMPLEMENT: + do + { + if (data & 0x01) + flippixel(dst); + + dst += ROW_INC; + UPDATE_SRC; + } + while (--row); + break; + + case DRMODE_BG|DRMODE_INT_BD: + bo = lcd_backdrop_offset; + do + { + if (!(data & 0x01)) + *dst = *(fb_data *)((long)dst + bo); + + dst += ROW_INC; + UPDATE_SRC; + } + while (--row); + break; + + case DRMODE_BG: + bg = FB_SCALARPACK(current_vp->bg_pattern); + do + { + if (!(data & 0x01)) + *dst = bg; + + dst += ROW_INC; + UPDATE_SRC; + } + while (--row); + break; + + case DRMODE_FG: + fg = FB_SCALARPACK(current_vp->fg_pattern); + do + { + if (data & 0x01) + *dst = fg; + + dst += ROW_INC; + UPDATE_SRC; + } + while (--row); + break; + + case DRMODE_SOLID|DRMODE_INT_BD: + fg = FB_SCALARPACK(current_vp->fg_pattern); + bo = lcd_backdrop_offset; + do + { + *dst = (data & 0x01) ? fg + : *(fb_data *)((long)dst + bo); + dst += ROW_INC; + UPDATE_SRC; + } + while (--row); + break; + + case DRMODE_SOLID: + fg = FB_SCALARPACK(current_vp->fg_pattern); + bg = FB_SCALARPACK(current_vp->bg_pattern); + do + { + *dst = (data & 0x01) ? fg : bg; + dst += ROW_INC; + UPDATE_SRC; + } + while (--row); + break; + } + } + while (src < src_end); +} +/* Draw a full monochrome bitmap */ +void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int height) +{ + lcd_mono_bitmap_part(src, 0, 0, width, x, y, width, height); +} + + +/* About Rockbox' internal alpha channel format (for ALPHA_COLOR_FONT_DEPTH == 2) + * + * For each pixel, 4bit of alpha information is stored in a byte-stream, + * so two pixels are packed into one byte. + * The lower nibble is the first pixel, the upper one the second. The stride is + * horizontal. E.g row0: pixel0: byte0[0:3], pixel1: byte0[4:7], pixel2: byte1[0:3],... + * The format is independant of the internal display orientation and color + * representation, as to support the same font files on all displays. + * The values go linear from 0 (fully opaque) to 15 (fully transparent) + * (note how this is the opposite of the alpha channel in the ARGB format). + * + * This might suggest that rows need to have an even number of pixels. + * However this is generally not the case. lcd_alpha_bitmap_part_mix() can deal + * with uneven colums (i.e. two rows can share one byte). And font files do + * exploit this. + * However, this is difficult to do for image files, especially bottom-up bitmaps, + * so lcd_bmp() do expect even rows. + */ + +#define ALPHA_COLOR_FONT_DEPTH 2 +#define ALPHA_COLOR_LOOKUP_SHIFT (1 << ALPHA_COLOR_FONT_DEPTH) +#define ALPHA_COLOR_LOOKUP_SIZE ((1 << ALPHA_COLOR_LOOKUP_SHIFT) - 1) +#define ALPHA_COLOR_PIXEL_PER_BYTE (8 >> ALPHA_COLOR_FONT_DEPTH) +#define ALPHA_COLOR_PIXEL_PER_WORD (32 >> ALPHA_COLOR_FONT_DEPTH) + +/* This is based on SDL (src/video/SDL_RLEaccel.c) ALPHA_BLIT32_888() macro */ +static inline fb_data blend_two_colors(unsigned c1, unsigned c2, unsigned a) +{ + unsigned s = c1; + unsigned d = c2; + unsigned s1 = s & 0xff00ff; + unsigned d1 = d & 0xff00ff; + a += a >> (ALPHA_COLOR_LOOKUP_SHIFT - 1); + d1 = (d1 + ((s1 - d1) * a >> ALPHA_COLOR_LOOKUP_SHIFT)) & 0xff00ff; + s &= 0xff00; + d &= 0xff00; + d = (d + ((s - d) * a >> ALPHA_COLOR_LOOKUP_SHIFT)) & 0xff00; + + return FB_SCALARPACK(d1 | d); +} + +/* Blend an image with an alpha channel + * if image is NULL, drawing will happen according to the drawmode + * src is the alpha channel (4bit per pixel) */ +static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, + const unsigned char *src, int src_x, + int src_y, int x, int y, + int width, int height, + int stride_image, int stride_src) +{ + fb_data *dst, *dst_row; + unsigned dmask = 0x00000000; + int drmode = current_vp->drawmode; + /* nothing to draw? */ + if ((width <= 0) || (height <= 0) || (x >= current_vp->width) || + (y >= current_vp->height) || (x + width <= 0) || (y + height <= 0)) + return; + + /* clipping */ + if (x < 0) + { + width += x; + src_x -= x; + x = 0; + } + if (y < 0) + { + height += y; + src_y -= y; + y = 0; + } + if (x + width > current_vp->width) + width = current_vp->width - x; + if (y + height > current_vp->height) + height = current_vp->height - y; + + /* adjust for viewport */ + x += current_vp->x; + y += current_vp->y; + +#if defined(HAVE_VIEWPORT_CLIP) + /********************* Viewport on screen clipping ********************/ + /* nothing to draw? */ + if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) + || (x + width <= 0) || (y + height <= 0)) + return; + + /* clip image in viewport in screen */ + if (x < 0) + { + width += x; + src_x -= x; + x = 0; + } + if (y < 0) + { + height += y; + src_y -= y; + y = 0; + } + if (x + width > LCD_WIDTH) + width = LCD_WIDTH - x; + if (y + height > LCD_HEIGHT) + height = LCD_HEIGHT - y; +#endif + + /* the following drawmode combinations are possible: + * 1) COMPLEMENT: just negates the framebuffer contents + * 2) BG and BG+backdrop: draws _only_ background pixels with either + * the background color or the backdrop (if any). The backdrop + * is an image in native lcd format + * 3) FG and FG+image: draws _only_ foreground pixels with either + * the foreground color or an image buffer. The image is in + * native lcd format + * 4) SOLID, SOLID+backdrop, SOLID+image, SOLID+backdrop+image, i.e. all + * possible combinations of 2) and 3). Draws both, fore- and background, + * pixels. The rules of 2) and 3) apply. + * + * INVERSEVID swaps fore- and background pixels, i.e. background pixels + * become foreground ones and vice versa. + */ + if (drmode & DRMODE_INVERSEVID) + { + dmask = 0xffffffff; + drmode &= DRMODE_SOLID; /* mask out inversevid */ + } + + /* Use extra bits to avoid if () in the switch-cases below */ + if (image != NULL) + drmode |= DRMODE_INT_IMG; + + if ((drmode & DRMODE_BG) && lcd_backdrop) + drmode |= DRMODE_INT_BD; + + dst_row = FBADDR(x, y); + + int col, row = height; + unsigned data, pixels; + unsigned skip_end = (stride_src - width); + unsigned skip_start = src_y * stride_src + src_x; + unsigned skip_start_image = STRIDE_MAIN(src_y * stride_image + src_x, + src_x * stride_image + src_y); + +#ifdef ALPHA_BITMAP_READ_WORDS + uint32_t *src_w = (uint32_t *)((uintptr_t)src & ~3); + skip_start += ALPHA_COLOR_PIXEL_PER_BYTE * ((uintptr_t)src & 3); + src_w += skip_start / ALPHA_COLOR_PIXEL_PER_WORD; + data = letoh32(*src_w++) ^ dmask; + pixels = skip_start % ALPHA_COLOR_PIXEL_PER_WORD; +#else + src += skip_start / ALPHA_COLOR_PIXEL_PER_BYTE; + data = *src ^ dmask; + pixels = skip_start % ALPHA_COLOR_PIXEL_PER_BYTE; +#endif + data >>= pixels * ALPHA_COLOR_LOOKUP_SHIFT; +#ifdef ALPHA_BITMAP_READ_WORDS + pixels = 8 - pixels; +#endif + + /* image is only accessed in DRMODE_INT_IMG cases, i.e. when non-NULL. + * Therefore NULL accesses are impossible and we can increment + * unconditionally (applies for stride at the end of the loop as well) */ + image += skip_start_image; + /* go through the rows and update each pixel */ + do + { + /* saving current_vp->fg/bg_pattern and lcd_backdrop_offset into these + * temp vars just before the loop helps gcc to opimize the loop better + * (testing showed ~15% speedup) */ + unsigned fg, bg; + ptrdiff_t bo, img_offset; + col = width; + dst = dst_row; + dst_row += ROW_INC; +#ifdef ALPHA_BITMAP_READ_WORDS +#define UPDATE_SRC_ALPHA do { \ + if (--pixels) \ + data >>= ALPHA_COLOR_LOOKUP_SHIFT; \ + else \ + { \ + data = letoh32(*src_w++) ^ dmask; \ + pixels = ALPHA_COLOR_PIXEL_PER_WORD; \ + } \ + } while (0) +#elif ALPHA_COLOR_PIXEL_PER_BYTE == 2 +#define UPDATE_SRC_ALPHA do { \ + if (pixels ^= 1) \ + data >>= ALPHA_COLOR_LOOKUP_SHIFT; \ + else \ + data = *(++src) ^ dmask; \ + } while (0) +#else +#define UPDATE_SRC_ALPHA do { \ + if (pixels = (++pixels % ALPHA_COLOR_PIXEL_PER_BYTE)) \ + data >>= ALPHA_COLOR_LOOKUP_SHIFT; \ + else \ + data = *(++src) ^ dmask; \ + } while (0) +#endif + + switch (drmode) + { + case DRMODE_COMPLEMENT: + do + { + unsigned px = FB_UNPACK_SCALAR_LCD(*dst); + *dst = blend_two_colors(px, ~px, + data & ALPHA_COLOR_LOOKUP_SIZE ); + dst += COL_INC; + UPDATE_SRC_ALPHA; + } + while (--col); + break; + case DRMODE_BG|DRMODE_INT_BD: + bo = lcd_backdrop_offset; + do + { + unsigned px = FB_UNPACK_SCALAR_LCD(*dst); + unsigned c = FB_UNPACK_SCALAR_LCD(*(fb_data *)((uintptr_t)dst + bo)); + *dst = blend_two_colors(c, px, data & ALPHA_COLOR_LOOKUP_SIZE ); + dst += COL_INC; + image += STRIDE_MAIN(1, stride_image); + UPDATE_SRC_ALPHA; + } + while (--col); + break; + case DRMODE_BG: + bg = current_vp->bg_pattern; + do + { + unsigned px = FB_UNPACK_SCALAR_LCD(*dst); + *dst = blend_two_colors(bg, px, data & ALPHA_COLOR_LOOKUP_SIZE ); + dst += COL_INC; + UPDATE_SRC_ALPHA; + } + while (--col); + break; + case DRMODE_FG|DRMODE_INT_IMG: + img_offset = image - dst; + do + { + unsigned px1 = FB_UNPACK_SCALAR_LCD(*dst); + unsigned px2 = FB_UNPACK_SCALAR_LCD(*(dst + img_offset)); + *dst = blend_two_colors(px1, px2, data & ALPHA_COLOR_LOOKUP_SIZE ); + dst += COL_INC; + UPDATE_SRC_ALPHA; + } + while (--col); + break; + case DRMODE_FG: + fg = current_vp->fg_pattern; + do + { + unsigned px = FB_UNPACK_SCALAR_LCD(*dst); + *dst = blend_two_colors(px, fg, data & ALPHA_COLOR_LOOKUP_SIZE ); + dst += COL_INC; + UPDATE_SRC_ALPHA; + } + while (--col); + break; + case DRMODE_SOLID|DRMODE_INT_BD: + bo = lcd_backdrop_offset; + fg = current_vp->fg_pattern; + do + { + unsigned c = FB_UNPACK_SCALAR_LCD(*(fb_data *)((uintptr_t)dst + bo)); + *dst = blend_two_colors(c, fg, data & ALPHA_COLOR_LOOKUP_SIZE ); + dst += COL_INC; + UPDATE_SRC_ALPHA; + } + while (--col); + break; + case DRMODE_SOLID|DRMODE_INT_IMG: + bg = current_vp->bg_pattern; + img_offset = image - dst; + do + { + unsigned c = FB_UNPACK_SCALAR_LCD(*(dst + img_offset)); + *dst = blend_two_colors(bg, c, data & ALPHA_COLOR_LOOKUP_SIZE ); + dst += COL_INC; + UPDATE_SRC_ALPHA; + } + while (--col); + break; + case DRMODE_SOLID|DRMODE_INT_BD|DRMODE_INT_IMG: + bo = lcd_backdrop_offset; + img_offset = image - dst; + do + { + unsigned px = FB_UNPACK_SCALAR_LCD(*(fb_data *)((uintptr_t)dst + bo)); + unsigned c = FB_UNPACK_SCALAR_LCD(*(dst + img_offset)); + *dst = blend_two_colors(px, c, data & ALPHA_COLOR_LOOKUP_SIZE ); + dst += COL_INC; + UPDATE_SRC_ALPHA; + } + while (--col); + break; + case DRMODE_SOLID: + bg = current_vp->bg_pattern; + fg = current_vp->fg_pattern; + do + { + *dst = blend_two_colors(bg, fg, data & ALPHA_COLOR_LOOKUP_SIZE ); + dst += COL_INC; + UPDATE_SRC_ALPHA; + } + while (--col); + break; + } +#ifdef ALPHA_BITMAP_READ_WORDS + if (skip_end < pixels) + { + pixels -= skip_end; + data >>= skip_end * ALPHA_COLOR_LOOKUP_SHIFT; + } else { + pixels = skip_end - pixels; + src_w += pixels / ALPHA_COLOR_PIXEL_PER_WORD; + pixels %= ALPHA_COLOR_PIXEL_PER_WORD; + data = letoh32(*src_w++) ^ dmask; + data >>= pixels * ALPHA_COLOR_LOOKUP_SHIFT; + pixels = 8 - pixels; + } +#else + if (skip_end) + { + pixels += skip_end; + if (pixels >= ALPHA_COLOR_PIXEL_PER_BYTE) + { + src += pixels / ALPHA_COLOR_PIXEL_PER_BYTE; + pixels %= ALPHA_COLOR_PIXEL_PER_BYTE; + data = *src ^ dmask; + data >>= pixels * ALPHA_COLOR_LOOKUP_SHIFT; + } else + data >>= skip_end * ALPHA_COLOR_LOOKUP_SHIFT; + } +#endif + + image += STRIDE_MAIN(stride_image,1); + } while (--row); +} + +/*** drawing functions ***/ + +/* Draw a horizontal line (optimised) */ +void lcd_hline(int x1, int x2, int y) +{ + int x, width; + fb_data *dst, *dst_end; + lcd_fastpixelfunc_type *pfunc = lcd_fastpixelfuncs[current_vp->drawmode]; + + /* direction flip */ + if (x2 < x1) + { + x = x1; + x1 = x2; + x2 = x; + } + + /******************** In viewport clipping **********************/ + /* nothing to draw? */ + if (((unsigned)y >= (unsigned)current_vp->height) || + (x1 >= current_vp->width) || + (x2 < 0)) + return; + + if (x1 < 0) + x1 = 0; + if (x2 >= current_vp->width) + x2 = current_vp->width-1; + + /* Adjust x1 and y to viewport */ + x1 += current_vp->x; + x2 += current_vp->x; + y += current_vp->y; + +#if defined(HAVE_VIEWPORT_CLIP) + /********************* Viewport on screen clipping ********************/ + /* nothing to draw? */ + if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH) + || (x2 < 0)) + return; + + /* clipping */ + if (x1 < 0) + x1 = 0; + if (x2 >= LCD_WIDTH) + x2 = LCD_WIDTH-1; +#endif + + width = x2 - x1 + 1; + + dst = FBADDR(x1 , y); + dst_end = dst + width; + do + { + pfunc(dst); + } + while (++dst < dst_end); +} + +/* Draw a vertical line (optimised) */ +void lcd_vline(int x, int y1, int y2) +{ + int y; + fb_data *dst, *dst_end; + lcd_fastpixelfunc_type *pfunc = lcd_fastpixelfuncs[current_vp->drawmode]; + + /* direction flip */ + if (y2 < y1) + { + y = y1; + y1 = y2; + y2 = y; + } + + /******************** In viewport clipping **********************/ + /* nothing to draw? */ + if (((unsigned)x >= (unsigned)current_vp->width) || + (y1 >= current_vp->height) || + (y2 < 0)) + return; + + if (y1 < 0) + y1 = 0; + if (y2 >= current_vp->height) + y2 = current_vp->height-1; + + /* adjust for viewport */ + x += current_vp->x; + y1 += current_vp->y; + y2 += current_vp->y; + +#if defined(HAVE_VIEWPORT_CLIP) + /********************* Viewport on screen clipping ********************/ + /* nothing to draw? */ + if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT) + || (y2 < 0)) + return; + + /* clipping */ + if (y1 < 0) + y1 = 0; + if (y2 >= LCD_HEIGHT) + y2 = LCD_HEIGHT-1; +#endif + + dst = FBADDR(x , y1); + dst_end = dst + (y2 - y1) * LCD_WIDTH; + + do + { + pfunc(dst); + dst += LCD_WIDTH; + } + while (dst <= dst_end); +} + +/* Draw a partial native bitmap */ +void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, + int stride, int x, int y, int width, + int height) +{ + fb_data *dst; + + /******************** Image in viewport clipping **********************/ + /* nothing to draw? */ + if ((width <= 0) || (height <= 0) || (x >= current_vp->width) || + (y >= current_vp->height) || (x + width <= 0) || (y + height <= 0)) + return; + + if (x < 0) + { + width += x; + src_x -= x; + x = 0; + } + if (y < 0) + { + height += y; + src_y -= y; + y = 0; + } + + if (x + width > current_vp->width) + width = current_vp->width - x; + if (y + height > current_vp->height) + height = current_vp->height - y; + + /* adjust for viewport */ + x += current_vp->x; + y += current_vp->y; + +#if defined(HAVE_VIEWPORT_CLIP) + /********************* Viewport on screen clipping ********************/ + /* nothing to draw? */ + if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) + || (x + width <= 0) || (y + height <= 0)) + return; + + /* clip image in viewport in screen */ + if (x < 0) + { + width += x; + src_x -= x; + x = 0; + } + if (y < 0) + { + height += y; + src_y -= y; + y = 0; + } + if (x + width > LCD_WIDTH) + width = LCD_WIDTH - x; + if (y + height > LCD_HEIGHT) + height = LCD_HEIGHT - y; +#endif + + src += stride * src_y + src_x; /* move starting point */ + dst = FBADDR(x, y); + + do + { + memcpy(dst, src, width * sizeof(fb_data)); + src += stride; + dst += LCD_WIDTH; + } + while (--height > 0); +} + +/* Draw a partial native bitmap with transparency and foreground colors */ +void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, + int src_y, int stride, int x, + int y, int width, int height) +{ + fb_data *dst; + fb_data fg, transparent, replacewithfg; + + /******************** Image in viewport clipping **********************/ + /* nothing to draw? */ + if ((width <= 0) || (height <= 0) || (x >= current_vp->width) || + (y >= current_vp->height) || (x + width <= 0) || (y + height <= 0)) + return; + + if (x < 0) + { + width += x; + src_x -= x; + x = 0; + } + if (y < 0) + { + height += y; + src_y -= y; + y = 0; + } + + if (x + width > current_vp->width) + width = current_vp->width - x; + if (y + height > current_vp->height) + height = current_vp->height - y; + + /* adjust for viewport */ + x += current_vp->x; + y += current_vp->y; + +#if defined(HAVE_VIEWPORT_CLIP) + /********************* Viewport on screen clipping ********************/ + /* nothing to draw? */ + if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) + || (x + width <= 0) || (y + height <= 0)) + return; + + /* clip image in viewport in screen */ + if (x < 0) + { + width += x; + src_x -= x; + x = 0; + } + if (y < 0) + { + height += y; + src_y -= y; + y = 0; + } + if (x + width > LCD_WIDTH) + width = LCD_WIDTH - x; + if (y + height > LCD_HEIGHT) + height = LCD_HEIGHT - y; +#endif + + src += stride * src_y + src_x; /* move starting point */ + dst = FBADDR(x, y); + + transparent = FB_SCALARPACK(TRANSPARENT_COLOR); + replacewithfg = FB_SCALARPACK(REPLACEWITHFG_COLOR); + fg = FB_SCALARPACK(current_vp->fg_pattern); +#define CMP(c1, c2) (c1.r == c2.r && c1.g == c2.g && c1.b == c2.b) + + do + { + const fb_data *src_row = src; + fb_data *dst_row = dst; + fb_data *row_end = dst_row + width; + do + { + fb_data data = *src_row++; + if (!CMP(data, transparent)) + { + if (CMP(data, replacewithfg)) + data = fg; + *dst_row = data; + } + } + while (++dst_row < row_end); + src += stride; + dst += LCD_WIDTH; + } + while (--height > 0); +} 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], b = clamp(b, 0, 64*256-1); } - *dst = FB_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); + *dst = FB_RGBPACK(r >> 6, g >> 6, b >> 6); #if LCD_WIDTH >= LCD_HEIGHT dst++; @@ -442,7 +442,7 @@ void lcd_blit_yuv(unsigned char * const src[3], b = clamp(b, 0, 64*256-1); } - *dst = FB_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); + *dst = FB_RGBPACK(r >> 6, g >> 6, b >> 6); #if LCD_WIDTH >= LCD_HEIGHT dst++; @@ -487,7 +487,7 @@ void lcd_blit_yuv(unsigned char * const src[3], b = clamp(b, 0, 64*256-1); } - *dst = FB_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); + *dst = FB_RGBPACK(r >> 6, g >> 6, b >> 6); #if LCD_WIDTH >= LCD_HEIGHT dst++; @@ -507,7 +507,7 @@ void lcd_blit_yuv(unsigned char * const src[3], b = clamp(b, 0, 64*256-1); } - *dst = FB_RGBPACK_LCD(r >> 9, g >> 8, b >> 9); + *dst = FB_RGBPACK(r >> 6, g >> 6, b >> 6); #if LCD_WIDTH >= LCD_HEIGHT 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 @@ #define VERTICAL_INTERLEAVED 4 #define RGB565 565 #define RGB565SWAPPED 3553 +#define RGB888 888 /* LCD_STRIDEFORMAT */ #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 @@ /* sqrt(240^2 + 320^2) / 2.6 = 153.8 */ #define LCD_DPI 154 -#define LCD_DEPTH 16 +#define LCD_DEPTH 24 /* Check that but should not matter */ #define LCD_PIXELFORMAT RGB565 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 @@ #define LCD_HEIGHT 240 #endif -#define LCD_DEPTH 16 +#define LCD_DEPTH 24 /* Calculated value, important for touch sensor */ #define LCD_DPI 180 /* Check that but should not matter */ -#define LCD_PIXELFORMAT RGB565 +#define LCD_PIXELFORMAT RGB888 /* Capacitive touchscreen */ #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 @@ #define LCD_HEIGHT 220 /* sqrt(176^2 + 220^2) / 1.8 = 156.5 */ #define LCD_DPI 157 -#define LCD_DEPTH 16 /* 65536 colours */ -#define LCD_PIXELFORMAT RGB565 /* rgb565 */ +#define LCD_DEPTH 24 /* 65536 colours */ +#define LCD_PIXELFORMAT RGB888 /* rgb565 */ #ifndef BOOTLOADER /* 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 @@ #define LCD_HEIGHT 480 #endif -#define LCD_DEPTH 16 -#define LCD_PIXELFORMAT RGB565 +#define LCD_DEPTH 24 +#define LCD_PIXELFORMAT RGB888 /* define this to indicate your device's keypad */ #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; #elif LCD_DEPTH <= 16 typedef unsigned short fb_data; #define FB_DATA_SZ 2 -#else /* LCD_DEPTH > 16 */ +#elif LCD_DEPTH <= 24 +struct _fb_pixel { + unsigned char b, g, r; +}; +typedef struct _fb_pixel fb_data; +#define FB_DATA_SZ 3 +#else /* LCD_DEPTH > 24 */ typedef unsigned long fb_data; #define FB_DATA_SZ 4 #endif /* LCD_DEPTH */ @@ -341,6 +347,31 @@ static inline unsigned lcd_color_to_native(unsigned color) #define RGB_UNPACK_GREEN_LCD(x) _RGB_UNPACK_GREEN_LCD(x) #define RGB_UNPACK_BLUE_LCD(x) _RGB_UNPACK_BLUE_LCD(x) #endif /* RGB565* */ + +#elif LCD_PIXELFORMAT == RGB888 +#define LCD_MAX_RED 255 +#define LCD_MAX_GREEN 255 +#define LCD_MAX_BLUE 255 +#define LCD_RED_BITS 8 +#define LCD_GREEN_BITS 8 +#define LCD_BLUE_BITS 8 + +/* pack/unpack native RGB values */ +#define _RGBPACK(r, g, b) ( r << 16 | g << 8 | b ) +#define _RGB_UNPACK_RED(x) ((x >> 16) & 0xff) +#define _RGB_UNPACK_GREEN(x) ((x >> 8) & 0xff) +#define _RGB_UNPACK_BLUE(x) ((x >> 0) & 0xff) + +#define _LCD_UNSWAP_COLOR(x) (x) +#define LCD_RGBPACK(r, g, b) _RGBPACK((r), (g), (b)) +#define LCD_RGBPACK_LCD(r, g, b) _RGBPACK((r), (g), (b)) +#define RGB_UNPACK_RED(x) _RGB_UNPACK_RED(x) +#define RGB_UNPACK_GREEN(x) _RGB_UNPACK_GREEN(x) +#define RGB_UNPACK_BLUE(x) _RGB_UNPACK_BLUE(x) +#define RGB_UNPACK_RED_LCD(x) _RGB_UNPACK_RED(x) +#define RGB_UNPACK_GREEN_LCD(x) _RGB_UNPACK_GREEN(x) +#define RGB_UNPACK_BLUE_LCD(x) _RGB_UNPACK_BLUE(x) + #else /* other colour depths */ #endif @@ -367,6 +398,58 @@ static inline unsigned lcd_color_to_native(unsigned color) #endif /* HAVE_LCD_COLOR */ +/* Framebuffer conversion macros: Convert from and to the native display data + * format (fb_data). + * + * FB_RGBPACK: Convert the three r,g,b values to fb_data. r,g,b are + * assumed to in 8-bit format. + * FB_RGBPACK_LCD Like FB_RGBPACK, except r,g,b shall be in display-native + * bit format (e.g. 5-bit r for RGB565) + * FB_UNPACK_RED Extract the red component of fb_data into 8-bit red value. + * FB_UNPACK_GREEN Like FB_UNPACK_RED, just for the green component. + * FB_UNPACK_BLIE Like FB_UNPACK_RED, just for the green component. + * FB_SCALARPACK Similar to FB_RGBPACK, except that the channels are already + * combined into a single scalar value. Again, 8-bit per channel. + * FB_SCALARPACK_LCD Like FB_SCALARPACK, except the channels shall be in + * display-native format (i.e. the scalar is 16bits on RGB565) + * FB_UNPACK_SCALAR_LCD Converts an fb_data to a scalar value in display-native + * format, so it's the reverse of FB_SCALARPACK_LCD + */ +#if LCD_DEPTH >= 24 +static inline fb_data scalar_to_fb(unsigned p) +{ + union { fb_data st; unsigned sc; } convert; + convert.sc = p; return convert.st; +} +static inline unsigned fb_to_scalar(fb_data p) +{ + union { fb_data st; unsigned sc; } convert; + convert.st = p; return convert.sc; +} +#define FB_RGBPACK(r_, g_, b_) ((fb_data){.r = r_, .g = g_, .b = b_}) +#define FB_RGBPACK_LCD(r_, g_, b_) FB_RGBPACK(r_, g_, b_) +#define FB_UNPACK_RED(fb) ((fb).r) +#define FB_UNPACK_GREEN(fb) ((fb).g) +#define FB_UNPACK_BLUE(fb) ((fb).b) +#define FB_SCALARPACK(c) scalar_to_fb(c) +#define FB_SCALARPACK_LCD(c) scalar_to_fb(c) +#define FB_UNPACK_SCALAR_LCD(fb) fb_to_scalar(fb) +#elif defined(HAVE_LCD_COLOR) +#define FB_RGBPACK(r_, g_, b_) LCD_RGBPACK(r_, g_, b_) +#define FB_RGBPACK_LCD(r_, g_, b_) LCD_RGBPACK_LCD(r_, g_, b_) +#define FB_UNPACK_RED(fb) RGB_UNPACK_RED(fb) +#define FB_UNPACK_GREEN(fb) RGB_UNPACK_GREEN(fb) +#define FB_UNPACK_BLUE(fb) RGB_UNPACK_BLUE(fb) +#define FB_SCALARPACK(c) LCD_RGBPACK(RGB_UNPACK_RED(c), RGB_UNPACK_GREEN(c), RGB_UNPACK_BLUE(c)) +#define FB_SCALARPACK_LCD(c) (c) +#define FB_UNPACK_SCALAR_LCD(fb) (fb) +#else +#define FB_SCALARPACK(c) (c) +#define FB_SCALARPACK_LCD(c) (c) +#define FB_UNPACK_SCALAR_LCD(fb) (fb) +#endif + + /* Frame buffer dimensions */ #if LCD_DEPTH == 1 #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) #elif LCD_DEPTH <= 16 unsigned short *dst, *dst_end; unsigned short linebuf[DUMP_BMP_LINESIZE/2]; +#else /* 24bit */ + unsigned char *dst, *dst_end; + unsigned char linebuf[DUMP_BMP_LINESIZE * 3]; #endif #if CONFIG_RTC @@ -227,6 +230,17 @@ void screen_dump(void) #endif } while (dst < dst_end); +#elif LCD_DEPTH == 24 + dst_end = dst + LCD_WIDTH*3; + src = FBADDR(0, y); + do + { + *dst++ = src->b; + *dst++ = src->g; + *dst++ = src->r; + ++src; + } + while (dst < dst_end); #endif /* LCD_DEPTH */ 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) #else return *FBADDR(x, y); #endif +#elif LCD_DEPTH == 24 + return FB_UNPACK_SCALAR_LCD(*FBADDR(x, y)); #endif } @@ -172,7 +174,7 @@ void sim_backlight(int value) /* initialise simulator lcd driver */ void lcd_init_device(void) { -#if LCD_DEPTH == 16 +#if LCD_DEPTH >= 16 lcd_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, SIM_LCD_WIDTH * display_zoom, 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, bool have_header = header_dir && header_dir[0]; create_bm = have_header && create_bm; - if (t_depth > 16) - { - fprintf(stderr, "Generating C source not supported for this format\n"); - fprintf(stderr, "because Rockbox does not support this display depth yet.\n"); - fprintf(stderr, "However you are welcome to fix this!\n"); - return; - } - if (!id || !id[0]) id = "bitmap"; @@ -520,8 +512,11 @@ void generate_c_source(char *id, char* header_dir, int width, int height, id, height, id, width); if (t_depth <= 8) fprintf(fh, "extern const unsigned char %s[];\n", id); - else + else if (t_depth <= 16) fprintf(fh, "extern const unsigned short %s[];\n", id); + else + fprintf(fh, "extern const fb_data %s[];\n", id); + if (create_bm) { @@ -542,8 +537,10 @@ void generate_c_source(char *id, char* header_dir, int width, int height, if (t_depth <= 8) fprintf(f, "const unsigned char %s[] = {\n", id); - else + else if (t_depth == 16) fprintf(f, "const unsigned short %s[] = {\n", id); + else if (t_depth == 24) + fprintf(f, "const fb_data %s[] = {\n", id); for (i = 0; i < t_height; i++) { @@ -555,6 +552,12 @@ void generate_c_source(char *id, char* header_dir, int width, int height, else if (t_depth == 16) fprintf(f, "0x%04x,%c", t_bitmap->d16[i * t_width + a], (a + 1) % 10 ? ' ' : '\n'); + else if (t_depth == 24) + fprintf(f, "{ .r = 0x%02x, .g = 0x%02x, .b = 0x%02x },%c", + t_bitmap->d24[i * t_width + a].r, + t_bitmap->d24[i * t_width + a].g, + t_bitmap->d24[i * t_width + a].b, + (a + 1) % 4 ? ' ' : '\n'); } fprintf(f, "\n"); } @@ -651,7 +654,7 @@ void print_usage(void) "\t 6 Greyscale iPod 4-grey\n" "\t 7 Greyscale X5 remote 4-grey\n" "\t 8 16-bit packed 5-6-5 RGB with a vertical stride\n" - "\t 9 24-bit BGR (raw only for now)\n"); + "\t 9 24-bit BGR\n"); printf("build date: " __DATE__ "\n\n"); } diff --git a/wps/WPSLIST b/wps/WPSLIST index 93a173a18a..d26370214f 100644 --- a/wps/WPSLIST +++ b/wps/WPSLIST @@ -79,58 +79,58 @@ RSBS: no <main> # override implicit .wps filename -wps.800x480x16: cabbiev2.800x480x16.wps -wps.480x800x16: cabbiev2.480x800x16.wps -wps.400x240x16: cabbiev2.400x240x16.wps -wps.320x480x16: cabbiev2.320x480x16.wps -wps.320x240x16: cabbiev2.320x240x16.wps -wps.240x400x16: cabbiev2.240x400x16.wps -wps.240x320x16: cabbiev2.240x320x16.wps -wps.220x176x16: cabbiev2.220x176x16.wps -wps.176x220x16: cabbiev2.176x220x16.wps -wps.176x132x16: cabbiev2.176x132x16.wps -wps.160x128x16: cabbiev2.160x128x16.wps -wps.160x128x2: cabbiev2.160x128x2.wps -wps.160x128x1: cabbiev2.160x128x1.wps -wps.138x110x2: cabbiev2.138x110x2.wps -wps.128x128x16: cabbiev2.128x128x16.wps -wps.128x128x2: cabbiev2.128x128x2.wps -wps.128x160x16: cabbiev2.128x160x16.wps -wps.132x80x16: cabbiev2.132x80x16.wps -wps.128x96x16: cabbiev2.128x96x16.wps -wps.128x96x2: cabbiev2.128x96x2.wps -wps.128x64x1: cabbiev2.128x64x1.wps -wps.112x64x1: cabbiev2.112x64x1.wps -wps.96x96x16: cabbiev2.96x96x16.wps +wps.800x480x(16|24): cabbiev2.800x480x16.wps +wps.480x800x(16|24): cabbiev2.480x800x16.wps +wps.400x240x(16|24): cabbiev2.400x240x16.wps +wps.320x480x(16|24): cabbiev2.320x480x16.wps +wps.320x240x(16|24): cabbiev2.320x240x16.wps +wps.240x400x(16|24): cabbiev2.240x400x16.wps +wps.240x320x(16|24): cabbiev2.240x320x16.wps +wps.220x176x(16|24): cabbiev2.220x176x16.wps +wps.176x220x(16|24): cabbiev2.176x220x16.wps +wps.176x132x(16|24): cabbiev2.176x132x16.wps +wps.160x128x(16|24): cabbiev2.160x128x16.wps +wps.160x128x2: cabbiev2.160x128x2.wps +wps.160x128x1: cabbiev2.160x128x1.wps +wps.138x110x2: cabbiev2.138x110x2.wps +wps.128x128x(16|24): cabbiev2.128x128x16.wps +wps.128x128x2: cabbiev2.128x128x2.wps +wps.128x160x(16|24): cabbiev2.128x160x16.wps +wps.132x80x(16|24): cabbiev2.132x80x16.wps +wps.128x96x(16|24): cabbiev2.128x96x16.wps +wps.128x96x2: cabbiev2.128x96x2.wps +wps.128x64x1: cabbiev2.128x64x1.wps +wps.112x64x1: cabbiev2.112x64x1.wps +wps.96x96x(16|24): cabbiev2.96x96x16.wps # override implicit .fms filename fms.160x128x2: cabbiev2-160x128x2.fms fms.128x128x2: cabbiev2-128x128x2.fms # Preferred font (including .fnt extension - leave blank for player): -Font.800x480x16: 35-Adobe-Helvetica.fnt -Font.480x800x16: 35-Adobe-Helvetica.fnt -Font.400x240x16: 15-Adobe-Helvetica.fnt -Font.320x480x16: 27-Adobe-Helvetica.fnt -Font.320x240x16: 15-Adobe-Helvetica.fnt -Font.240x400x16: 16-Adobe-Helvetica.fnt -Font.240x320x16: 15-Adobe-Helvetica.fnt -Font.220x176x16: 12-Adobe-Helvetica.fnt -Font.176x220x16: 12-Adobe-Helvetica.fnt -Font.176x132x16: 12-Adobe-Helvetica.fnt -Font.160x128x16: 12-Adobe-Helvetica.fnt -Font.160x128x2: 12-Adobe-Helvetica.fnt -Font.160x128x1: 12-Adobe-Helvetica.fnt -Font.138x110x2: 12-Adobe-Helvetica.fnt -Font.128x128x16: 12-Adobe-Helvetica.fnt -Font.128x128x2: 12-Adobe-Helvetica.fnt -Font.128x160x16: 12-Adobe-Helvetica.fnt -Font.132x80x16: 11-Sazanami-Mincho.fnt -Font.128x96x16: 08-Rockfont.fnt -Font.128x96x2: 12-Adobe-Helvetica.fnt -Font.128x64x1: 08-Rockfont.fnt -Font.112x64x1: 08-Rockfont.fnt -Font.96x96x16: 08-Rockfont.fnt +Font.800x480x(16|24): 35-Adobe-Helvetica.fnt +Font.480x800x(16|24): 35-Adobe-Helvetica.fnt +Font.400x240x(16|24): 15-Adobe-Helvetica.fnt +Font.320x480x(16|24): 27-Adobe-Helvetica.fnt +Font.320x240x(16|24): 15-Adobe-Helvetica.fnt +Font.240x400x(16|24): 16-Adobe-Helvetica.fnt +Font.240x320x(16|24): 15-Adobe-Helvetica.fnt +Font.220x176x(16|24): 12-Adobe-Helvetica.fnt +Font.176x220x(16|24): 12-Adobe-Helvetica.fnt +Font.176x132x(16|24): 12-Adobe-Helvetica.fnt +Font.160x128x(16|24): 12-Adobe-Helvetica.fnt +Font.160x128x2: 12-Adobe-Helvetica.fnt +Font.160x128x1: 12-Adobe-Helvetica.fnt +Font.138x110x2: 12-Adobe-Helvetica.fnt +Font.128x128x(16|24): 12-Adobe-Helvetica.fnt +Font.128x128x2: 12-Adobe-Helvetica.fnt +Font.128x160x(16|24): 12-Adobe-Helvetica.fnt +Font.132x80x(16|24): 11-Sazanami-Mincho.fnt +Font.128x96x(16|24): 08-Rockfont.fnt +Font.128x96x2: 12-Adobe-Helvetica.fnt +Font.128x64x1: 08-Rockfont.fnt +Font.112x64x1: 08-Rockfont.fnt +Font.96x96x(16|24): 08-Rockfont.fnt #misc settings that should be ignored on grayscale targets foreground color: CCCCCC @@ -141,68 +141,68 @@ line selector text color: 000000 filetype colours: - #backdrop - remember this is the source file name in your SVN folder, not dest name! -backdrop.800x480x16: backdrops/cabbiev2.800x480x16.bmp -backdrop.480x800x16: backdrops/cabbiev2.480x800x16.bmp -backdrop.400x240x16: backdrops/cabbiev2.400x240x16.bmp -backdrop.320x480x16: backdrops/cabbiev2.320x480x16.bmp -backdrop.320x240x16: backdrops/cabbiev2.320x240x16.bmp -backdrop.128x128x16: backdrops/cabbiev2.128x128x16.bmp -backdrop.128x128x2: backdrops/cabbiev2.128x128x2.bmp -backdrop.128x160x16: backdrops/cabbiev2.128x160x16.bmp -backdrop.132x80x16: backdrops/cabbiev2.132x80x16.bmp -backdrop.138x110x2: backdrops/cabbiev2.138x110x2.bmp -backdrop.160x128x16: backdrops/cabbiev2.160x128x16.bmp -backdrop.160x128x2: backdrops/cabbiev2.160x128x2.bmp -backdrop.176x132x16: backdrops/cabbiev2.176x132x16.bmp -backdrop.176x220x16: backdrops/cabbiev2.176x220x16.bmp -backdrop.220x176x16: backdrops/cabbiev2.220x176x16.bmp -backdrop.240x320x16: backdrops/cabbiev2.240x320x16.bmp -backdrop.240x400x16: backdrops/cabbiev2.240x400x16.bmp -backdrop.96x96x16: backdrops/cabbiev2.96x96x16.bmp -backdrop.128x96x16: backdrops/cabbiev2.128x96x16.bmp -backdrop.128x96x2: backdrops/cabbiev2.128x96x2.bmp +backdrop.800x480x(16|24): backdrops/cabbiev2.800x480x16.bmp +backdrop.480x800x(16|24): backdrops/cabbiev2.480x800x16.bmp +backdrop.400x240x(16|24): backdrops/cabbiev2.400x240x16.bmp +backdrop.320x480x(16|24): backdrops/cabbiev2.320x480x16.bmp +backdrop.320x240x(16|24): backdrops/cabbiev2.320x240x16.bmp +backdrop.128x128x(16|24): backdrops/cabbiev2.128x128x16.bmp +backdrop.128x128x2: backdrops/cabbiev2.128x128x2.bmp +backdrop.128x160x(16|24): backdrops/cabbiev2.128x160x16.bmp +backdrop.132x80x(16|24): backdrops/cabbiev2.132x80x16.bmp +backdrop.138x110x2: backdrops/cabbiev2.138x110x2.bmp +backdrop.160x128x(16|24): backdrops/cabbiev2.160x128x16.bmp +backdrop.160x128x2: backdrops/cabbiev2.160x128x2.bmp +backdrop.176x132x(16|24): backdrops/cabbiev2.176x132x16.bmp +backdrop.176x220x(16|24): backdrops/cabbiev2.176x220x16.bmp +backdrop.220x176x(16|24): backdrops/cabbiev2.220x176x16.bmp +backdrop.240x320x(16|24): backdrops/cabbiev2.240x320x16.bmp +backdrop.240x400x(16|24): backdrops/cabbiev2.240x400x16.bmp +backdrop.96x96x(16|24): backdrops/cabbiev2.96x96x16.bmp +backdrop.128x96x(16|24): backdrops/cabbiev2.128x96x16.bmp +backdrop.128x96x2: backdrops/cabbiev2.128x96x2.bmp #selection bar settings for color targets selector type..+x16: bar (gradient) selector type..+x2: bar (inverse) #icons -iconset.800x480x16: icons/tango_icons.32x32.bmp -iconset.480x800x16: icons/tango_icons.32x32.bmp -iconset.400x240x16: icons/tango_icons.16x16.bmp -iconset.320x480x16: icons/tango_icons.24x24.bmp -iconset.320x240x16: icons/tango_icons.16x16.bmp -iconset.128x128x16: icons/tango_icons.12x12.bmp -iconset.128x160x16: icons/tango_icons.12x12.bmp -iconset.132x80x16: icons/tango_icons.12x12.bmp -iconset.160x128x16: icons/tango_icons.12x12.bmp -iconset.176x132x16: icons/tango_icons.12x12.bmp -iconset.176x220x16: icons/tango_icons.12x12.bmp -iconset.220x176x16: icons/tango_icons.12x12.bmp -iconset.240x320x16: icons/tango_icons.16x16.bmp -iconset.240x400x16: icons/tango_icons.16x16.bmp -iconset.128x96x16: icons/tango_icons.8x8.bmp -iconset.96x96x16: icons/tango_icons.8x8.bmp -iconset..+x2: icons/tango_small_mono.bmp +iconset.800x480x(16|24): icons/tango_icons.32x32.bmp +iconset.480x800x(16|24): icons/tango_icons.32x32.bmp +iconset.400x240x(16|24): icons/tango_icons.16x16.bmp +iconset.320x480x(16|24): icons/tango_icons.24x24.bmp +iconset.320x240x(16|24): icons/tango_icons.16x16.bmp +iconset.128x128x(16|24): icons/tango_icons.12x12.bmp +iconset.128x160x(16|24): icons/tango_icons.12x12.bmp +iconset.132x80x(16|24): icons/tango_icons.12x12.bmp +iconset.160x128x(16|24): icons/tango_icons.12x12.bmp +iconset.176x132x(16|24): icons/tango_icons.12x12.bmp +iconset.176x220x(16|24): icons/tango_icons.12x12.bmp +iconset.220x176x(16|24): icons/tango_icons.12x12.bmp +iconset.240x320x(16|24): icons/tango_icons.16x16.bmp +iconset.240x400x(16|24): icons/tango_icons.16x16.bmp +iconset.128x96x(16|24): icons/tango_icons.8x8.bmp +iconset.96x96x(16|24): icons/tango_icons.8x8.bmp +iconset..+x2: icons/tango_small_mono.bmp #viewer icons -viewers iconset.800x480x16: icons/tango_icons_viewers.32x32.bmp -viewers iconset.480x800x16: icons/tango_icons_viewers.32x32.bmp -viewers iconset.400x240x16: icons/tango_icons_viewers.16x16.bmp -viewers iconset.320x480x16: icons/tango_icons_viewers.24x24.bmp -viewers iconset.320x240x16: icons/tango_icons_viewers.16x16.bmp -viewers iconset.128x128x16: icons/tango_icons_viewers.12x12.bmp -viewers iconset.128x160x16: icons/tango_icons_viewers.12x12.bmp -viewers iconset.132x80x16: icons/tango_icons_viewers.12x12.bmp -viewers iconset.160x128x16: icons/tango_icons_viewers.12x12.bmp -viewers iconset.176x132x16: icons/tango_icons_viewers.12x12.bmp -viewers iconset.176x220x16: icons/tango_icons_viewers.12x12.bmp -viewers iconset.220x176x16: icons/tango_icons_viewers.12x12.bmp -viewers iconset.240x320x16: icons/tango_icons_viewers.16x16.bmp -viewers iconset.240x400x16: icons/tango_icons_viewers.16x16.bmp -viewers iconset.128x96x16: icons/tango_icons_viewers.8x8.bmp -viewers iconset.96x96x16: icons/tango_icons_viewers.8x8.bmp -viewers iconset..+x2: icons/tango_small_viewers_mono.bmp +viewers iconset.800x480x(16|24): icons/tango_icons_viewers.32x32.bmp +viewers iconset.480x800x(16|24): icons/tango_icons_viewers.32x32.bmp +viewers iconset.400x240x(16|24): icons/tango_icons_viewers.16x16.bmp +viewers iconset.320x480x(16|24): icons/tango_icons_viewers.24x24.bmp +viewers iconset.320x240x(16|24): icons/tango_icons_viewers.16x16.bmp +viewers iconset.128x128x(16|24): icons/tango_icons_viewers.12x12.bmp +viewers iconset.128x160x(16|24): icons/tango_icons_viewers.12x12.bmp +viewers iconset.132x80x(16|24): icons/tango_icons_viewers.12x12.bmp +viewers iconset.160x128x(16|24): icons/tango_icons_viewers.12x12.bmp +viewers iconset.176x132x(16|24): icons/tango_icons_viewers.12x12.bmp +viewers iconset.176x220x(16|24): icons/tango_icons_viewers.12x12.bmp +viewers iconset.220x176x(16|24): icons/tango_icons_viewers.12x12.bmp +viewers iconset.240x320x(16|24): icons/tango_icons_viewers.16x16.bmp +viewers iconset.240x400x(16|24): icons/tango_icons_viewers.16x16.bmp +viewers iconset.128x96x(16|24): icons/tango_icons_viewers.8x8.bmp +viewers iconset.96x96x(16|24): icons/tango_icons_viewers.8x8.bmp +viewers iconset..+x2: icons/tango_small_viewers_mono.bmp show icons: on statusbar: top |