diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c
index be4f21f..3091fe3 100644
--- a/firmware/drivers/lcd-16bit.c
+++ b/firmware/drivers/lcd-16bit.c
@@ -60,6 +60,7 @@ static struct viewport default_vp =
.drawmode = DRMODE_SOLID,
.fg_pattern = LCD_DEFAULT_FG,
.bg_pattern = LCD_DEFAULT_BG,
+ .ignore_bg_image = false,
.lss_pattern = LCD_DEFAULT_BG,
.lse_pattern = LCD_DEFAULT_BG,
.lst_pattern = LCD_DEFAULT_BG,
@@ -77,6 +78,7 @@ void lcd_init(void)
scroll_init();
}
/*** Viewports ***/
+static inline void lcd_fix_functions(void);

void lcd_set_viewport(struct viewport* vp)
{
@@ -84,6 +86,7 @@ void lcd_set_viewport(struct viewport* vp)
current_vp = &default_vp;
else
current_vp = vp;
+ lcd_fix_functions();

#if defined(SIMULATOR)
/* Force the viewport to be within bounds. If this happens it should
@@ -239,19 +243,31 @@ lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[8] = {

lcd_fastpixelfunc_type* const * lcd_fastpixelfuncs = lcd_fastpixelfuncs_bgcolor;

+static inline void lcd_fix_functions(void)
+{
+ if (!lcd_backdrop || current_vp->ignore_bg_image)
+ {
+ DEBUGF("disable bg image: %p\n", current_vp);
+ lcd_fastpixelfuncs = lcd_fastpixelfuncs_bgcolor;
+ }
+ else
+ {
+ lcd_fastpixelfuncs = lcd_fastpixelfuncs_backdrop;
+ }
+}
+
void lcd_set_backdrop(fb_data* backdrop)
{
lcd_backdrop = backdrop;
if (backdrop)
{
lcd_backdrop_offset = (long)backdrop - (long)&lcd_framebuffer[0][0];
- lcd_fastpixelfuncs = lcd_fastpixelfuncs_backdrop;
}
else
{
lcd_backdrop_offset = 0;
- lcd_fastpixelfuncs = lcd_fastpixelfuncs_bgcolor;
}
+ lcd_fix_functions();
}

fb_data* lcd_get_backdrop(void)
@@ -280,7 +296,7 @@ void lcd_clear_viewport(void)
}
else
{
- if (!lcd_backdrop)
+ if (!lcd_backdrop || current_vp->ignore_bg_image)
{
do
{
@@ -479,7 +495,7 @@ void lcd_hline(int x1, int x2, int y)
{
if (current_vp->drawmode & DRMODE_BG)
{
- if (!lcd_backdrop)
+ if (!lcd_backdrop || current_vp->ignore_bg_image)
{
fillopt = OPT_SET;
bits = current_vp->bg_pattern;
@@ -654,7 +670,7 @@ void lcd_fillrect(int x, int y, int width, int height)
{
if (current_vp->drawmode & DRMODE_BG)
{
- if (!lcd_backdrop)
+ if (!lcd_backdrop || current_vp->ignore_bg_image)
{
fillopt = OPT_SET;
bits = current_vp->bg_pattern;
@@ -824,7 +840,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
break;

case DRMODE_BG:
- if (lcd_backdrop)
+ if (lcd_backdrop && !current_vp->ignore_bg_image)
{
bo = lcd_backdrop_offset;
do
@@ -867,7 +883,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,

case DRMODE_SOLID:
fg = current_vp->fg_pattern;
- if (lcd_backdrop)
+ if (lcd_backdrop && !current_vp->ignore_bg_image)
{
bo = lcd_backdrop_offset;
do