summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/SOURCES4
-rw-r--r--apps/bookmark.c4
-rw-r--r--apps/filetree.c4
-rw-r--r--apps/gui/gwps-common.c6
-rw-r--r--apps/gui/gwps.c32
-rw-r--r--apps/onplay.c8
-rw-r--r--apps/plugin.c6
-rw-r--r--apps/recorder/backdrop.c17
-rw-r--r--apps/recorder/backdrop.h9
-rw-r--r--apps/settings.c23
-rw-r--r--apps/settings.h2
-rw-r--r--apps/settings_menu.c10
-rw-r--r--apps/tree.c6
-rw-r--r--firmware/drivers/lcd-2bit-horz.c109
-rw-r--r--firmware/drivers/lcd-2bit-vert.c112
-rw-r--r--firmware/export/lcd.h10
16 files changed, 285 insertions, 77 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index ccfc7fa280..0fdb6f5955 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -57,8 +57,10 @@ recorder/icons.c
57recorder/keyboard.c 57recorder/keyboard.c
58recorder/peakmeter.c 58recorder/peakmeter.c
59recorder/widgets.c 59recorder/widgets.c
60#ifdef HAVE_LCD_COLOR 60#if LCD_DEPTH > 1
61recorder/backdrop.c 61recorder/backdrop.c
62#endif
63#ifdef HAVE_LCD_COLOR
62gui/color_picker.c 64gui/color_picker.c
63#endif 65#endif
64#endif 66#endif
diff --git a/apps/bookmark.c b/apps/bookmark.c
index cb1735f3d5..e6c6261856 100644
--- a/apps/bookmark.c
+++ b/apps/bookmark.c
@@ -51,7 +51,7 @@
51#include "splash.h" 51#include "splash.h"
52#include "yesno.h" 52#include "yesno.h"
53 53
54#ifdef HAVE_LCD_COLOR 54#if LCD_DEPTH > 1
55#include "backdrop.h" 55#include "backdrop.h"
56#endif 56#endif
57 57
@@ -218,7 +218,7 @@ bool bookmark_autobookmark(void)
218 str(LANG_RESUME_CONFIRM_PLAYER)}; 218 str(LANG_RESUME_CONFIRM_PLAYER)};
219 struct text_message message={(char **)lines, 2}; 219 struct text_message message={(char **)lines, 2};
220#endif 220#endif
221#ifdef HAVE_LCD_COLOR 221#if LCD_DEPTH > 1
222 show_main_backdrop(); /* switch to main backdrop as we may come from wps */ 222 show_main_backdrop(); /* switch to main backdrop as we may come from wps */
223#endif 223#endif
224 gui_syncstatusbar_draw(&statusbars, false); 224 gui_syncstatusbar_draw(&statusbars, false);
diff --git a/apps/filetree.c b/apps/filetree.c
index 9d5109ceb9..f10c02b449 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -54,7 +54,7 @@ static int boot_size = 0;
54static int boot_cluster; 54static int boot_cluster;
55#endif 55#endif
56 56
57#ifdef HAVE_LCD_COLOR 57#if LCD_DEPTH > 1
58#include "backdrop.h" 58#include "backdrop.h"
59#endif 59#endif
60 60
@@ -466,7 +466,7 @@ int ft_enter(struct tree_context* c)
466 /* wps config file */ 466 /* wps config file */
467 case TREE_ATTR_WPS: 467 case TREE_ATTR_WPS:
468 gui_syncsplash(0, true, str(LANG_WAIT)); 468 gui_syncsplash(0, true, str(LANG_WAIT));
469#ifdef HAVE_LCD_COLOR 469#if LCD_DEPTH > 1
470 unload_wps_backdrop(); 470 unload_wps_backdrop();
471#endif 471#endif
472 wps_data_load(gui_wps[0].data, buf, true); 472 wps_data_load(gui_wps[0].data, buf, true);
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 98f2c7e2ed..212f40f3c0 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -48,7 +48,7 @@
48#include "bmp.h" 48#include "bmp.h"
49#include "atoi.h" 49#include "atoi.h"
50#endif 50#endif
51#ifdef HAVE_LCD_COLOR 51#if LCD_DEPTH > 1
52#include "backdrop.h" 52#include "backdrop.h"
53#endif 53#endif
54#include "dsp.h" 54#include "dsp.h"
@@ -143,7 +143,7 @@ bool wps_data_preload_tags(struct wps_data *data, char *buf,
143 } 143 }
144 break; 144 break;
145 145
146#ifdef HAVE_LCD_COLOR 146#if LCD_DEPTH > 1
147 case 'X': 147 case 'X':
148 /* Backdrop image - must be the same size as the LCD */ 148 /* Backdrop image - must be the same size as the LCD */
149 { 149 {
@@ -2473,7 +2473,7 @@ bool gui_wps_display(void)
2473 if(i == 0) 2473 if(i == 0)
2474 { 2474 {
2475#ifdef HAVE_LCD_BITMAP 2475#ifdef HAVE_LCD_BITMAP
2476#ifdef HAVE_LCD_COLOR 2476#if LCD_DEPTH > 1
2477 unload_wps_backdrop(); 2477 unload_wps_backdrop();
2478#endif 2478#endif
2479 wps_data_load(gui_wps[i].data, 2479 wps_data_load(gui_wps[i].data,
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 115e9f7441..482442cb53 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -54,7 +54,7 @@
54#include "abrepeat.h" 54#include "abrepeat.h"
55#include "playback.h" 55#include "playback.h"
56#include "splash.h" 56#include "splash.h"
57#ifdef HAVE_LCD_COLOR 57#if LCD_DEPTH > 1
58#include "backdrop.h" 58#include "backdrop.h"
59#endif 59#endif
60#include "ata_idle_notify.h" 60#include "ata_idle_notify.h"
@@ -104,9 +104,9 @@ long gui_wps_show(void)
104 { 104 {
105 gui_wps_set_margin(&gui_wps[i]); 105 gui_wps_set_margin(&gui_wps[i]);
106 } 106 }
107#ifdef HAVE_LCD_COLOR 107#if LCD_DEPTH > 1
108 show_wps_backdrop(); 108 show_wps_backdrop();
109#endif /* HAVE_LCD_COLOR */ 109#endif /* LCD_DEPTH > 1 */
110#endif 110#endif
111 111
112#ifdef AB_REPEAT_ENABLE 112#ifdef AB_REPEAT_ENABLE
@@ -201,12 +201,12 @@ long gui_wps_show(void)
201 switch(button) 201 switch(button)
202 { 202 {
203 case ACTION_WPS_CONTEXT: 203 case ACTION_WPS_CONTEXT:
204#ifdef HAVE_LCD_COLOR 204#if LCD_DEPTH > 1
205 show_main_backdrop(); 205 show_main_backdrop();
206#endif 206#endif
207 action_signalscreenchange(); 207 action_signalscreenchange();
208 onplay(wps_state.id3->path, TREE_ATTR_MPA, CONTEXT_WPS); 208 onplay(wps_state.id3->path, TREE_ATTR_MPA, CONTEXT_WPS);
209#ifdef HAVE_LCD_COLOR 209#if LCD_DEPTH > 1
210 show_wps_backdrop(); 210 show_wps_backdrop();
211#endif 211#endif
212#ifdef HAVE_LCD_BITMAP 212#ifdef HAVE_LCD_BITMAP
@@ -422,13 +422,13 @@ long gui_wps_show(void)
422 FOR_NB_SCREENS(i) 422 FOR_NB_SCREENS(i)
423 gui_wps[i].display->stop_scroll(); 423 gui_wps[i].display->stop_scroll();
424 424
425#ifdef HAVE_LCD_COLOR 425#if LCD_DEPTH > 1
426 show_main_backdrop(); 426 show_main_backdrop();
427#endif 427#endif
428 action_signalscreenchange(); 428 action_signalscreenchange();
429 if (main_menu()) 429 if (main_menu())
430 return true; 430 return true;
431#ifdef HAVE_LCD_COLOR 431#if LCD_DEPTH > 1
432 show_wps_backdrop(); 432 show_wps_backdrop();
433#endif 433#endif
434#ifdef HAVE_LCD_BITMAP 434#ifdef HAVE_LCD_BITMAP
@@ -443,12 +443,12 @@ long gui_wps_show(void)
443 443
444#ifdef HAVE_QUICKSCREEN 444#ifdef HAVE_QUICKSCREEN
445 case ACTION_WPS_QUICKSCREEN: 445 case ACTION_WPS_QUICKSCREEN:
446#ifdef HAVE_LCD_COLOR 446#if LCD_DEPTH > 1
447 show_main_backdrop(); 447 show_main_backdrop();
448#endif 448#endif
449 if (quick_screen_quick(button)) 449 if (quick_screen_quick(button))
450 return SYS_USB_CONNECTED; 450 return SYS_USB_CONNECTED;
451#ifdef HAVE_LCD_COLOR 451#if LCD_DEPTH > 1
452 show_wps_backdrop(); 452 show_wps_backdrop();
453#endif 453#endif
454#ifdef HAVE_LCD_BITMAP 454#ifdef HAVE_LCD_BITMAP
@@ -464,7 +464,7 @@ long gui_wps_show(void)
464 /* screen settings */ 464 /* screen settings */
465#ifdef BUTTON_F3 465#ifdef BUTTON_F3
466 case ACTION_F3: 466 case ACTION_F3:
467#ifdef HAVE_LCD_COLOR 467#if LCD_DEPTH > 1
468 show_main_backdrop(); 468 show_main_backdrop();
469#endif 469#endif
470 if (quick_screen_f3(BUTTON_F3)) 470 if (quick_screen_f3(BUTTON_F3))
@@ -482,13 +482,13 @@ long gui_wps_show(void)
482 /* pitch screen */ 482 /* pitch screen */
483#ifdef HAVE_PITCHSCREEN 483#ifdef HAVE_PITCHSCREEN
484 case ACTION_WPS_PITCHSCREEN: 484 case ACTION_WPS_PITCHSCREEN:
485#ifdef HAVE_LCD_COLOR 485#if LCD_DEPTH > 1
486 show_main_backdrop(); 486 show_main_backdrop();
487#endif 487#endif
488 action_signalscreenchange(); 488 action_signalscreenchange();
489 if (1 == pitch_screen()) 489 if (1 == pitch_screen())
490 return SYS_USB_CONNECTED; 490 return SYS_USB_CONNECTED;
491#ifdef HAVE_LCD_COLOR 491#if LCD_DEPTH > 1
492 show_wps_backdrop(); 492 show_wps_backdrop();
493#endif 493#endif
494 restore = true; 494 restore = true;
@@ -533,11 +533,11 @@ long gui_wps_show(void)
533 break; 533 break;
534 534
535 case ACTION_WPS_ID3SCREEN: 535 case ACTION_WPS_ID3SCREEN:
536#ifdef HAVE_LCD_COLOR 536#if LCD_DEPTH > 1
537 show_main_backdrop(); 537 show_main_backdrop();
538#endif 538#endif
539 browse_id3(); 539 browse_id3();
540#ifdef HAVE_LCD_COLOR 540#if LCD_DEPTH > 1
541 show_wps_backdrop(); 541 show_wps_backdrop();
542#endif 542#endif
543#ifdef HAVE_LCD_BITMAP 543#ifdef HAVE_LCD_BITMAP
@@ -559,7 +559,7 @@ long gui_wps_show(void)
559 559
560 case SYS_POWEROFF: 560 case SYS_POWEROFF:
561 bookmark_autobookmark(); 561 bookmark_autobookmark();
562#ifdef HAVE_LCD_COLOR 562#if LCD_DEPTH > 1
563 show_main_backdrop(); 563 show_main_backdrop();
564#endif 564#endif
565 default_event_handler(SYS_POWEROFF); 565 default_event_handler(SYS_POWEROFF);
@@ -868,7 +868,7 @@ void gui_sync_wps_init(void)
868 gui_wps_set_data(&gui_wps[i], &wps_datas[i]); 868 gui_wps_set_data(&gui_wps[i], &wps_datas[i]);
869 gui_wps_set_statusbar(&gui_wps[i], &statusbars.statusbars[i]); 869 gui_wps_set_statusbar(&gui_wps[i], &statusbars.statusbars[i]);
870 } 870 }
871#ifdef HAVE_LCD_COLOR 871#if LCD_DEPTH > 1
872 unload_wps_backdrop(); 872 unload_wps_backdrop();
873#endif 873#endif
874} 874}
diff --git a/apps/onplay.c b/apps/onplay.c
index 60a737938f..59fa8caa85 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -50,7 +50,7 @@
50#include "action.h" 50#include "action.h"
51#include "splash.h" 51#include "splash.h"
52#include "yesno.h" 52#include "yesno.h"
53#ifdef HAVE_LCD_COLOR 53#if LCD_DEPTH > 1
54#include "backdrop.h" 54#include "backdrop.h"
55#endif 55#endif
56#ifdef HAVE_LCD_BITMAP 56#ifdef HAVE_LCD_BITMAP
@@ -493,7 +493,7 @@ static bool delete_dir(void)
493 return delete_handler(true); 493 return delete_handler(true);
494} 494}
495 495
496#ifdef HAVE_LCD_COLOR 496#if LCD_DEPTH > 1
497static bool set_backdrop(void) 497static bool set_backdrop(void)
498{ 498{
499 /* load the image */ 499 /* load the image */
@@ -837,7 +837,7 @@ int onplay(char* file, int attr, int from)
837 struct menu_item items[12]; 837 struct menu_item items[12];
838#endif 838#endif
839 int m, i=0, result; 839 int m, i=0, result;
840#ifdef HAVE_LCD_COLOR 840#if LCD_DEPTH > 1
841 char *suffix; 841 char *suffix;
842#endif 842#endif
843 843
@@ -920,7 +920,7 @@ int onplay(char* file, int attr, int from)
920 items[i].function = delete_file; 920 items[i].function = delete_file;
921 i++; 921 i++;
922 922
923#ifdef HAVE_LCD_COLOR 923#if LCD_DEPTH > 1
924 suffix = strrchr(file, '.'); 924 suffix = strrchr(file, '.');
925 if (suffix) 925 if (suffix)
926 { 926 {
diff --git a/apps/plugin.c b/apps/plugin.c
index 0d9635b88e..4827476545 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -485,7 +485,7 @@ int plugin_load(const char* plugin, void* parameter)
485#ifdef HAVE_REMOTE_LCD 485#ifdef HAVE_REMOTE_LCD
486 int rxm, rym; 486 int rxm, rym;
487#endif 487#endif
488#ifdef HAVE_LCD_COLOR 488#if LCD_DEPTH > 1
489 fb_data* old_backdrop; 489 fb_data* old_backdrop;
490#endif 490#endif
491 491
@@ -567,7 +567,7 @@ int plugin_load(const char* plugin, void* parameter)
567 xm = lcd_getxmargin(); 567 xm = lcd_getxmargin();
568 ym = lcd_getymargin(); 568 ym = lcd_getymargin();
569 lcd_setmargins(0,0); 569 lcd_setmargins(0,0);
570#ifdef HAVE_LCD_COLOR 570#if LCD_DEPTH > 1
571 old_backdrop = lcd_get_backdrop(); 571 old_backdrop = lcd_get_backdrop();
572 lcd_set_backdrop(NULL); 572 lcd_set_backdrop(NULL);
573#endif 573#endif
@@ -594,8 +594,8 @@ int plugin_load(const char* plugin, void* parameter)
594 594
595#ifdef HAVE_LCD_BITMAP 595#ifdef HAVE_LCD_BITMAP
596#if LCD_DEPTH > 1 596#if LCD_DEPTH > 1
597#ifdef HAVE_LCD_COLOR
598 lcd_set_backdrop(old_backdrop); 597 lcd_set_backdrop(old_backdrop);
598#ifdef HAVE_LCD_COLOR
599 lcd_set_drawinfo(DRMODE_SOLID, global_settings.fg_color, 599 lcd_set_drawinfo(DRMODE_SOLID, global_settings.fg_color,
600 global_settings.bg_color); 600 global_settings.bg_color);
601#else 601#else
diff --git a/apps/recorder/backdrop.c b/apps/recorder/backdrop.c
index 374dba9f4b..7779792621 100644
--- a/apps/recorder/backdrop.c
+++ b/apps/recorder/backdrop.c
@@ -21,10 +21,20 @@
21#include "config.h" 21#include "config.h"
22#include "lcd.h" 22#include "lcd.h"
23#include "backdrop.h" 23#include "backdrop.h"
24#include "splash.h" /* debugging */
25 24
25#if LCD_DEPTH >= 8
26fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH]; 26fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH];
27fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH]; 27fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH];
28#elif LCD_DEPTH == 2
29#if LCD_PIXELFORMAT == VERTICAL_PACKING
30fb_data main_backdrop[(LCD_HEIGHT+3)/4][LCD_WIDTH];
31fb_data wps_backdrop[(LCD_HEIGHT+3)/4][LCD_WIDTH];
32#else
33fb_data main_backdrop[LCD_HEIGHT][LCD_FBWIDTH];
34fb_data wps_backdrop[LCD_HEIGHT][LCD_FBWIDTH];
35#endif
36#endif
37
28bool main_backdrop_valid = false; 38bool main_backdrop_valid = false;
29bool wps_backdrop_valid = false; 39bool wps_backdrop_valid = false;
30 40
@@ -52,27 +62,23 @@ bool load_backdrop(char* filename, fb_data* backdrop_buffer)
52bool load_main_backdrop(char* filename) 62bool load_main_backdrop(char* filename)
53{ 63{
54 main_backdrop_valid = load_backdrop(filename, &main_backdrop[0][0]); 64 main_backdrop_valid = load_backdrop(filename, &main_backdrop[0][0]);
55/* gui_syncsplash(100, true, "MAIN backdrop load: %s", main_backdrop_valid ? "OK" : "FAIL");*/
56 return main_backdrop_valid; 65 return main_backdrop_valid;
57} 66}
58 67
59bool load_wps_backdrop(char* filename) 68bool load_wps_backdrop(char* filename)
60{ 69{
61 wps_backdrop_valid = load_backdrop(filename, &wps_backdrop[0][0]); 70 wps_backdrop_valid = load_backdrop(filename, &wps_backdrop[0][0]);
62/* gui_syncsplash(100, true, "WPS backdrop load: %s", main_backdrop_valid ? "OK" : "FAIL");*/
63 return wps_backdrop_valid; 71 return wps_backdrop_valid;
64} 72}
65 73
66void unload_main_backdrop(void) 74void unload_main_backdrop(void)
67{ 75{
68 main_backdrop_valid = false; 76 main_backdrop_valid = false;
69/* gui_syncsplash(100, true, "MAIN backdrop unload");*/
70} 77}
71 78
72void unload_wps_backdrop(void) 79void unload_wps_backdrop(void)
73{ 80{
74 wps_backdrop_valid = false; 81 wps_backdrop_valid = false;
75/* gui_syncsplash(100, true, "WPS backdrop unload");*/
76} 82}
77 83
78void show_main_backdrop(void) 84void show_main_backdrop(void)
@@ -89,7 +95,6 @@ void show_wps_backdrop(void)
89 } 95 }
90 else 96 else
91 { 97 {
92/* gui_syncsplash(100, true, "WPS backdrop show: fallback to MAIN");*/
93 show_main_backdrop(); 98 show_main_backdrop();
94 } 99 }
95} 100}
diff --git a/apps/recorder/backdrop.h b/apps/recorder/backdrop.h
index da515af261..93373f1321 100644
--- a/apps/recorder/backdrop.h
+++ b/apps/recorder/backdrop.h
@@ -20,15 +20,10 @@
20#ifndef _BACKDROP_H 20#ifndef _BACKDROP_H
21#define _BACKDROP_H 21#define _BACKDROP_H
22 22
23#ifdef HAVE_LCD_COLOR 23#if LCD_DEPTH > 1
24 24
25#include "lcd.h" 25#include "lcd.h"
26#include "bmp.h" 26#include "bmp.h"
27#include "backdrop.h"
28/*
29extern fb_data main_backdrop[LCD_HEIGHT][LCD_WIDTH];
30extern fb_data wps_backdrop[LCD_HEIGHT][LCD_WIDTH];
31*/
32 27
33bool load_main_backdrop(char* filename); 28bool load_main_backdrop(char* filename);
34bool load_wps_backdrop(char* filename); 29bool load_wps_backdrop(char* filename);
@@ -39,6 +34,6 @@ void unload_wps_backdrop(void);
39void show_main_backdrop(void); 34void show_main_backdrop(void);
40void show_wps_backdrop(void); 35void show_wps_backdrop(void);
41 36
42#endif /* HAVE_LCD_COLOR */ 37#endif /* LCD_DEPTH > 1 */
43 38
44#endif /* _BACKDROP_H */ 39#endif /* _BACKDROP_H */
diff --git a/apps/settings.c b/apps/settings.c
index ea7e303d1d..fc0e5248a3 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -72,7 +72,7 @@
72#include "statusbar.h" 72#include "statusbar.h"
73#include "splash.h" 73#include "splash.h"
74#include "list.h" 74#include "list.h"
75#ifdef HAVE_LCD_COLOR 75#if LCD_DEPTH > 1
76#include "backdrop.h" 76#include "backdrop.h"
77#endif 77#endif
78 78
@@ -1034,7 +1034,7 @@ int settings_save( void )
1034 i+= MAX_FILENAME; 1034 i+= MAX_FILENAME;
1035#endif 1035#endif
1036 1036
1037#ifdef HAVE_LCD_COLOR 1037#if LCD_DEPTH > 1
1038 strncpy((char *)&config_block[i], (char *)global_settings.backdrop_file, 1038 strncpy((char *)&config_block[i], (char *)global_settings.backdrop_file,
1039 MAX_FILENAME); 1039 MAX_FILENAME);
1040 i+= MAX_FILENAME; 1040 i+= MAX_FILENAME;
@@ -1198,7 +1198,7 @@ void settings_apply(void)
1198 global_settings.peak_meter_clip_hold); 1198 global_settings.peak_meter_clip_hold);
1199#endif 1199#endif
1200 1200
1201#ifdef HAVE_LCD_COLOR 1201#if LCD_DEPTH > 1
1202 unload_wps_backdrop(); 1202 unload_wps_backdrop();
1203#endif 1203#endif
1204 if ( global_settings.wps_file[0] && 1204 if ( global_settings.wps_file[0] &&
@@ -1212,7 +1212,7 @@ void settings_apply(void)
1212 wps_data_init(gui_wps[0].data); 1212 wps_data_init(gui_wps[0].data);
1213 } 1213 }
1214 1214
1215#ifdef HAVE_LCD_COLOR 1215#if LCD_DEPTH > 1
1216 if ( global_settings.backdrop_file[0] && 1216 if ( global_settings.backdrop_file[0] &&
1217 global_settings.backdrop_file[0] != 0xff ) { 1217 global_settings.backdrop_file[0] != 0xff ) {
1218 snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp", 1218 snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp",
@@ -1222,7 +1222,9 @@ void settings_apply(void)
1222 unload_main_backdrop(); 1222 unload_main_backdrop();
1223 } 1223 }
1224 show_main_backdrop(); 1224 show_main_backdrop();
1225#endif
1225 1226
1227#ifdef HAVE_LCD_COLOR
1226 screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); 1228 screens[SCREEN_MAIN].set_foreground(global_settings.fg_color);
1227 screens[SCREEN_MAIN].set_background(global_settings.bg_color); 1229 screens[SCREEN_MAIN].set_background(global_settings.bg_color);
1228#endif 1230#endif
@@ -1438,7 +1440,7 @@ void settings_load(int which)
1438 i+= MAX_FILENAME; 1440 i+= MAX_FILENAME;
1439#endif 1441#endif
1440 1442
1441#ifdef HAVE_LCD_COLOR 1443#if LCD_DEPTH > 1
1442 strncpy((char *)global_settings.backdrop_file, (char *)&config_block[i], 1444 strncpy((char *)global_settings.backdrop_file, (char *)&config_block[i],
1443 MAX_FILENAME); 1445 MAX_FILENAME);
1444 i+= MAX_FILENAME; 1446 i+= MAX_FILENAME;
@@ -1593,7 +1595,7 @@ bool settings_load_config(const char* file)
1593 1595
1594 /* check for the string values */ 1596 /* check for the string values */
1595 if (!strcasecmp(name, "wps")) { 1597 if (!strcasecmp(name, "wps")) {
1596#ifdef HAVE_LCD_COLOR 1598#if LCD_DEPTH > 1
1597 unload_wps_backdrop(); 1599 unload_wps_backdrop();
1598#endif 1600#endif
1599 int fd2; 1601 int fd2;
@@ -1629,7 +1631,7 @@ bool settings_load_config(const char* file)
1629 set_file(value, (char *)global_settings.font_file, MAX_FILENAME); 1631 set_file(value, (char *)global_settings.font_file, MAX_FILENAME);
1630 } 1632 }
1631#endif 1633#endif
1632#ifdef HAVE_LCD_COLOR 1634#if LCD_DEPTH > 1
1633 else if (!strcasecmp(name, "backdrop")) { 1635 else if (!strcasecmp(name, "backdrop")) {
1634 if (load_main_backdrop(value)) { 1636 if (load_main_backdrop(value)) {
1635 set_file(value, (char *)global_settings.backdrop_file, MAX_FILENAME); 1637 set_file(value, (char *)global_settings.backdrop_file, MAX_FILENAME);
@@ -1795,7 +1797,7 @@ bool settings_save_config(void)
1795 global_settings.font_file); 1797 global_settings.font_file);
1796#endif 1798#endif
1797 1799
1798#ifdef HAVE_LCD_COLOR 1800#if LCD_DEPTH > 1
1799 if (global_settings.backdrop_file[0] != 0) 1801 if (global_settings.backdrop_file[0] != 0)
1800 fdprintf(fd, "backdrop: %s/%s.bmp\r\n", BACKDROP_DIR, 1802 fdprintf(fd, "backdrop: %s/%s.bmp\r\n", BACKDROP_DIR,
1801 global_settings.backdrop_file); 1803 global_settings.backdrop_file);
@@ -1898,9 +1900,10 @@ void settings_reset(void) {
1898#endif 1900#endif
1899 global_settings.font_file[0] = '\0'; 1901 global_settings.font_file[0] = '\0';
1900 global_settings.lang_file[0] = '\0'; 1902 global_settings.lang_file[0] = '\0';
1901#ifdef HAVE_LCD_COLOR 1903#if LCD_DEPTH > 1
1902 global_settings.backdrop_file[0] = '\0'; 1904 global_settings.backdrop_file[0] = '\0';
1903 1905#endif
1906#ifdef HAVE_LCD_COLOR
1904 global_settings.fg_color = LCD_DEFAULT_FG; 1907 global_settings.fg_color = LCD_DEFAULT_FG;
1905 global_settings.bg_color = LCD_DEFAULT_BG; 1908 global_settings.bg_color = LCD_DEFAULT_BG;
1906#endif 1909#endif
diff --git a/apps/settings.h b/apps/settings.h
index 7b70ab748c..c0c6a943ce 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -454,7 +454,7 @@ struct user_settings
454 bool dithering_enabled; 454 bool dithering_enabled;
455#endif 455#endif
456 456
457#ifdef HAVE_LCD_COLOR 457#if LCD_DEPTH > 1
458 unsigned char backdrop_file[MAX_FILENAME+1]; /* backdrop bitmap file */ 458 unsigned char backdrop_file[MAX_FILENAME+1]; /* backdrop bitmap file */
459#endif 459#endif
460 460
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 0cbe5344fb..83f2452613 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -81,7 +81,7 @@ void dac_line_in(bool enable);
81#include "dsp.h" 81#include "dsp.h"
82#endif 82#endif
83 83
84#ifdef HAVE_LCD_COLOR 84#if LCD_DEPTH > 1
85#include "backdrop.h" 85#include "backdrop.h"
86#endif 86#endif
87 87
@@ -393,7 +393,7 @@ static bool invert_cursor(void)
393 return rc; 393 return rc;
394} 394}
395 395
396#ifdef HAVE_LCD_COLOR 396#if LCD_DEPTH > 1
397/** 397/**
398 * Menu to clear the backdrop image 398 * Menu to clear the backdrop image
399 */ 399 */
@@ -404,7 +404,9 @@ static bool clear_main_backdrop(void)
404 show_main_backdrop(); 404 show_main_backdrop();
405 return false; 405 return false;
406} 406}
407#endif
407 408
409#ifdef HAVE_LCD_COLOR
408/** 410/**
409 * Menu for fore/back colors 411 * Menu for fore/back colors
410 */ 412 */
@@ -1969,8 +1971,10 @@ static bool lcd_settings_menu(void)
1969#endif 1971#endif
1970 { ID2P(LANG_INVERT_CURSOR), invert_cursor }, 1972 { ID2P(LANG_INVERT_CURSOR), invert_cursor },
1971#endif 1973#endif
1972#ifdef HAVE_LCD_COLOR 1974#if LCD_DEPTH > 1
1973 { ID2P(LANG_CLEAR_BACKDROP), clear_main_backdrop }, 1975 { ID2P(LANG_CLEAR_BACKDROP), clear_main_backdrop },
1976#endif
1977#ifdef HAVE_LCD_COLOR
1974 { ID2P(LANG_BACKGROUND_COLOR), set_bg_color }, 1978 { ID2P(LANG_BACKGROUND_COLOR), set_bg_color },
1975 { ID2P(LANG_FOREGROUND_COLOR), set_fg_color }, 1979 { ID2P(LANG_FOREGROUND_COLOR), set_fg_color },
1976 { ID2P(LANG_RESET_COLORS), reset_color }, 1980 { ID2P(LANG_RESET_COLORS), reset_color },
diff --git a/apps/tree.c b/apps/tree.c
index 623046a4b0..fea7b21529 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -83,7 +83,7 @@
83#include "widgets.h" 83#include "widgets.h"
84#endif 84#endif
85 85
86#ifdef HAVE_LCD_COLOR 86#if LCD_DEPTH > 1
87#include "backdrop.h" 87#include "backdrop.h"
88#endif 88#endif
89 89
@@ -118,7 +118,7 @@ const struct filetype filetypes[] = {
118#ifdef HAVE_REMOTE_LCD 118#ifdef HAVE_REMOTE_LCD
119 { "rwps", TREE_ATTR_RWPS, Icon_Wps, VOICE_EXT_RWPS }, 119 { "rwps", TREE_ATTR_RWPS, Icon_Wps, VOICE_EXT_RWPS },
120#endif 120#endif
121#ifdef HAVE_LCD_COLOR 121#if LCD_DEPTH > 1
122 { "bmp", TREE_ATTR_BMP, Icon_Wps, VOICE_EXT_WPS }, 122 { "bmp", TREE_ATTR_BMP, Icon_Wps, VOICE_EXT_WPS },
123#endif 123#endif
124#ifdef CONFIG_TUNER 124#ifdef CONFIG_TUNER
@@ -966,7 +966,7 @@ static bool dirbrowse(void)
966#endif 966#endif
967 reload_dir = true; 967 reload_dir = true;
968#endif 968#endif
969#ifdef HAVE_LCD_COLOR 969#if LCD_DEPTH > 1
970 show_main_backdrop(); 970 show_main_backdrop();
971#endif 971#endif
972#ifdef HAVE_TAGCACHE 972#ifdef HAVE_TAGCACHE
diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c
index 5ca0426d12..54357433b9 100644
--- a/firmware/drivers/lcd-2bit-horz.c
+++ b/firmware/drivers/lcd-2bit-horz.c
@@ -44,6 +44,9 @@ static const unsigned char pixmask[4] ICONST_ATTR = {
44 0xC0, 0x30, 0x0C, 0x03 44 0xC0, 0x30, 0x0C, 0x03
45}; 45};
46 46
47static fb_data* lcd_backdrop = NULL;
48static long lcd_backdrop_offset IDATA_ATTR = 0;
49
47static unsigned fg_pattern IDATA_ATTR = 0xFF; /* initially black */ 50static unsigned fg_pattern IDATA_ATTR = 0xFF; /* initially black */
48static unsigned bg_pattern IDATA_ATTR = 0x00; /* initially white */ 51static unsigned bg_pattern IDATA_ATTR = 0x00; /* initially white */
49static int drawmode = DRMODE_SOLID; 52static int drawmode = DRMODE_SOLID;
@@ -164,6 +167,15 @@ static void clearpixel(int x, int y)
164 *address = data ^ ((data ^ bg_pattern) & mask); 167 *address = data ^ ((data ^ bg_pattern) & mask);
165} 168}
166 169
170static void clearimgpixel(int x, int y)
171{
172 unsigned mask = pixmask[x & 3];
173 fb_data *address = &lcd_framebuffer[y][x>>2];
174 unsigned data = *address;
175
176 *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask);
177}
178
167static void flippixel(int x, int y) 179static void flippixel(int x, int y)
168{ 180{
169 unsigned mask = pixmask[x & 3]; 181 unsigned mask = pixmask[x & 3];
@@ -178,11 +190,19 @@ static void nopixel(int x, int y)
178 (void)y; 190 (void)y;
179} 191}
180 192
181lcd_pixelfunc_type* const lcd_pixelfuncs[8] = { 193lcd_pixelfunc_type* const lcd_pixelfuncs_bgcolor[8] = {
182 flippixel, nopixel, setpixel, setpixel, 194 flippixel, nopixel, setpixel, setpixel,
183 nopixel, clearpixel, nopixel, clearpixel 195 nopixel, clearpixel, nopixel, clearpixel
184}; 196};
185 197
198lcd_pixelfunc_type* const lcd_pixelfuncs_backdrop[8] = {
199 flippixel, nopixel, setpixel, setpixel,
200 nopixel, clearimgpixel, nopixel, clearimgpixel
201};
202
203lcd_pixelfunc_type* const * lcd_pixelfuncs = lcd_pixelfuncs_bgcolor;
204
205
186/* 'mask' and 'bits' contain 2 bits per pixel */ 206/* 'mask' and 'bits' contain 2 bits per pixel */
187static void flipblock(fb_data *address, unsigned mask, unsigned bits) 207static void flipblock(fb_data *address, unsigned mask, unsigned bits)
188 ICODE_ATTR; 208 ICODE_ATTR;
@@ -200,6 +220,15 @@ static void bgblock(fb_data *address, unsigned mask, unsigned bits)
200 *address = data ^ ((data ^ bg_pattern) & mask & ~bits); 220 *address = data ^ ((data ^ bg_pattern) & mask & ~bits);
201} 221}
202 222
223static void bgimgblock(fb_data *address, unsigned mask, unsigned bits)
224 ICODE_ATTR;
225static void bgimgblock(fb_data *address, unsigned mask, unsigned bits)
226{
227 unsigned data = *address;
228
229 *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & ~bits);
230}
231
203static void fgblock(fb_data *address, unsigned mask, unsigned bits) 232static void fgblock(fb_data *address, unsigned mask, unsigned bits)
204 ICODE_ATTR; 233 ICODE_ATTR;
205static void fgblock(fb_data *address, unsigned mask, unsigned bits) 234static void fgblock(fb_data *address, unsigned mask, unsigned bits)
@@ -220,6 +249,17 @@ static void solidblock(fb_data *address, unsigned mask, unsigned bits)
220 *address = data ^ ((data ^ bits) & mask); 249 *address = data ^ ((data ^ bits) & mask);
221} 250}
222 251
252static void solidimgblock(fb_data *address, unsigned mask, unsigned bits)
253 ICODE_ATTR;
254static void solidimgblock(fb_data *address, unsigned mask, unsigned bits)
255{
256 unsigned data = *address;
257 unsigned bgp = *(address + lcd_backdrop_offset);
258
259 bits = bgp ^ ((bgp ^ fg_pattern) & bits);
260 *address = data ^ ((data ^ bits) & mask);
261}
262
223static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) 263static void flipinvblock(fb_data *address, unsigned mask, unsigned bits)
224 ICODE_ATTR; 264 ICODE_ATTR;
225static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) 265static void flipinvblock(fb_data *address, unsigned mask, unsigned bits)
@@ -236,6 +276,15 @@ static void bginvblock(fb_data *address, unsigned mask, unsigned bits)
236 *address = data ^ ((data ^ bg_pattern) & mask & bits); 276 *address = data ^ ((data ^ bg_pattern) & mask & bits);
237} 277}
238 278
279static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits)
280 ICODE_ATTR;
281static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits)
282{
283 unsigned data = *address;
284
285 *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & bits);
286}
287
239static void fginvblock(fb_data *address, unsigned mask, unsigned bits) 288static void fginvblock(fb_data *address, unsigned mask, unsigned bits)
240 ICODE_ATTR; 289 ICODE_ATTR;
241static void fginvblock(fb_data *address, unsigned mask, unsigned bits) 290static void fginvblock(fb_data *address, unsigned mask, unsigned bits)
@@ -256,11 +305,53 @@ static void solidinvblock(fb_data *address, unsigned mask, unsigned bits)
256 *address = data ^ ((data ^ bits) & mask); 305 *address = data ^ ((data ^ bits) & mask);
257} 306}
258 307
259lcd_blockfunc_type* const lcd_blockfuncs[8] = { 308static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits)
309 ICODE_ATTR;
310static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits)
311{
312 unsigned data = *address;
313 unsigned fgp = fg_pattern;
314
315 bits = fgp ^ ((fgp ^ *(address + lcd_backdrop_offset)) & bits);
316 *address = data ^ ((data ^ bits) & mask);
317}
318
319lcd_blockfunc_type* const lcd_blockfuncs_bgcolor[8] = {
260 flipblock, bgblock, fgblock, solidblock, 320 flipblock, bgblock, fgblock, solidblock,
261 flipinvblock, bginvblock, fginvblock, solidinvblock 321 flipinvblock, bginvblock, fginvblock, solidinvblock
262}; 322};
263 323
324lcd_blockfunc_type* const lcd_blockfuncs_backdrop[8] = {
325 flipblock, bgimgblock, fgblock, solidimgblock,
326 flipinvblock, bgimginvblock, fginvblock, solidimginvblock
327};
328
329lcd_blockfunc_type* const * lcd_blockfuncs = lcd_blockfuncs_bgcolor;
330
331
332void lcd_set_backdrop(fb_data* backdrop)
333{
334 lcd_backdrop = backdrop;
335 if (backdrop)
336 {
337 lcd_backdrop_offset = (long)backdrop - (long)lcd_framebuffer;
338 lcd_pixelfuncs = lcd_pixelfuncs_backdrop;
339 lcd_blockfuncs = lcd_blockfuncs_backdrop;
340 }
341 else
342 {
343 lcd_backdrop_offset = 0;
344 lcd_pixelfuncs = lcd_pixelfuncs_bgcolor;
345 lcd_blockfuncs = lcd_blockfuncs_bgcolor;
346 }
347}
348
349fb_data* lcd_get_backdrop(void)
350{
351 return lcd_backdrop;
352}
353
354
264static inline void setblock(fb_data *address, unsigned mask, unsigned bits) 355static inline void setblock(fb_data *address, unsigned mask, unsigned bits)
265{ 356{
266 unsigned data = *address; 357 unsigned data = *address;
@@ -274,9 +365,17 @@ static inline void setblock(fb_data *address, unsigned mask, unsigned bits)
274/* Clear the whole display */ 365/* Clear the whole display */
275void lcd_clear_display(void) 366void lcd_clear_display(void)
276{ 367{
277 unsigned bits = (drawmode & DRMODE_INVERSEVID) ? fg_pattern : bg_pattern; 368 if (drawmode & DRMODE_INVERSEVID)
278 369 {
279 memset(lcd_framebuffer, bits, sizeof lcd_framebuffer); 370 memset(lcd_framebuffer, fg_pattern, sizeof lcd_framebuffer);
371 }
372 else
373 {
374 if (lcd_backdrop)
375 memcpy(lcd_framebuffer, lcd_backdrop, sizeof lcd_framebuffer);
376 else
377 memset(lcd_framebuffer, bg_pattern, sizeof lcd_framebuffer);
378 }
280 scrolling_lines = 0; 379 scrolling_lines = 0;
281} 380}
282 381
diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c
index 799865c36d..ec20068d95 100644
--- a/firmware/drivers/lcd-2bit-vert.c
+++ b/firmware/drivers/lcd-2bit-vert.c
@@ -48,6 +48,9 @@ static const unsigned char pixmask[4] ICONST_ATTR = {
48 0x03, 0x0C, 0x30, 0xC0 48 0x03, 0x0C, 0x30, 0xC0
49}; 49};
50 50
51static fb_data* lcd_backdrop = NULL;
52static long lcd_backdrop_offset IDATA_ATTR = 0;
53
51static unsigned fg_pattern IDATA_ATTR = 0xFF; /* initially black */ 54static unsigned fg_pattern IDATA_ATTR = 0xFF; /* initially black */
52static unsigned bg_pattern IDATA_ATTR = 0x00; /* initially white */ 55static unsigned bg_pattern IDATA_ATTR = 0x00; /* initially white */
53static int drawmode = DRMODE_SOLID; 56static int drawmode = DRMODE_SOLID;
@@ -167,6 +170,15 @@ static void clearpixel(int x, int y)
167 *address = data ^ ((data ^ bg_pattern) & mask); 170 *address = data ^ ((data ^ bg_pattern) & mask);
168} 171}
169 172
173static void clearimgpixel(int x, int y)
174{
175 unsigned mask = pixmask[y & 3];
176 fb_data *address = &lcd_framebuffer[y>>2][x];
177 unsigned data = *address;
178
179 *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask);
180}
181
170static void flippixel(int x, int y) 182static void flippixel(int x, int y)
171{ 183{
172 unsigned mask = pixmask[y & 3]; 184 unsigned mask = pixmask[y & 3];
@@ -181,11 +193,19 @@ static void nopixel(int x, int y)
181 (void)y; 193 (void)y;
182} 194}
183 195
184lcd_pixelfunc_type* const lcd_pixelfuncs[8] = { 196lcd_pixelfunc_type* const lcd_pixelfuncs_bgcolor[8] = {
185 flippixel, nopixel, setpixel, setpixel, 197 flippixel, nopixel, setpixel, setpixel,
186 nopixel, clearpixel, nopixel, clearpixel 198 nopixel, clearpixel, nopixel, clearpixel
187}; 199};
188 200
201lcd_pixelfunc_type* const lcd_pixelfuncs_backdrop[8] = {
202 flippixel, nopixel, setpixel, setpixel,
203 nopixel, clearimgpixel, nopixel, clearimgpixel
204};
205
206
207lcd_pixelfunc_type* const * lcd_pixelfuncs = lcd_pixelfuncs_bgcolor;
208
189/* 'mask' and 'bits' contain 2 bits per pixel */ 209/* 'mask' and 'bits' contain 2 bits per pixel */
190static void flipblock(fb_data *address, unsigned mask, unsigned bits) 210static void flipblock(fb_data *address, unsigned mask, unsigned bits)
191 ICODE_ATTR; 211 ICODE_ATTR;
@@ -203,6 +223,15 @@ static void bgblock(fb_data *address, unsigned mask, unsigned bits)
203 *address = data ^ ((data ^ bg_pattern) & mask & ~bits); 223 *address = data ^ ((data ^ bg_pattern) & mask & ~bits);
204} 224}
205 225
226static void bgimgblock(fb_data *address, unsigned mask, unsigned bits)
227 ICODE_ATTR;
228static void bgimgblock(fb_data *address, unsigned mask, unsigned bits)
229{
230 unsigned data = *address;
231
232 *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & ~bits);
233}
234
206static void fgblock(fb_data *address, unsigned mask, unsigned bits) 235static void fgblock(fb_data *address, unsigned mask, unsigned bits)
207 ICODE_ATTR; 236 ICODE_ATTR;
208static void fgblock(fb_data *address, unsigned mask, unsigned bits) 237static void fgblock(fb_data *address, unsigned mask, unsigned bits)
@@ -223,6 +252,17 @@ static void solidblock(fb_data *address, unsigned mask, unsigned bits)
223 *address = data ^ ((data ^ bits) & mask); 252 *address = data ^ ((data ^ bits) & mask);
224} 253}
225 254
255static void solidimgblock(fb_data *address, unsigned mask, unsigned bits)
256 ICODE_ATTR;
257static void solidimgblock(fb_data *address, unsigned mask, unsigned bits)
258{
259 unsigned data = *address;
260 unsigned bgp = *(address + lcd_backdrop_offset);
261
262 bits = bgp ^ ((bgp ^ fg_pattern) & bits);
263 *address = data ^ ((data ^ bits) & mask);
264}
265
226static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) 266static void flipinvblock(fb_data *address, unsigned mask, unsigned bits)
227 ICODE_ATTR; 267 ICODE_ATTR;
228static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) 268static void flipinvblock(fb_data *address, unsigned mask, unsigned bits)
@@ -239,6 +279,15 @@ static void bginvblock(fb_data *address, unsigned mask, unsigned bits)
239 *address = data ^ ((data ^ bg_pattern) & mask & bits); 279 *address = data ^ ((data ^ bg_pattern) & mask & bits);
240} 280}
241 281
282static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits)
283 ICODE_ATTR;
284static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits)
285{
286 unsigned data = *address;
287
288 *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & bits);
289}
290
242static void fginvblock(fb_data *address, unsigned mask, unsigned bits) 291static void fginvblock(fb_data *address, unsigned mask, unsigned bits)
243 ICODE_ATTR; 292 ICODE_ATTR;
244static void fginvblock(fb_data *address, unsigned mask, unsigned bits) 293static void fginvblock(fb_data *address, unsigned mask, unsigned bits)
@@ -259,11 +308,53 @@ static void solidinvblock(fb_data *address, unsigned mask, unsigned bits)
259 *address = data ^ ((data ^ bits) & mask); 308 *address = data ^ ((data ^ bits) & mask);
260} 309}
261 310
262lcd_blockfunc_type* const lcd_blockfuncs[8] = { 311static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits)
312 ICODE_ATTR;
313static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits)
314{
315 unsigned data = *address;
316 unsigned fgp = fg_pattern;
317
318 bits = fgp ^ ((fgp ^ *(address + lcd_backdrop_offset)) & bits);
319 *address = data ^ ((data ^ bits) & mask);
320}
321
322lcd_blockfunc_type* const lcd_blockfuncs_bgcolor[8] = {
263 flipblock, bgblock, fgblock, solidblock, 323 flipblock, bgblock, fgblock, solidblock,
264 flipinvblock, bginvblock, fginvblock, solidinvblock 324 flipinvblock, bginvblock, fginvblock, solidinvblock
265}; 325};
266 326
327lcd_blockfunc_type* const lcd_blockfuncs_backdrop[8] = {
328 flipblock, bgimgblock, fgblock, solidimgblock,
329 flipinvblock, bgimginvblock, fginvblock, solidimginvblock
330};
331
332lcd_blockfunc_type* const * lcd_blockfuncs = lcd_blockfuncs_bgcolor;
333
334
335void lcd_set_backdrop(fb_data* backdrop)
336{
337 lcd_backdrop = backdrop;
338 if (backdrop)
339 {
340 lcd_backdrop_offset = (long)backdrop - (long)lcd_framebuffer;
341 lcd_pixelfuncs = lcd_pixelfuncs_backdrop;
342 lcd_blockfuncs = lcd_blockfuncs_backdrop;
343 }
344 else
345 {
346 lcd_backdrop_offset = 0;
347 lcd_pixelfuncs = lcd_pixelfuncs_bgcolor;
348 lcd_blockfuncs = lcd_blockfuncs_bgcolor;
349 }
350}
351
352fb_data* lcd_get_backdrop(void)
353{
354 return lcd_backdrop;
355}
356
357
267static inline void setblock(fb_data *address, unsigned mask, unsigned bits) 358static inline void setblock(fb_data *address, unsigned mask, unsigned bits)
268{ 359{
269 unsigned data = *address; 360 unsigned data = *address;
@@ -277,9 +368,17 @@ static inline void setblock(fb_data *address, unsigned mask, unsigned bits)
277/* Clear the whole display */ 368/* Clear the whole display */
278void lcd_clear_display(void) 369void lcd_clear_display(void)
279{ 370{
280 unsigned bits = (drawmode & DRMODE_INVERSEVID) ? fg_pattern : bg_pattern; 371 if (drawmode & DRMODE_INVERSEVID)
281 372 {
282 memset(lcd_framebuffer, bits, sizeof lcd_framebuffer); 373 memset(lcd_framebuffer, fg_pattern, sizeof lcd_framebuffer);
374 }
375 else
376 {
377 if (lcd_backdrop)
378 memcpy(lcd_framebuffer, lcd_backdrop, sizeof lcd_framebuffer);
379 else
380 memset(lcd_framebuffer, bg_pattern, sizeof lcd_framebuffer);
381 }
283 scrolling_lines = 0; 382 scrolling_lines = 0;
284} 383}
285 384
@@ -487,7 +586,7 @@ void lcd_fillrect(int x, int y, int width, int height)
487 586
488 if (drawmode & DRMODE_INVERSEVID) 587 if (drawmode & DRMODE_INVERSEVID)
489 { 588 {
490 if (drawmode & DRMODE_BG) 589 if ((drawmode & DRMODE_BG) && !lcd_backdrop)
491 { 590 {
492 fillopt = true; 591 fillopt = true;
493 bits = bg_pattern; 592 bits = bg_pattern;
@@ -1090,4 +1189,3 @@ static void scroll_thread(void)
1090 sleep(scroll_ticks); 1189 sleep(scroll_ticks);
1091 } 1190 }
1092} 1191}
1093
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index a39147628d..ceb0f6e3d2 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -310,10 +310,14 @@ extern void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *stri
310 int style, int offset); 310 int style, int offset);
311 311
312/* low level drawing function pointer arrays */ 312/* low level drawing function pointer arrays */
313#if LCD_DEPTH >= 8
314extern lcd_fastpixelfunc_type* const *lcd_fastpixelfuncs;
315#elif LCD_DEPTH > 1
316extern lcd_pixelfunc_type* const *lcd_pixelfuncs;
317extern lcd_blockfunc_type* const *lcd_blockfuncs;
318#else
313extern lcd_pixelfunc_type* const lcd_pixelfuncs[8]; 319extern lcd_pixelfunc_type* const lcd_pixelfuncs[8];
314extern lcd_blockfunc_type* const lcd_blockfuncs[8]; 320extern lcd_blockfunc_type* const lcd_blockfuncs[8];
315#if LCD_DEPTH >= 8
316extern lcd_fastpixelfunc_type* const * lcd_fastpixelfuncs;
317#endif 321#endif
318 322
319extern void lcd_drawpixel(int x, int y); 323extern void lcd_drawpixel(int x, int y);
@@ -339,10 +343,8 @@ extern void lcd_set_background(unsigned background);
339extern unsigned lcd_get_background(void); 343extern unsigned lcd_get_background(void);
340extern void lcd_set_drawinfo(int mode, unsigned foreground, 344extern void lcd_set_drawinfo(int mode, unsigned foreground,
341 unsigned background); 345 unsigned background);
342#ifdef HAVE_LCD_COLOR
343void lcd_set_backdrop(fb_data* backdrop); 346void lcd_set_backdrop(fb_data* backdrop);
344fb_data* lcd_get_backdrop(void); 347fb_data* lcd_get_backdrop(void);
345#endif
346 348
347extern void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, 349extern void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
348 int stride, int x, int y, int width, int height); 350 int stride, int x, int y, int width, int height);