Commit 90af737f authored by Bodmer's avatar Bodmer

Fix #606 inconsistency + others

TFT_eFEX also needs updating so Rotated_Sprite_3 example renders correctly.

pushImage for FLASH images updated so partly off-screen images are correctly rendered.
parent 353d80a7
......@@ -829,7 +829,7 @@ void TFT_eSprite::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint16_
for (int32_t xp = xo; xp < xo + ws; xp++)
{
uint16_t color = data[xp + yp * w];
if(!_iswapBytes) color = color<<8 | color>>8;
if(_iswapBytes) color = color<<8 | color>>8;
_img[x + ys * _iwidth] = color;
x++;
}
......@@ -934,7 +934,7 @@ void TFT_eSprite::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, const u
for (int32_t xp = xo; xp < xo + ws; xp++)
{
uint16_t color = pgm_read_word(data + xp + yp * w);
if(!_iswapBytes) color = color<<8 | color>>8;
if(_iswapBytes) color = color<<8 | color>>8;
_img[x + ys * _iwidth] = color;
x++;
}
......
......@@ -25,7 +25,7 @@
writedata(0x48); //X-Mirror, Top-Left to right-Buttom, RGB
writecommand(0x3A); //Interface Pixel Format
writedata(0x05); //Control interface color format set to 16
writedata(0x55); //Control interface color format set to 16
writecommand(0xB4); //Column inversion
......@@ -104,4 +104,4 @@
begin_tft_write();
writecommand(0x29); //Display on
}
}
\ No newline at end of file
......@@ -989,7 +989,6 @@ void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *d
** Function name: pushImage - for FLASH (PROGMEM) stored images
** Description: plot 16 bit image
***************************************************************************************/
#define PI_BUF_SIZE 128
void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, const uint16_t *data)
{
// Requires 32 bit aligned access, so use PROGMEM 16 bit word functions
......@@ -1013,32 +1012,16 @@ void TFT_eSPI::pushImage(int32_t x, int32_t y, int32_t w, int32_t h, const uint1
data += dx + dy * w;
uint16_t buffer[PI_BUF_SIZE];
uint16_t* pix_buffer = buffer;
uint16_t buffer[dw];
setWindow(x, y, x + dw - 1, y + dh - 1);
// Work out the number whole buffers to send
uint16_t nb = (dw * dh) / PI_BUF_SIZE;
// Fill and send "nb" buffers to TFT
for (int32_t i = 0; i < nb; i++) {
for (int32_t j = 0; j < PI_BUF_SIZE; j++) {
pix_buffer[j] = pgm_read_word(&data[i * PI_BUF_SIZE + j]);
}
pushPixels(pix_buffer, PI_BUF_SIZE);
}
// Work out number of pixels not yet sent
uint16_t np = (dw * dh) % PI_BUF_SIZE;
// Send any partial buffer left over
if (np) {
for (int32_t i = 0; i < np; i++)
{
pix_buffer[i] = pgm_read_word(&data[nb * PI_BUF_SIZE + i]);
// Fill and send line buffers to TFT
for (int32_t i = 0; i < dh; i++) {
for (int32_t j = 0; j < dw; j++) {
buffer[j] = pgm_read_word(&data[i * w + j]);
}
pushPixels(pix_buffer, np);
pushPixels(buffer, dw);
}
inTransaction = false;
......
......@@ -16,7 +16,7 @@
#ifndef _TFT_eSPIH_
#define _TFT_eSPIH_
#define TFT_ESPI_VERSION "2.2.1"
#define TFT_ESPI_VERSION "2.2.2"
/***************************************************************************************
** Section 1: Load required header files
......
{
"name": "TFT_eSPI",
"version": "2.2.1",
"version": "2.2.2",
"keywords": "Arduino, tft, ePaper, display, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140",
"description": "A TFT and ePaper SPI graphics library with optimisation for ESP8266, ESP32 and STM32",
"repository":
......
name=TFT_eSPI
version=2.2.1
version=2.2.2
author=Bodmer
maintainer=Bodmer
sentence=TFT graphics library for Arduino processors with performance optimisation for STM32, ESP8266 and ESP32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment