lcd: Cosmetic variable renaming

Assign lcd_current_viewport to a local variable for easier typing.

Change-Id: Ib5d4283fd1c5a21c94d3bd3c2c28ce206383fb96
This commit is contained in:
Aidan MacDonald 2022-10-02 00:54:11 +01:00
parent 726673c638
commit 6acc8a81a7
8 changed files with 163 additions and 125 deletions

View file

@ -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];
}