summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-bitmap-common.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2013-04-16 23:50:43 +0200
committerThomas Martitz <kugel@rockbox.org>2014-01-07 14:13:48 +0100
commitdeb6ac3693a6fb5c47abd0c32f966f5e38b6a68a (patch)
tree08cb6563035e9aca18618548c86b10a9d39a5cbe /firmware/drivers/lcd-bitmap-common.c
parent36e469db8bb7789c89ff642b51c1471669b830f5 (diff)
downloadrockbox-deb6ac3693a6fb5c47abd0c32f966f5e38b6a68a.tar.gz
rockbox-deb6ac3693a6fb5c47abd0c32f966f5e38b6a68a.zip
lcd-16bit: Move lcd_gradient_fillrect/_part() to lcd-16bit-common.c.
Change-Id: I6b2d2ba73464610556cfd9ecec52fc62adb007c7
Diffstat (limited to 'firmware/drivers/lcd-bitmap-common.c')
-rw-r--r--firmware/drivers/lcd-bitmap-common.c70
1 files changed, 0 insertions, 70 deletions
diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c
index e37da51a1b..81decadbcb 100644
--- a/firmware/drivers/lcd-bitmap-common.c
+++ b/firmware/drivers/lcd-bitmap-common.c
@@ -40,76 +40,6 @@
40#define MAIN_LCD 40#define MAIN_LCD
41#endif 41#endif
42 42
43#if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR)
44
45/* Fill a rectangle with a gradient. This function draws only the partial
46 * gradient. It assumes the original gradient is src_height high and skips
47 * the first few rows. This is useful for drawing only the bottom half of
48 * a full gradient.
49 *
50 * height == src_height and row_skip == 0 will draw the full gradient
51 *
52 * x, y, width, height - dimensions describing the rectangle
53 * start_rgb - beginning color of the gradient
54 * end_rgb - end color of the gradient
55 * src_height - assumed original height (only height rows will be drawn)
56 * row_skip - how many rows of the original gradient to skip
57 */
58void lcd_gradient_fillrect_part(int x, int y, int width, int height,
59 unsigned start_rgb, unsigned end_rgb, int src_height, int row_skip)
60{
61 int old_pattern = current_vp->fg_pattern;
62 int step_mul, i;
63 int x1, x2;
64 x1 = x;
65 x2 = x + width;
66
67 if (height == 0) return;
68
69 step_mul = (1 << 16) / src_height;
70 int h_r = RGB_UNPACK_RED(start_rgb);
71 int h_g = RGB_UNPACK_GREEN(start_rgb);
72 int h_b = RGB_UNPACK_BLUE(start_rgb);
73 int rstep = (h_r - RGB_UNPACK_RED(end_rgb)) * step_mul;
74 int gstep = (h_g - RGB_UNPACK_GREEN(end_rgb)) * step_mul;
75 int bstep = (h_b - RGB_UNPACK_BLUE(end_rgb)) * step_mul;
76 h_r = (h_r << 16) + (1 << 15);
77 h_g = (h_g << 16) + (1 << 15);
78 h_b = (h_b << 16) + (1 << 15);
79
80 if (row_skip > 0)
81 {
82 h_r -= rstep * row_skip;
83 h_g -= gstep * row_skip;
84 h_b -= bstep * row_skip;
85 }
86
87 for(i = y; i < y + height; i++) {
88 current_vp->fg_pattern = LCD_RGBPACK(h_r >> 16, h_g >> 16, h_b >> 16);
89 lcd_hline(x1, x2, i);
90 h_r -= rstep;
91 h_g -= gstep;
92 h_b -= bstep;
93 }
94
95 current_vp->fg_pattern = old_pattern;
96}
97
98/* Fill a rectangle with a gradient. The gradient's color will fade from
99 * start_rgb to end_rgb over the height of the rectangle
100 *
101 * x, y, width, height - dimensions describing the rectangle
102 * start_rgb - beginning color of the gradient
103 * end_rgb - end color of the gradient
104 */
105void lcd_gradient_fillrect(int x, int y, int width, int height,
106 unsigned start_rgb, unsigned end_rgb)
107{
108 lcd_gradient_fillrect_part(x, y, width, height, start_rgb, end_rgb, height, 0);
109}
110
111#endif
112
113void LCDFN(set_framebuffer)(FBFN(data) *fb) 43void LCDFN(set_framebuffer)(FBFN(data) *fb)
114{ 44{
115 if (fb) 45 if (fb)