diff options
Diffstat (limited to 'firmware/drivers/lcd-16bit.c')
-rw-r--r-- | firmware/drivers/lcd-16bit.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index fd032c0956..f802a1bfbb 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c | |||
@@ -62,6 +62,7 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
62 | /* Draw a horizontal line (optimised) */ | 62 | /* Draw a horizontal line (optimised) */ |
63 | void lcd_hline(int x1, int x2, int y) | 63 | void lcd_hline(int x1, int x2, int y) |
64 | { | 64 | { |
65 | struct viewport *vp = lcd_current_viewport; | ||
65 | int width; | 66 | int width; |
66 | unsigned bits = 0; | 67 | unsigned bits = 0; |
67 | enum fill_opt fillopt = OPT_NONE; | 68 | enum fill_opt fillopt = OPT_NONE; |
@@ -73,14 +74,14 @@ void lcd_hline(int x1, int x2, int y) | |||
73 | width = x2 - x1 + 1; | 74 | width = x2 - x1 + 1; |
74 | 75 | ||
75 | /* drawmode and optimisation */ | 76 | /* drawmode and optimisation */ |
76 | if (lcd_current_viewport->drawmode & DRMODE_INVERSEVID) | 77 | if (vp->drawmode & DRMODE_INVERSEVID) |
77 | { | 78 | { |
78 | if (lcd_current_viewport->drawmode & DRMODE_BG) | 79 | if (vp->drawmode & DRMODE_BG) |
79 | { | 80 | { |
80 | if (!lcd_backdrop) | 81 | if (!lcd_backdrop) |
81 | { | 82 | { |
82 | fillopt = OPT_SET; | 83 | fillopt = OPT_SET; |
83 | bits = lcd_current_viewport->bg_pattern; | 84 | bits = vp->bg_pattern; |
84 | } | 85 | } |
85 | else | 86 | else |
86 | fillopt = OPT_COPY; | 87 | fillopt = OPT_COPY; |
@@ -88,13 +89,13 @@ void lcd_hline(int x1, int x2, int y) | |||
88 | } | 89 | } |
89 | else | 90 | else |
90 | { | 91 | { |
91 | if (lcd_current_viewport->drawmode & DRMODE_FG) | 92 | if (vp->drawmode & DRMODE_FG) |
92 | { | 93 | { |
93 | fillopt = OPT_SET; | 94 | fillopt = OPT_SET; |
94 | bits = lcd_current_viewport->fg_pattern; | 95 | bits = vp->fg_pattern; |
95 | } | 96 | } |
96 | } | 97 | } |
97 | if (fillopt == OPT_NONE && lcd_current_viewport->drawmode != DRMODE_COMPLEMENT) | 98 | if (fillopt == OPT_NONE && vp->drawmode != DRMODE_COMPLEMENT) |
98 | return; | 99 | return; |
99 | 100 | ||
100 | dst = FBADDR(x1, y); | 101 | dst = FBADDR(x1, y); |
@@ -122,15 +123,16 @@ void lcd_hline(int x1, int x2, int y) | |||
122 | /* Draw a vertical line (optimised) */ | 123 | /* Draw a vertical line (optimised) */ |
123 | void lcd_vline(int x, int y1, int y2) | 124 | void lcd_vline(int x, int y1, int y2) |
124 | { | 125 | { |
126 | struct viewport *vp = lcd_current_viewport; | ||
125 | fb_data *dst, *dst_end; | 127 | fb_data *dst, *dst_end; |
126 | int stride_dst; | 128 | int stride_dst; |
127 | lcd_fastpixelfunc_type *pfunc = lcd_fastpixelfuncs[lcd_current_viewport->drawmode]; | 129 | lcd_fastpixelfunc_type *pfunc = lcd_fastpixelfuncs[vp->drawmode]; |
128 | 130 | ||
129 | if (!lcd_clip_viewport_vline(&x, &y1, &y2)) | 131 | if (!lcd_clip_viewport_vline(&x, &y1, &y2)) |
130 | return; | 132 | return; |
131 | 133 | ||
132 | dst = FBADDR(x, y1); | 134 | dst = FBADDR(x, y1); |
133 | stride_dst = lcd_current_viewport->buffer->stride; | 135 | stride_dst = vp->buffer->stride; |
134 | dst_end = dst + (y2 - y1) * stride_dst; | 136 | dst_end = dst + (y2 - y1) * stride_dst; |
135 | 137 | ||
136 | do | 138 | do |
@@ -146,6 +148,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
146 | int stride, int x, int y, int width, | 148 | int stride, int x, int y, int width, |
147 | int height) | 149 | int height) |
148 | { | 150 | { |
151 | struct viewport *vp = lcd_current_viewport; | ||
149 | fb_data *dst; | 152 | fb_data *dst; |
150 | int stride_dst; | 153 | int stride_dst; |
151 | 154 | ||
@@ -154,7 +157,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
154 | 157 | ||
155 | src += stride * src_y + src_x; /* move starting point */ | 158 | src += stride * src_y + src_x; /* move starting point */ |
156 | dst = FBADDR(x, y); | 159 | dst = FBADDR(x, y); |
157 | stride_dst = lcd_current_viewport->buffer->stride; | 160 | stride_dst = vp->buffer->stride; |
158 | 161 | ||
159 | do | 162 | do |
160 | { | 163 | { |
@@ -170,9 +173,10 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, | |||
170 | int src_y, int stride, int x, | 173 | int src_y, int stride, int x, |
171 | int y, int width, int height) | 174 | int y, int width, int height) |
172 | { | 175 | { |
176 | struct viewport *vp = lcd_current_viewport; | ||
173 | fb_data *dst; | 177 | fb_data *dst; |
174 | unsigned fg = lcd_current_viewport->fg_pattern; | 178 | unsigned fg = vp->fg_pattern; |
175 | int stride_dst = lcd_current_viewport->buffer->stride; | 179 | int stride_dst = vp->buffer->stride; |
176 | 180 | ||
177 | if (!lcd_clip_viewport_rect(&x, &y, &width, &height, &src_x, &src_y)) | 181 | if (!lcd_clip_viewport_rect(&x, &y, &width, &height, &src_x, &src_y)) |
178 | return; | 182 | return; |