Skip to content

Commit ed2bd28

Browse files
Merge remote-tracking branch 'Tasmota/development' into work
2 parents e3018e4 + d22d493 commit ed2bd28

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

tasmota/tasmota_xdrv_driver/xdrv_13_display.ino

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2432,13 +2432,15 @@ void Draw_RGB_Bitmap(char *file, uint16_t xp, uint16_t yp, uint8_t scale, bool i
24322432
estr[cnt] = tolower(ending[cnt]);
24332433
}
24342434

2435+
uint16_t xsize;
2436+
uint16_t ysize;
2437+
24352438
if (!strcmp(estr,"rgb")) {
24362439
// special rgb format
24372440
fp = ufsp->open(file, FS_FILE_READ);
24382441
if (!fp) return;
2439-
uint16_t xsize;
2442+
24402443
fp.read((uint8_t*)&xsize, 2);
2441-
uint16_t ysize;
24422444
fp.read((uint8_t*)&ysize, 2);
24432445
uint16_t xoffs;
24442446
uint16_t yoffs;
@@ -2451,12 +2453,13 @@ void Draw_RGB_Bitmap(char *file, uint16_t xp, uint16_t yp, uint8_t scale, bool i
24512453
}
24522454

24532455
#ifndef SLOW_RGB16
2454-
renderer->setAddrWindow(xp, yp, xp + xsize, yp + ysize);
2456+
//renderer->setAddrWindow(xp, yp, xp + xsize, yp + ysize);
24552457
uint16_t *rgb = (uint16_t *)special_malloc(xsize * 2);
24562458
if (rgb) {
24572459
//uint16_t rgb[xsize];
24582460
for (int16_t j = 0; j < ysize; j++) {
24592461
fp.read((uint8_t*)rgb, xsize * 2);
2462+
renderer->setAddrWindow(xp, yp + j, xp + xsize, yp + j + 1);
24602463
renderer->pushColors(rgb, xsize, true);
24612464
OsWatchLoop();
24622465
}
@@ -2476,6 +2479,9 @@ void Draw_RGB_Bitmap(char *file, uint16_t xp, uint16_t yp, uint8_t scale, bool i
24762479
yp++;
24772480
}
24782481
#endif
2482+
if (scale) {
2483+
if (renderer) renderer->drawRect(xp, yp, xsize, ysize, GetColorFromIndex(scale));
2484+
}
24792485
fp.close();
24802486
} else if (!strcmp(estr,"jpg") || !strcmp(estr,"jpeg")) {
24812487
// jpeg files on ESP32 with more memory
@@ -2492,8 +2498,6 @@ void Draw_RGB_Bitmap(char *file, uint16_t xp, uint16_t yp, uint8_t scale, bool i
24922498
if (mem) {
24932499
uint8_t res = fp.read(mem, size);
24942500
if (res) {
2495-
uint16_t xsize;
2496-
uint16_t ysize;
24972501
uint16_t xoffs;
24982502
uint16_t yoffs;
24992503
if (mem[0] == 0xff && mem[1] == 0xd8) {
@@ -2513,14 +2517,15 @@ void Draw_RGB_Bitmap(char *file, uint16_t xp, uint16_t yp, uint8_t scale, bool i
25132517
if (pixb) {
25142518
uint8_t *ob = out_buf;
25152519
if (jpg2rgb888(mem, size, out_buf, (jpg_scale_t)JPG_SCALE_NONE)) {
2516-
renderer->setAddrWindow(xp, yp, xp + xsize, yp + ysize);
2520+
//renderer->setAddrWindow(xp, yp, xp + xsize, yp + ysize);
25172521
for (int32_t j = 0; j < ysize; j++) {
25182522
if (inverted == false) {
25192523
rgb888_to_565(ob, pixb, xsize);
25202524
} else {
25212525
rgb888_to_565i(ob, pixb, xsize);
25222526
}
25232527
ob += xsize * 3;
2528+
renderer->setAddrWindow(xp, yp + j, xp + xsize, yp + j + 1);
25242529
renderer->pushColors(pixb, xsize, true);
25252530
OsWatchLoop();
25262531
}
@@ -2533,12 +2538,12 @@ void Draw_RGB_Bitmap(char *file, uint16_t xp, uint16_t yp, uint8_t scale, bool i
25332538
}
25342539
}
25352540
}
2536-
if (scale) {
2537-
if (renderer) renderer->drawRect(xp, yp, xsize, ysize, GetColorFromIndex(scale));
2538-
}
25392541
}
25402542
free(mem);
25412543
}
2544+
if (scale) {
2545+
if (renderer) renderer->drawRect(xp, yp, xsize, ysize, GetColorFromIndex(scale));
2546+
}
25422547
fp.close();
25432548
}
25442549
#endif // JPEG_PICTS

0 commit comments

Comments
 (0)