From 24fc4a9e95a6e5b54381a1cae24b4b835bd3e688 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 10 Jan 2024 09:20:33 +0100 Subject: [PATCH] Fix: Clear up artefacts after when using scrolling text. This fixes #27. --- .gitignore | 1 + src/ArduinoGraphics.cpp | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/src/ArduinoGraphics.cpp b/src/ArduinoGraphics.cpp index 15fe1ad..3590eec 100644 --- a/src/ArduinoGraphics.cpp +++ b/src/ArduinoGraphics.cpp @@ -436,7 +436,9 @@ void ArduinoGraphics::endText(int scrollDirection) for (int i = 0; i < scrollLength; i++) { beginDraw(); - text(_textBuffer, _textX - i, _textY); + int const text_x = _textX - i; + text(_textBuffer, text_x, _textY); + bitmap(_font->data[0x20], text_x - 1, _textY, 1, _font->height); endDraw(); delay(_textScrollSpeed); @@ -446,7 +448,9 @@ void ArduinoGraphics::endText(int scrollDirection) for (int i = 0; i < scrollLength; i++) { beginDraw(); - text(_textBuffer, _textX - (scrollLength - i - 1), _textY); + int const text_x = _textX - (scrollLength - i - 1); + text(_textBuffer, text_x, _textY); + bitmap(_font->data[0x20], text_x - 1, _textY, 1, _font->height); endDraw(); delay(_textScrollSpeed); @@ -456,7 +460,9 @@ void ArduinoGraphics::endText(int scrollDirection) for (int i = 0; i < scrollLength; i++) { beginDraw(); - text(_textBuffer, _textX, _textY - i); + int const text_y = _textY - i; + text(_textBuffer, _textX, text_y); + bitmap(_font->data[0x20], _textX, text_y - 1, _font->width, 1); endDraw(); delay(_textScrollSpeed); @@ -466,7 +472,9 @@ void ArduinoGraphics::endText(int scrollDirection) for (int i = 0; i < scrollLength; i++) { beginDraw(); - text(_textBuffer, _textX, _textY - (scrollLength - i - 1)); + int const text_y = _textY - (scrollLength - i - 1); + text(_textBuffer, _textX, text_y); + bitmap(_font->data[0x20], _textX, text_y - 1, _font->width, 1); endDraw(); delay(_textScrollSpeed);