summaryrefslogtreecommitdiffstats
path: root/firmware/drivers/lcd-16bit-vert.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd-16bit-vert.c')
-rw-r--r--firmware/drivers/lcd-16bit-vert.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/firmware/drivers/lcd-16bit-vert.c b/firmware/drivers/lcd-16bit-vert.c
index c721ef6302..1c0d441af4 100644
--- a/firmware/drivers/lcd-16bit-vert.c
+++ b/firmware/drivers/lcd-16bit-vert.c
@@ -62,16 +62,17 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image,
/* Draw a horizontal line (optimised) */
void lcd_hline(int x1, int x2, int y)
{
+ struct viewport *vp = lcd_current_viewport;
fb_data *dst, *dst_end;
int stride_dst;
- lcd_fastpixelfunc_type *pfunc = lcd_fastpixelfuncs[lcd_current_viewport->drawmode];
+ lcd_fastpixelfunc_type *pfunc = lcd_fastpixelfuncs[vp->drawmode];
if (!lcd_clip_viewport_hline(&x1, &x2, &y))
return;
dst = FBADDR(x1, y);
- stride_dst = lcd_current_viewport->buffer->stride;
+ stride_dst = vp->buffer->stride;
dst_end = dst + (x2 - x1) * stride_dst;
do
@@ -85,6 +86,7 @@ void lcd_hline(int x1, int x2, int y)
/* Draw a vertical line (optimised) */
void lcd_vline(int x, int y1, int y2)
{
+ struct viewport *vp = lcd_current_viewport;
int height;
unsigned bits = 0;
enum fill_opt fillopt = OPT_NONE;
@@ -96,14 +98,14 @@ void lcd_vline(int x, int y1, int y2)
height = y2 - y1 + 1;
/* drawmode and optimisation */
- if (lcd_current_viewport->drawmode & DRMODE_INVERSEVID)
+ if (vp->drawmode & DRMODE_INVERSEVID)
{
- if (lcd_current_viewport->drawmode & DRMODE_BG)
+ if (vp->drawmode & DRMODE_BG)
{
if (!lcd_backdrop)
{
fillopt = OPT_SET;
- bits = lcd_current_viewport->bg_pattern;
+ bits = vp->bg_pattern;
}
else
fillopt = OPT_COPY;
@@ -111,13 +113,13 @@ void lcd_vline(int x, int y1, int y2)
}
else
{
- if (lcd_current_viewport->drawmode & DRMODE_FG)
+ if (vp->drawmode & DRMODE_FG)
{
fillopt = OPT_SET;
- bits = lcd_current_viewport->fg_pattern;
+ bits = vp->fg_pattern;
}
}
- if (fillopt == OPT_NONE && lcd_current_viewport->drawmode != DRMODE_COMPLEMENT)
+ if (fillopt == OPT_NONE && vp->drawmode != DRMODE_COMPLEMENT)
return;
dst = FBADDR(x, y1);
@@ -147,6 +149,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
int stride, int x, int y, int width,
int height)
{
+ struct viewport *vp = lcd_current_viewport;
fb_data *dst;
int stride_dst;
@@ -155,7 +158,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
src += stride * src_x + src_y; /* move starting point */
dst = FBADDR(x, y);
- stride_dst = lcd_current_viewport->buffer->stride;
+ stride_dst = vp->buffer->stride;
fb_data *dst_end = dst + width * stride_dst;
do
@@ -172,6 +175,7 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
int src_y, int stride, int x,
int y, int width, int height)
{
+ struct viewport *vp = lcd_current_viewport;
fb_data *dst, *dst_end;
int stride_dst;
@@ -180,7 +184,7 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
src += stride * src_x + src_y; /* move starting point */
dst = FBADDR(x, y);
- stride_dst = lcd_current_viewport->buffer->stride;
+ stride_dst = vp->buffer->stride;
dst_end = dst + width * stride_dst;
do
@@ -189,7 +193,7 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
for(i = 0;i < height;i++)
{
if (src[i] == REPLACEWITHFG_COLOR)
- dst[i] = lcd_current_viewport->fg_pattern;
+ dst[i] = vp->fg_pattern;
else if(src[i] != TRANSPARENT_COLOR)
dst[i] = src[i];
}