Fixes #1580
This commit is contained in:
@@ -145,7 +145,12 @@ void lcd_bmp(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t offset, uint8_
|
|||||||
{
|
{
|
||||||
const pm_uchar *q = img;
|
const pm_uchar *q = img;
|
||||||
uint8_t w = pgm_read_byte(q++);
|
uint8_t w = pgm_read_byte(q++);
|
||||||
if (!width) width = w;
|
if (!width || width > w) {
|
||||||
|
width = w;
|
||||||
|
}
|
||||||
|
if (x+width > LCD_W) {
|
||||||
|
width = LCD_W-x;
|
||||||
|
}
|
||||||
uint8_t rows = (pgm_read_byte(q++) + 1) / 2;
|
uint8_t rows = (pgm_read_byte(q++) + 1) / 2;
|
||||||
|
|
||||||
for (uint8_t row=0; row<rows; row++) {
|
for (uint8_t row=0; row<rows; row++) {
|
||||||
|
|||||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 404 B |
@@ -255,3 +255,15 @@ TEST(Lcd, DrawSwitch)
|
|||||||
EXPECT_TRUE(checkScreenshot("drawswitch"));
|
EXPECT_TRUE(checkScreenshot("drawswitch"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PCBTARANIS)
|
||||||
|
TEST(Lcd, BMPWrapping)
|
||||||
|
{
|
||||||
|
lcd_clear();
|
||||||
|
uint8_t bitmap[2+40*40/2];
|
||||||
|
bmpLoad(bitmap, "./tests/plane.bmp", 40, 40);
|
||||||
|
lcd_bmp(200, 0, bitmap);
|
||||||
|
lcd_bmp(200, 60, bitmap);
|
||||||
|
EXPECT_TRUE(checkScreenshot("bmpwrapping"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1002 B |
Reference in New Issue
Block a user