summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-12-06 17:09:24 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-12-06 17:09:24 +0000
commit485bbbdb309f0c343b5d37eb99a453de8116281a (patch)
treead92203389d73f51ac504f0f899c7ebddbb1257d /firmware/drivers
parent307b8f1b95e59b06821b1ebf3aa0e411fbf1ec24 (diff)
downloadrockbox-485bbbdb309f0c343b5d37eb99a453de8116281a.tar.gz
rockbox-485bbbdb309f0c343b5d37eb99a453de8116281a.zip
Make the "current line" value in the gradient style code zero-based, and an attempt at more understandable names and better comments.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15886 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/lcd-16bit.c27
1 files changed, 15 insertions, 12 deletions
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). */
557void lcd_gradient_rect_scroll(int x1, int x2, int y, int h, 560void 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;