Index: apps/gui/list.c =================================================================== --- apps/gui/list.c (revision 15044) +++ apps/gui/list.c (working copy) @@ -345,6 +345,9 @@ static void gui_list_draw_smart(struct g end++; } +#ifdef HAVE_LCD_COLOR + unsigned char nr_line = 0; +#endif for (i = start; i < end; i++) { unsigned char *s; @@ -411,9 +414,14 @@ static void gui_list_draw_smart(struct g style = STYLE_GRADIENT; /* Make the lcd driver know how many lines the gradient should - cover and only draw it for the first selected item. */ - if (current_item == gui_list->selected_item) - style |= gui_list->selected_size & STYLE_COLOR_MASK; + cover and current line number */ + if (gui_list->selected_size > 1) { + /* max line number */ + style |= gui_list->selected_size & 0xff; + /* current line number */ + style |= (nr_line<<8) & 0xff00; + nr_line++; + } } #endif else /* if (!global_settings.cursor_style) */ Index: firmware/drivers/lcd-16bit.c =================================================================== --- firmware/drivers/lcd-16bit.c (revision 15044) +++ firmware/drivers/lcd-16bit.c (working copy) @@ -549,6 +549,39 @@ void lcd_gradient_rect(int x1, int x2, i } } +#define h_color(lss, lse, nr_line, max_line) \ + ((((lse) - (lss)) * (nr_line) / (max_line) + (lss)) << 16) + +/* Fill a rectangle multiline with a gradient */ +void lcd_gradient_rect_multi(int x1, int x2, int y, int h, + unsigned char max_line, unsigned char nr_line) +{ + if (h == 0) return; + + int lss_r = (signed)RGB_UNPACK_RED(lss_pattern); + int lss_b = (signed)RGB_UNPACK_BLUE(lss_pattern); + int lss_g = (signed)RGB_UNPACK_GREEN(lss_pattern); + int lse_r = (signed)RGB_UNPACK_RED(lse_pattern); + int lse_b = (signed)RGB_UNPACK_BLUE(lse_pattern); + int lse_g = (signed)RGB_UNPACK_GREEN(lse_pattern); + int h_r = h_color(lss_r, lse_r, nr_line, max_line); + int h_g = h_color(lss_g, lse_g, nr_line, max_line); + int h_b = h_color(lss_b, lse_b, nr_line, max_line); + int rstep = (h_r - h_color(lss_r, lse_r, nr_line+1, max_line)) / h; + int gstep = (h_g - h_color(lss_g, lse_g, nr_line+1, max_line)) / h; + int bstep = (h_b - h_color(lss_b, lse_b, nr_line+1, max_line)) / h; + int count; + + fg_pattern = LCD_RGBPACK(h_r >> 16, h_g >> 16, h_b >> 16); + for(count = 0; count < h; count++) { + lcd_hline(x1, x2, y + count); + h_r -= rstep; + h_g -= gstep; + h_b -= bstep; + fg_pattern = LCD_RGBPACK(h_r >> 16, h_g >> 16, h_b >> 16); + } +} + /* About Rockbox' internal monochrome bitmap format: * * A bitmap contains one bit for every pixel that defines if that pixel is @@ -862,8 +895,13 @@ void lcd_puts_style_offset(int x, int y, xrect = xpos + MAX(w - offset, 0); if (style & STYLE_GRADIENT) { + unsigned char max_line = (unsigned char)(style & 0xff); drawmode = DRMODE_FG; - lcd_gradient_rect(xpos, LCD_WIDTH, ypos, h*(style & STYLE_COLOR_MASK)); + if (max_line <= 1) + lcd_gradient_rect(xpos, LCD_WIDTH, ypos, h); + else + lcd_gradient_rect_multi(xpos, LCD_WIDTH, ypos, h, max_line, + (unsigned char)((style&0xff00)>>8)); fg_pattern = lst_pattern; } else if (style & STYLE_COLORBAR) { @@ -1030,7 +1068,17 @@ void lcd_scroll_fn(void) case STYLE_GRADIENT: /* Gradient line selector */ drawmode = DRMODE_FG; - lcd_gradient_rect(0, LCD_WIDTH, ypos, (signed)pf->height); + { + unsigned char max_line = (unsigned char)(s->style&0xff); + if (max_line <= 1) + lcd_gradient_rect(0, LCD_WIDTH, ypos, + (signed)pf->height); + else + lcd_gradient_rect_multi(0, LCD_WIDTH, ypos, + (signed)pf->height, + max_line, + (unsigned char)((s->style&0xff00)>>8)); + } fg_pattern = lst_pattern; break; default: