mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-08-01 19:54:43 +02:00
Correct jpeg decoder image edge rendering
Revert setup file and add setup 10
This commit is contained in:
@@ -99,6 +99,9 @@
|
||||
//#define TFT_CS 15 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to RST pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
//#define TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
|
||||
|
||||
//#define TFT_WR 22 // Write strobe for modified Raspberry Pi TFT only
|
||||
|
||||
@@ -162,7 +165,7 @@
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
// #define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
|
@@ -27,6 +27,7 @@
|
||||
//#include <User_Setups/Setup7_ST7735_128x128.h> // Setup file configured for my ST7735 128x128 display
|
||||
//#include <User_Setups/Setup8_ILI9163_128x128.h> // Setup file configured for my ILI9163 128x128 display
|
||||
//#include <User_Setups/Setup9_ST7735_Overlap.h> // Setup file configured for my ST7735
|
||||
//#include <User_Setups/Setup10_RPi_touch_ILI9486.h> // Setup file configured for my stock RPi TFT with touch
|
||||
|
||||
//#include <User_Setups/SetupX_Template.h> // Setup file template for copying/editting
|
||||
|
||||
|
@@ -130,32 +130,12 @@ 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_y = JpegDec.MCUy * mcu_h + ypos;
|
||||
|
||||
|
||||
// check if the image block size needs to be changed for the right edge
|
||||
// check if the image block size needs to be changed for the right and bottom edges
|
||||
if (mcu_x + mcu_w <= max_x) win_w = mcu_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;
|
||||
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
|
||||
if (( mcu_x + win_w ) <= tft.width() && ( mcu_y + win_h ) <= tft.height())
|
||||
{
|
||||
|
@@ -23,9 +23,6 @@ TFT_eSPI tft = TFT_eSPI();
|
||||
// JPEG decoder library
|
||||
#include <JPEGDecoder.h>
|
||||
|
||||
// Chip Select Pin for SD card
|
||||
#define SD_CS 53
|
||||
|
||||
// Return the minimum of two values a and b
|
||||
#define minimum(a,b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
|
Reference in New Issue
Block a user