From 94588dd588809817dc375a489818bbef864c273f Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 2 Jan 2018 01:37:31 +0100 Subject: [PATCH] modtrezorui: introduce TREZOR_FONT_PREFILL, set it to 0 in bootloader --- SConscript.bootloader | 1 + embed/extmod/modtrezorui/display.c | 6 ++++++ embed/extmod/modtrezorui/display.h | 3 +++ 3 files changed, 10 insertions(+) diff --git a/SConscript.bootloader b/SConscript.bootloader index 5ce10a6779..59a39a7f14 100644 --- a/SConscript.bootloader +++ b/SConscript.bootloader @@ -34,6 +34,7 @@ SOURCE_MOD += [ # modtrezorui CPPDEFINES_MOD += [ 'TREZOR_FONT_BOLD_ENABLE', + ('TREZOR_FONT_PREFILL', '0'), ('QR_MAX_VERSION', '0'), ] SOURCE_MOD += [ diff --git a/embed/extmod/modtrezorui/display.c b/embed/extmod/modtrezorui/display.c index 93b4384b44..2716688c67 100644 --- a/embed/extmod/modtrezorui/display.c +++ b/embed/extmod/modtrezorui/display.c @@ -463,9 +463,11 @@ void display_text(int x, int y, const char *text, int textlen, uint8_t font, uin { x += DISPLAY_OFFSET[0]; y += DISPLAY_OFFSET[1]; +#if TREZOR_FONT_PREFILL int w = display_text_width(text, textlen, font); int barwidth = max(w, minwidth); display_bar(x - 1, y - 18, barwidth + 2, 23, bgcolor); +#endif display_text_render(x, y, text, textlen, font, fgcolor, bgcolor); } @@ -474,8 +476,10 @@ void display_text_center(int x, int y, const char *text, int textlen, uint8_t fo x += DISPLAY_OFFSET[0]; y += DISPLAY_OFFSET[1]; int w = display_text_width(text, textlen, font); +#if TREZOR_FONT_PREFILL int barwidth = max(w, minwidth); display_bar(x - barwidth / 2 - 1, y - 18, barwidth + 2, 23, bgcolor); +#endif display_text_render(x - w / 2, y, text, textlen, font, fgcolor, bgcolor); } @@ -484,8 +488,10 @@ void display_text_right(int x, int y, const char *text, int textlen, uint8_t fon x += DISPLAY_OFFSET[0]; y += DISPLAY_OFFSET[1]; int w = display_text_width(text, textlen, font); +#if TREZOR_FONT_PREFILL int barwidth = max(w, minwidth); display_bar(x - barwidth - 1, y - 18, barwidth + 2, 23, bgcolor); +#endif display_text_render(x - w, y, text, textlen, font, fgcolor, bgcolor); } diff --git a/embed/extmod/modtrezorui/display.h b/embed/extmod/modtrezorui/display.h index 07b26ebce9..52aca4e6d4 100644 --- a/embed/extmod/modtrezorui/display.h +++ b/embed/extmod/modtrezorui/display.h @@ -29,6 +29,9 @@ #ifdef TREZOR_FONT_BOLD_ENABLE #define FONT_BOLD 2 #endif +#ifndef TREZOR_FONT_PREFILL +#define TREZOR_FONT_PREFILL 1 +#endif #define AVATAR_IMAGE_SIZE 144 #define LOADER_ICON_SIZE 64