From 1d14323bea83b89504b80cf4678c2c85c8ca1fac Mon Sep 17 00:00:00 2001 From: Arthur Bonnaudet Date: Wed, 20 Sep 2023 11:07:35 +0200 Subject: [PATCH 1/2] Fat: Fix backspace and space drawing in keyboard Fix cases where RLE encoded glyphs were rendered with the direct drawing functions, leading to glitches. --- lib_nbgl/src/nbgl_obj_keyboard.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib_nbgl/src/nbgl_obj_keyboard.c b/lib_nbgl/src/nbgl_obj_keyboard.c index 10b253178..ec52fc688 100644 --- a/lib_nbgl/src/nbgl_obj_keyboard.c +++ b/lib_nbgl/src/nbgl_obj_keyboard.c @@ -482,7 +482,7 @@ static void keyboardDrawDigits(nbgl_keyboard_t *keyboard) rectArea.y0 = keyboard->obj.area.y0 + KEYBOARD_KEY_HEIGHT * 2 + (KEYBOARD_KEY_HEIGHT - rectArea.height) / 2; rectArea.x0 += (BACKSPACE_KEY_WIDTH_DIGITS - rectArea.width) / 2; - nbgl_frontDrawImage(&rectArea, (uint8_t *) C_backspace32px.bitmap, NO_TRANSFORMATION, BLACK); + nbgl_drawIcon(&rectArea, BLACK, &C_backspace32px); // 4th row rectArea.x0 @@ -491,10 +491,8 @@ static void keyboardDrawDigits(nbgl_keyboard_t *keyboard) nbgl_drawText(&rectArea, "ABC", 3, BAGL_FONT_INTER_REGULAR_24px_1bpp, BLACK); rectArea.x0 = SWITCH_KEY_WIDTH + (SPACE_KEY_WIDTH - C_space32px.width) / 2; - nbgl_frontDrawImage(&rectArea, - (uint8_t *) C_space32px.bitmap, - NO_TRANSFORMATION, - (keyboard->keyMask & (1 << SPACE_KEY_INDEX)) ? WHITE : BLACK); + nbgl_drawIcon( + &rectArea, (keyboard->keyMask & (1 << SPACE_KEY_INDEX)) ? WHITE : BLACK, &C_space32px); } static void keyboardDraw(nbgl_keyboard_t *keyboard) From d9a80d5b4810b2d92d29c601a2c910f3b50addd2 Mon Sep 17 00:00:00 2001 From: Arthur Bonnaudet Date: Wed, 20 Sep 2023 13:57:16 +0200 Subject: [PATCH 2/2] Fat: Fix keyboard misalignement Keyboard object was not aligned on multiple of 4 (in alternative keyboard) --- lib_nbgl/src/nbgl_obj_keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_nbgl/src/nbgl_obj_keyboard.c b/lib_nbgl/src/nbgl_obj_keyboard.c index ec52fc688..4654c11e4 100644 --- a/lib_nbgl/src/nbgl_obj_keyboard.c +++ b/lib_nbgl/src/nbgl_obj_keyboard.c @@ -480,7 +480,7 @@ static void keyboardDrawDigits(nbgl_keyboard_t *keyboard) rectArea.bpp = NBGL_BPP_1; rectArea.x0 = SPECIAL_CHARS_KEY_WIDTH + 5 * NORMAL_KEY_WIDTH; rectArea.y0 = keyboard->obj.area.y0 + KEYBOARD_KEY_HEIGHT * 2 - + (KEYBOARD_KEY_HEIGHT - rectArea.height) / 2; + + (((KEYBOARD_KEY_HEIGHT - rectArea.height) / 2) & 0xFFC); rectArea.x0 += (BACKSPACE_KEY_WIDTH_DIGITS - rectArea.width) / 2; nbgl_drawIcon(&rectArea, BLACK, &C_backspace32px);