Prevents lines from wrapping when writing text
This commit is contained in:
+2
-1
@@ -56,6 +56,7 @@ uint8_t lcdNextPos;
|
|||||||
void lcdPutPattern(xcoord_t x, uint8_t y, const uint8_t * pattern, uint8_t width, uint8_t height, LcdFlags flags)
|
void lcdPutPattern(xcoord_t x, uint8_t y, const uint8_t * pattern, uint8_t width, uint8_t height, LcdFlags flags)
|
||||||
{
|
{
|
||||||
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
|
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
|
||||||
|
uint8_t *end = &displayBuf[ y / 8 * LCD_W + LCD_W ];
|
||||||
|
|
||||||
bool blink = false;
|
bool blink = false;
|
||||||
bool inv = false;
|
bool inv = false;
|
||||||
@@ -75,7 +76,7 @@ void lcdPutPattern(xcoord_t x, uint8_t y, const uint8_t * pattern, uint8_t width
|
|||||||
// we need to work on the previous byte when INVERS
|
// we need to work on the previous byte when INVERS
|
||||||
p--;
|
p--;
|
||||||
|
|
||||||
for (int8_t i=0; i<width+2; i++) {
|
for (int8_t i=0; i<width+2 && p<end; i++) {
|
||||||
uint8_t lines = (height+7)/8;
|
uint8_t lines = (height+7)/8;
|
||||||
assert(lines <= 5);
|
assert(lines <= 5);
|
||||||
uint8_t b[5] = { 0 };
|
uint8_t b[5] = { 0 };
|
||||||
|
|||||||
@@ -1062,6 +1062,13 @@ TEST(Lcd, Prec2_Right)
|
|||||||
EXPECT_TRUE(checkScreenshot("prec2_right"));
|
EXPECT_TRUE(checkScreenshot("prec2_right"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Lcd, Line_Wrap)
|
||||||
|
{
|
||||||
|
lcd_clear();
|
||||||
|
lcd_puts(LCD_W-10, 0, "TEST");
|
||||||
|
EXPECT_TRUE(checkScreenshot("line_wrap"));
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QCoreApplication app(argc, argv);
|
QCoreApplication app(argc, argv);
|
||||||
|
|||||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 297 B |
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 321 B |
Reference in New Issue
Block a user