1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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