This commit is contained in:
bsongis
2014-08-08 16:29:13 +02:00
parent a92de216ac
commit 50e4850745
4 changed files with 18 additions and 1 deletions
+6 -1
View File
@@ -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;
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;
for (uint8_t row=0; row<rows; row++) {
Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

+12
View File
@@ -255,3 +255,15 @@ TEST(Lcd, DrawSwitch)
EXPECT_TRUE(checkScreenshot("drawswitch"));
}
#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
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1002 B