lcd: Move grayscale clear_viewport() to lcd-bitmap-common.c

All grayscale LCDs have the same clear_viewport() implementation.

Change-Id: I087ac3be824c97a1f42857b4e2fedb0675d453fa
This commit is contained in:
Aidan MacDonald 2022-10-02 01:32:16 +01:00
parent f737e5025d
commit 44b9785465
5 changed files with 28 additions and 109 deletions

View file

@ -206,34 +206,6 @@ void LCDFN(clear_display)(void)
LCDFN(scroll_info).lines = 0;
}
/* Clear the current viewport */
void LCDFN(clear_viewport)(void)
{
int oldmode;
if (CURRENT_VP == &default_vp &&
default_vp.buffer == &LCDFN(framebuffer_default))
{
LCDFN(clear_display)();
}
else
{
oldmode = CURRENT_VP->drawmode;
/* Invert the INVERSEVID bit and set basic mode to SOLID */
CURRENT_VP->drawmode = (~CURRENT_VP->drawmode & DRMODE_INVERSEVID) |
DRMODE_SOLID;
LCDFN(fillrect)(0, 0, CURRENT_VP->width, CURRENT_VP->height);
CURRENT_VP->drawmode = oldmode;
LCDFN(scroll_stop_viewport)(CURRENT_VP);
}
CURRENT_VP->flags &= ~(VP_FLAG_VP_SET_CLEAN);
}
/* Draw a horizontal line (optimised) */
void LCDFN(hline)(int x1, int x2, int y)
{

View file

@ -348,33 +348,6 @@ void lcd_clear_display(void)
lcd_scroll_info.lines = 0;
}
/* Clear the current viewport */
void lcd_clear_viewport(void)
{
int lastmode;
if (lcd_current_viewport == &default_vp &&
default_vp.buffer == &lcd_framebuffer_default)
{
lcd_clear_display();
}
else
{
lastmode = lcd_current_viewport->drawmode;
/* Invert the INVERSEVID bit and set basic mode to SOLID */
lcd_current_viewport->drawmode = (~lastmode & DRMODE_INVERSEVID) |
DRMODE_SOLID;
lcd_fillrect(0, 0, lcd_current_viewport->width, lcd_current_viewport->height);
lcd_current_viewport->drawmode = lastmode;
lcd_scroll_stop_viewport(lcd_current_viewport);
}
lcd_current_viewport->flags &= ~(VP_FLAG_VP_SET_CLEAN);
}
/* Draw a horizontal line (optimised) */
void lcd_hline(int x1, int x2, int y)
{

View file

@ -350,33 +350,6 @@ void lcd_clear_display(void)
lcd_scroll_info.lines = 0;
}
/* Clear the current viewport */
void lcd_clear_viewport(void)
{
int lastmode;
if (lcd_current_viewport == &default_vp &&
default_vp.buffer == &lcd_framebuffer_default)
{
lcd_clear_display();
}
else
{
lastmode = lcd_current_viewport->drawmode;
/* Invert the INVERSEVID bit and set basic mode to SOLID */
lcd_current_viewport->drawmode = (~lastmode & DRMODE_INVERSEVID) |
DRMODE_SOLID;
lcd_fillrect(0, 0, lcd_current_viewport->width, lcd_current_viewport->height);
lcd_current_viewport->drawmode = lastmode;
lcd_scroll_stop_viewport(lcd_current_viewport);
}
lcd_current_viewport->flags &= ~(VP_FLAG_VP_SET_CLEAN);
}
/* Draw a horizontal line (optimised) */
void lcd_hline(int x1, int x2, int y)
{

View file

@ -383,33 +383,6 @@ void LCDFN(clear_display)(void)
LCDFN(scroll_info).lines = 0;
}
/* Clear the current viewport */
void LCDFN(clear_viewport)(void)
{
int lastmode;
if (CURRENT_VP == &default_vp &&
default_vp.buffer == &LCDFN(framebuffer_default))
{
LCDFN(clear_display)();
}
else
{
lastmode = CURRENT_VP->drawmode;
/* Invert the INVERSEVID bit and set basic mode to SOLID */
CURRENT_VP->drawmode = (~lastmode & DRMODE_INVERSEVID) |
DRMODE_SOLID;
LCDFN(fillrect)(0, 0, CURRENT_VP->width, CURRENT_VP->height);
CURRENT_VP->drawmode = lastmode;
LCDFN(scroll_stop_viewport)(CURRENT_VP);
}
CURRENT_VP->flags &= ~(VP_FLAG_VP_SET_CLEAN);
}
/* Draw a horizontal line (optimised) */
void LCDFN(hline)(int x1, int x2, int y)
{

View file

@ -221,6 +221,34 @@ void LCDFN(fill_viewport)(void)
LCDFN(fillrect)(0, 0, LCDFN(current_viewport)->width, LCDFN(current_viewport)->height);
}
#if LCDM(DEPTH) < 8
/*
* clear the current viewport - grayscale displays
*/
void LCDFN(clear_viewport)(void)
{
struct viewport *vp = LCDFN(current_viewport);
int oldmode;
if (vp == &default_vp && default_vp.buffer == &LCDFN(framebuffer_default))
{
LCDFN(clear_display)();
}
else
{
oldmode = vp->drawmode;
vp->drawmode &= ~DRMODE_INVERSEVID;
vp->drawmode |= DRMODE_SOLID;
LCDFN(fillrect)(0, 0, vp->width, vp->height);
vp->drawmode = oldmode;
LCDFN(scroll_stop_viewport)(vp);
}
vp->flags &= ~VP_FLAG_VP_SET_CLEAN;
}
#endif
/*** Viewports ***/
/* init_viewport Notes: When a viewport is initialized