diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/lcd-bitmap-common.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c index 80796b392b..0bae790e58 100644 --- a/firmware/drivers/lcd-bitmap-common.c +++ b/firmware/drivers/lcd-bitmap-common.c | |||
@@ -41,14 +41,18 @@ | |||
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR) | 43 | #if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR) |
44 | void lcd_gradient_fillrect(int x1, int x2, int y1, int y2, | 44 | void lcd_gradient_fillrect(int x, int y, int width, int height, |
45 | unsigned start_rgb, unsigned end_rgb) | 45 | unsigned start_rgb, unsigned end_rgb) |
46 | { | 46 | { |
47 | int old_pattern = current_vp->fg_pattern; | 47 | int old_pattern = current_vp->fg_pattern; |
48 | int step_mul, i; | 48 | int step_mul, i; |
49 | if (y2 - y1 == 0) return; | 49 | int x1, x2; |
50 | x1 = x; | ||
51 | x2 = x + width; | ||
52 | |||
53 | if (height == 0) return; | ||
50 | 54 | ||
51 | step_mul = (1 << 16) / (y2 - y1); | 55 | step_mul = (1 << 16) / height; |
52 | int h_r = RGB_UNPACK_RED(start_rgb); | 56 | int h_r = RGB_UNPACK_RED(start_rgb); |
53 | int h_g = RGB_UNPACK_GREEN(start_rgb); | 57 | int h_g = RGB_UNPACK_GREEN(start_rgb); |
54 | int h_b = RGB_UNPACK_BLUE(start_rgb); | 58 | int h_b = RGB_UNPACK_BLUE(start_rgb); |
@@ -59,7 +63,7 @@ void lcd_gradient_fillrect(int x1, int x2, int y1, int y2, | |||
59 | h_g = (h_g << 16) + (1 << 15); | 63 | h_g = (h_g << 16) + (1 << 15); |
60 | h_b = (h_b << 16) + (1 << 15); | 64 | h_b = (h_b << 16) + (1 << 15); |
61 | 65 | ||
62 | for(i = y1; i < y2; i++) { | 66 | for(i = y; i < y + height; i++) { |
63 | current_vp->fg_pattern = LCD_RGBPACK(h_r >> 16, h_g >> 16, h_b >> 16); | 67 | current_vp->fg_pattern = LCD_RGBPACK(h_r >> 16, h_g >> 16, h_b >> 16); |
64 | lcd_hline(x1, x2, i); | 68 | lcd_hline(x1, x2, i); |
65 | h_r -= rstep; | 69 | h_r -= rstep; |
@@ -108,7 +112,7 @@ static void lcd_do_gradient_line(int x1, int x2, int y, unsigned h, | |||
108 | h_g -= h * gstep; | 112 | h_g -= h * gstep; |
109 | h_b -= h * bstep; | 113 | h_b -= h * bstep; |
110 | end_rgb = LCD_RGBPACK(h_r >> 16, h_g >> 16, h_b >> 16); | 114 | end_rgb = LCD_RGBPACK(h_r >> 16, h_g >> 16, h_b >> 16); |
111 | lcd_gradient_fillrect(x1, x2, y, y + h, start_rgb, end_rgb); | 115 | lcd_gradient_fillrect(x1, y, x2 - x1, h, start_rgb, end_rgb); |
112 | } | 116 | } |
113 | 117 | ||
114 | #endif | 118 | #endif |