mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-08-06 14:14:44 +02:00
Revert 160 x 128 jpeg code
This commit is contained in:
@@ -130,12 +130,31 @@ void renderJPEG(int xpos, int ypos) {
|
|||||||
int mcu_x = JpegDec.MCUx * mcu_w + xpos; // Calculate coordinates of top left corner of current MCU
|
int mcu_x = JpegDec.MCUx * mcu_w + xpos; // Calculate coordinates of top left corner of current MCU
|
||||||
int mcu_y = JpegDec.MCUy * mcu_h + ypos;
|
int mcu_y = JpegDec.MCUy * mcu_h + ypos;
|
||||||
|
|
||||||
// check if the image block size needs to be changed for the right and bottom edges
|
// check if the image block size needs to be changed for the right edge
|
||||||
if (mcu_x + mcu_w <= max_x) win_w = mcu_w;
|
if (mcu_x + mcu_w <= max_x) win_w = mcu_w;
|
||||||
else win_w = min_w;
|
else win_w = min_w;
|
||||||
|
|
||||||
|
// check if the image block size needs to be changed for the bottom edge
|
||||||
if (mcu_y + mcu_h <= max_y) win_h = mcu_h;
|
if (mcu_y + mcu_h <= max_y) win_h = mcu_h;
|
||||||
else win_h = min_h;
|
else win_h = min_h;
|
||||||
|
|
||||||
|
// copy pixels into a contiguous block
|
||||||
|
if (win_w != mcu_w)
|
||||||
|
{
|
||||||
|
uint16_t *cImg;
|
||||||
|
int p = 0;
|
||||||
|
cImg = pImg + win_w;
|
||||||
|
for (int h = 1; h < win_h; h++)
|
||||||
|
{
|
||||||
|
p += mcu_w;
|
||||||
|
for (int w = 0; w < win_w; w++)
|
||||||
|
{
|
||||||
|
*cImg = *(pImg + w + p);
|
||||||
|
cImg++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// draw image MCU block only if it will fit on the screen
|
// draw image MCU block only if it will fit on the screen
|
||||||
if (( mcu_x + win_w ) <= tft.width() && ( mcu_y + win_h ) <= tft.height())
|
if (( mcu_x + win_w ) <= tft.width() && ( mcu_y + win_h ) <= tft.height())
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user