diff options
Diffstat (limited to 'firmware/drivers/lcd-2bit-vi.c')
-rw-r--r-- | firmware/drivers/lcd-2bit-vi.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/firmware/drivers/lcd-2bit-vi.c b/firmware/drivers/lcd-2bit-vi.c index 99bd32c77b..7de4a57577 100644 --- a/firmware/drivers/lcd-2bit-vi.c +++ b/firmware/drivers/lcd-2bit-vi.c @@ -413,6 +413,7 @@ void LCDFN(clear_viewport)(void) /* Draw a horizontal line (optimised) */ void LCDFN(hline)(int x1, int x2, int y) { + struct viewport *vp = CURRENT_VP; int width; FBFN(data) *dst, *dst_end; unsigned mask; @@ -423,7 +424,7 @@ void LCDFN(hline)(int x1, int x2, int y) width = x2 - x1 + 1; - bfunc = LCDFN(blockfuncs)[CURRENT_VP->drawmode]; + bfunc = LCDFN(blockfuncs)[vp->drawmode]; dst = LCDFB(x1,y>>3); mask = 0x0101 << (y & 7); @@ -436,6 +437,7 @@ void LCDFN(hline)(int x1, int x2, int y) /* Draw a vertical line (optimised) */ void LCDFN(vline)(int x, int y1, int y2) { + struct viewport *vp = CURRENT_VP; int ny; FBFN(data) *dst; int stride_dst; @@ -445,9 +447,9 @@ void LCDFN(vline)(int x, int y1, int y2) if (!LCDFN(clip_viewport_vline)(&x, &y1, &y2)) return; - bfunc = LCDFN(blockfuncs)[CURRENT_VP->drawmode]; + bfunc = LCDFN(blockfuncs)[vp->drawmode]; dst = LCDFB(x,y1>>3); - stride_dst = CURRENT_VP->buffer->stride; + stride_dst = vp->buffer->stride; ny = y2 - (y1 & ~7); mask = (0xFFu << (y1 & 7)) & 0xFFu; mask |= mask << 8; @@ -467,6 +469,7 @@ void LCDFN(vline)(int x, int y1, int y2) /* Fill a rectangular area */ void LCDFN(fillrect)(int x, int y, int width, int height) { + struct viewport *vp = CURRENT_VP; int ny; FBFN(data) *dst, *dst_end; int stride_dst; @@ -478,9 +481,9 @@ void LCDFN(fillrect)(int x, int y, int width, int height) if (!LCDFN(clip_viewport_rect)(&x, &y, &width, &height, NULL, NULL)) return; - if (CURRENT_VP->drawmode & DRMODE_INVERSEVID) + if (vp->drawmode & DRMODE_INVERSEVID) { - if ((CURRENT_VP->drawmode & DRMODE_BG) && !backdrop) + if ((vp->drawmode & DRMODE_BG) && !backdrop) { fillopt = true; bits = bg_pattern; @@ -488,15 +491,15 @@ void LCDFN(fillrect)(int x, int y, int width, int height) } else { - if (CURRENT_VP->drawmode & DRMODE_FG) + if (vp->drawmode & DRMODE_FG) { fillopt = true; bits = fg_pattern; } } - bfunc = LCDFN(blockfuncs)[CURRENT_VP->drawmode]; + bfunc = LCDFN(blockfuncs)[vp->drawmode]; dst = LCDFB(x,y>>3); - stride_dst = CURRENT_VP->buffer->stride; + stride_dst = vp->buffer->stride; ny = height - 1 + (y & 7); mask = (0xFFu << (y & 7)) & 0xFFu; mask |= mask << 8; @@ -549,6 +552,7 @@ void ICODE_ATTR LCDFN(mono_bitmap_part)(const unsigned char *src, int src_x, int src_y, int stride, int x, int y, int width, int height) { + struct viewport *vp = CURRENT_VP; int shift, ny; FBFN(data) *dst, *dst_end; int stride_dst; @@ -562,11 +566,11 @@ void ICODE_ATTR LCDFN(mono_bitmap_part)(const unsigned char *src, int src_x, src_y &= 7; y -= src_y; dst = LCDFB(x,y>>3); - stride_dst = CURRENT_VP->buffer->stride; + stride_dst = vp->buffer->stride; shift = y & 7; ny = height - 1 + shift + src_y; - bfunc = LCDFN(blockfuncs)[CURRENT_VP->drawmode]; + bfunc = LCDFN(blockfuncs)[vp->drawmode]; mask = 0xFFu << (shift + src_y); /* not byte-doubled here because shift+src_y can be > 7 */ mask_bottom = 0xFFu >> (~ny & 7); @@ -670,6 +674,7 @@ void ICODE_ATTR LCDFN(bitmap_part)(const FBFN(data) *src, int src_x, int src_y, int stride, int x, int y, int width, int height) { + struct viewport *vp = CURRENT_VP; int shift, ny; FBFN(data) *dst, *dst_end; int stride_dst; @@ -682,7 +687,7 @@ void ICODE_ATTR LCDFN(bitmap_part)(const FBFN(data) *src, int src_x, src_y &= 7; y -= src_y; dst = LCDFB(x,y>>3); - stride_dst = CURRENT_VP->buffer->stride; + stride_dst = vp->buffer->stride; shift = y & 7; ny = height - 1 + shift + src_y; |