diff options
-rw-r--r-- | apps/gui/list.c | 8 | ||||
-rw-r--r-- | firmware/drivers/lcd-16bit.c | 27 | ||||
-rw-r--r-- | firmware/export/lcd.h | 4 |
3 files changed, 21 insertions, 18 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c index 467bebddd5..86ef97cf4d 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -310,7 +310,7 @@ static void gui_list_draw_smart(struct gui_list *gui_list) | |||
310 | } | 310 | } |
311 | 311 | ||
312 | #ifdef HAVE_LCD_COLOR | 312 | #ifdef HAVE_LCD_COLOR |
313 | unsigned char cur_line = 1; | 313 | unsigned char cur_line = 0; |
314 | #endif | 314 | #endif |
315 | for (i = start; i < end; i++) | 315 | for (i = start; i < end; i++) |
316 | { | 316 | { |
@@ -379,9 +379,9 @@ static void gui_list_draw_smart(struct gui_list *gui_list) | |||
379 | 379 | ||
380 | /* Make the lcd driver know how many lines the gradient should | 380 | /* Make the lcd driver know how many lines the gradient should |
381 | cover and current line number */ | 381 | cover and current line number */ |
382 | /* max line number*/ | 382 | /* number of selected lines */ |
383 | style |= MAXLN_PACK(gui_list->selected_size); | 383 | style |= NUMLN_PACK(gui_list->selected_size); |
384 | /* current line number */ | 384 | /* current line number, zero based */ |
385 | style |= CURLN_PACK(cur_line); | 385 | style |= CURLN_PACK(cur_line); |
386 | cur_line++; | 386 | cur_line++; |
387 | } | 387 | } |
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index ffa673887e..b990f556d3 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c | |||
@@ -553,11 +553,14 @@ void lcd_gradient_rect(int x1, int x2, int y, int h) | |||
553 | #define H_COLOR(lss, lse, cur_line, max_line) \ | 553 | #define H_COLOR(lss, lse, cur_line, max_line) \ |
554 | (((lse) - (lss)) * (cur_line) / (max_line) + (lss)) | 554 | (((lse) - (lss)) * (cur_line) / (max_line) + (lss)) |
555 | 555 | ||
556 | /* Fill a rectangle with a gradient for scrolling line */ | 556 | /* Fill a rectangle with a gradient for scrolling line. To draw a gradient that |
557 | covers several lines, we need to know how many lines will be covered | ||
558 | (the num_lines arg), and which one is the current line within the selection | ||
559 | (the cur_line arg). */ | ||
557 | void lcd_gradient_rect_scroll(int x1, int x2, int y, int h, | 560 | void lcd_gradient_rect_scroll(int x1, int x2, int y, int h, |
558 | unsigned char max_line, unsigned char cur_line) | 561 | unsigned char num_lines, unsigned char cur_line) |
559 | { | 562 | { |
560 | if (h == 0 || max_line == 0) return; | 563 | if (h == 0 || num_lines == 0) return; |
561 | 564 | ||
562 | unsigned tmp_lss = lss_pattern; | 565 | unsigned tmp_lss = lss_pattern; |
563 | unsigned tmp_lse = lse_pattern; | 566 | unsigned tmp_lse = lse_pattern; |
@@ -568,14 +571,14 @@ void lcd_gradient_rect_scroll(int x1, int x2, int y, int h, | |||
568 | int lse_b = (signed)RGB_UNPACK_BLUE(lse_pattern); | 571 | int lse_b = (signed)RGB_UNPACK_BLUE(lse_pattern); |
569 | int lse_g = (signed)RGB_UNPACK_GREEN(lse_pattern); | 572 | int lse_g = (signed)RGB_UNPACK_GREEN(lse_pattern); |
570 | 573 | ||
571 | int h_r = H_COLOR(lss_r, lse_r, cur_line - 1, max_line); | 574 | int h_r = H_COLOR(lss_r, lse_r, cur_line, num_lines); |
572 | int h_g = H_COLOR(lss_g, lse_g, cur_line - 1, max_line); | 575 | int h_g = H_COLOR(lss_g, lse_g, cur_line, num_lines); |
573 | int h_b = H_COLOR(lss_b, lse_b, cur_line - 1, max_line); | 576 | int h_b = H_COLOR(lss_b, lse_b, cur_line, num_lines); |
574 | lcd_set_selector_start(LCD_RGBPACK(h_r, h_g, h_b)); | 577 | lcd_set_selector_start(LCD_RGBPACK(h_r, h_g, h_b)); |
575 | 578 | ||
576 | int l_r = H_COLOR(lss_r, lse_r, cur_line, max_line); | 579 | int l_r = H_COLOR(lss_r, lse_r, cur_line+1, num_lines); |
577 | int l_g = H_COLOR(lss_g, lse_g, cur_line, max_line); | 580 | int l_g = H_COLOR(lss_g, lse_g, cur_line+1, num_lines); |
578 | int l_b = H_COLOR(lss_b, lse_b, cur_line, max_line); | 581 | int l_b = H_COLOR(lss_b, lse_b, cur_line+1, num_lines); |
579 | lcd_set_selector_end(LCD_RGBPACK(l_r, l_g, l_b)); | 582 | lcd_set_selector_end(LCD_RGBPACK(l_r, l_g, l_b)); |
580 | 583 | ||
581 | lcd_gradient_rect(x1, x2, y, h); | 584 | lcd_gradient_rect(x1, x2, y, h); |
@@ -898,8 +901,8 @@ void lcd_puts_style_offset(int x, int y, const unsigned char *str, int style, | |||
898 | 901 | ||
899 | if (style & STYLE_GRADIENT) { | 902 | if (style & STYLE_GRADIENT) { |
900 | drawmode = DRMODE_FG; | 903 | drawmode = DRMODE_FG; |
901 | if (CURLN_UNPACK(style) == 1) | 904 | if (CURLN_UNPACK(style) == 0) |
902 | lcd_gradient_rect(xpos, LCD_WIDTH, ypos, h*MAXLN_UNPACK(style)); | 905 | lcd_gradient_rect(xpos, LCD_WIDTH, ypos, h*NUMLN_UNPACK(style)); |
903 | fg_pattern = lst_pattern; | 906 | fg_pattern = lst_pattern; |
904 | } | 907 | } |
905 | else if (style & STYLE_COLORBAR) { | 908 | else if (style & STYLE_COLORBAR) { |
@@ -1067,7 +1070,7 @@ void lcd_scroll_fn(void) | |||
1067 | /* Gradient line selector */ | 1070 | /* Gradient line selector */ |
1068 | drawmode = DRMODE_FG; | 1071 | drawmode = DRMODE_FG; |
1069 | lcd_gradient_rect_scroll(xpos, LCD_WIDTH, ypos, (signed)pf->height, | 1072 | lcd_gradient_rect_scroll(xpos, LCD_WIDTH, ypos, (signed)pf->height, |
1070 | MAXLN_UNPACK(s->style), | 1073 | NUMLN_UNPACK(s->style), |
1071 | CURLN_UNPACK(s->style)); | 1074 | CURLN_UNPACK(s->style)); |
1072 | fg_pattern = lst_pattern; | 1075 | fg_pattern = lst_pattern; |
1073 | break; | 1076 | break; |
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 056186d5b6..de03222441 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h | |||
@@ -36,8 +36,8 @@ | |||
36 | #define STYLE_MAXLN_MASK 0x000000FF | 36 | #define STYLE_MAXLN_MASK 0x000000FF |
37 | #define CURLN_PACK(x) (((x)<<8) & STYLE_CURLN_MASK) | 37 | #define CURLN_PACK(x) (((x)<<8) & STYLE_CURLN_MASK) |
38 | #define CURLN_UNPACK(x) ((unsigned char)(((x)&STYLE_CURLN_MASK) >> 8)) | 38 | #define CURLN_UNPACK(x) ((unsigned char)(((x)&STYLE_CURLN_MASK) >> 8)) |
39 | #define MAXLN_PACK(x) ((x) & STYLE_MAXLN_MASK) | 39 | #define NUMLN_PACK(x) ((x) & STYLE_MAXLN_MASK) |
40 | #define MAXLN_UNPACK(x) ((unsigned char)((x) & STYLE_MAXLN_MASK)) | 40 | #define NUMLN_UNPACK(x) ((unsigned char)((x) & STYLE_MAXLN_MASK)) |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #ifdef SIMULATOR | 43 | #ifdef SIMULATOR |