Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing build error xdrv_13_display.ino with JPEG_PICTS #22265

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions tasmota/tasmota_xdrv_driver/xdrv_13_display.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2442,6 +2442,28 @@ void Draw_RGB_Bitmap(char *file, uint16_t xp, uint16_t yp, uint8_t scale, bool i
#ifdef ESP32
#ifdef JPEG_PICTS
#define JPG_DEFSIZE 150000
void Draw_jpeg(uint8_t *mem, uint16_t jpgsize, uint16_t xp, uint16_t yp, uint8_t scale) {
if (mem[0] == 0xff && mem[1] == 0xd8) {
uint16_t xsize;
uint16_t ysize;
get_jpeg_size(mem, jpgsize, &xsize, &ysize);
//AddLog(LOG_LEVEL_INFO, PSTR("Pict size %d - %d - %d"), xsize, ysize, jpgsize);
scale &= 3;
uint8_t fac = 1 << scale;
xsize /= fac;
ysize /= fac;
renderer->setAddrWindow(xp, yp, xp + xsize, yp + ysize);
uint8_t *rgbmem = (uint8_t *)special_malloc(xsize * ysize * 2);
if (rgbmem) {
//jpg2rgb565(mem, jpgsize, rgbmem, JPG_SCALE_NONE);
jpg2rgb565(mem, jpgsize, rgbmem, (jpg_scale_t)scale);
renderer->pushColors((uint16_t*)rgbmem, xsize * ysize, true);
free(rgbmem);
}
renderer->setAddrWindow(0, 0, 0, 0);
}
}

void Draw_JPG_from_URL(char *url, uint16_t xp, uint16_t yp, uint8_t scale) {
uint8_t *mem = 0;
WiFiClient http_client;
Expand Down Expand Up @@ -2484,28 +2506,6 @@ void Draw_JPG_from_URL(char *url, uint16_t xp, uint16_t yp, uint8_t scale) {
}
if (mem) free(mem);
}

void Draw_jpeg(uint8_t *mem, uint16_t jpgsize, uint16_t xp, uint16_t yp, uint8_t scale) {
if (mem[0] == 0xff && mem[1] == 0xd8) {
uint16_t xsize;
uint16_t ysize;
get_jpeg_size(mem, jpgsize, &xsize, &ysize);
//AddLog(LOG_LEVEL_INFO, PSTR("Pict size %d - %d - %d"), xsize, ysize, jpgsize);
scale &= 3;
uint8_t fac = 1 << scale;
xsize /= fac;
ysize /= fac;
renderer->setAddrWindow(xp, yp, xp + xsize, yp + ysize);
uint8_t *rgbmem = (uint8_t *)special_malloc(xsize * ysize * 2);
if (rgbmem) {
//jpg2rgb565(mem, jpgsize, rgbmem, JPG_SCALE_NONE);
jpg2rgb565(mem, jpgsize, rgbmem, (jpg_scale_t)scale);
renderer->pushColors((uint16_t*)rgbmem, xsize * ysize, true);
free(rgbmem);
}
renderer->setAddrWindow(0, 0, 0, 0);
}
}
#endif // JPEG_PICTS
#endif // ESP32

Expand Down