From 731228d13a90838c091f95018bddc76137c2a2b7 Mon Sep 17 00:00:00 2001 From: Bodmer Date: Fri, 28 Aug 2020 21:18:26 +0100 Subject: [PATCH] Fix deleteSprite Fixes #736 and also delete color map even if the sprite has not been created. --- Extensions/Sprite.cpp | 16 ++++++++-------- TFT_eSPI.h | 2 +- library.json | 2 +- library.properties | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Extensions/Sprite.cpp b/Extensions/Sprite.cpp index 20d5d21..4297d35 100644 --- a/Extensions/Sprite.cpp +++ b/Extensions/Sprite.cpp @@ -125,7 +125,7 @@ void* TFT_eSprite::getPointer(void) /*************************************************************************************** ** Function name: created -** Description: Returns true is sprite has been created +** Description: Returns true if sprite has been created ***************************************************************************************/ bool TFT_eSprite::created(void) { @@ -376,18 +376,18 @@ uint16_t TFT_eSprite::getPaletteColor(uint8_t index) ***************************************************************************************/ void TFT_eSprite::deleteSprite(void) { - if (!_created ) return; - if (_colorMap != nullptr) { free(_colorMap); + _colorMap = nullptr; } - free(_img8_1); - - _img8 = nullptr; - - _created = false; + if (_created) + { + free(_img8_1); + _img8 = nullptr; + _created = false; + } } diff --git a/TFT_eSPI.h b/TFT_eSPI.h index 5efe061..10b6754 100644 --- a/TFT_eSPI.h +++ b/TFT_eSPI.h @@ -16,7 +16,7 @@ #ifndef _TFT_eSPIH_ #define _TFT_eSPIH_ -#define TFT_ESPI_VERSION "2.2.18" +#define TFT_ESPI_VERSION "2.2.19" /*************************************************************************************** ** Section 1: Load required header files diff --git a/library.json b/library.json index 2928b13..7a8389f 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "TFT_eSPI", - "version": "2.2.18", + "version": "2.2.19", "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": diff --git a/library.properties b/library.properties index 8ab3ac1..4e053eb 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TFT_eSPI -version=2.2.18 +version=2.2.19 author=Bodmer maintainer=Bodmer sentence=TFT graphics library for Arduino processors with performance optimisation for STM32, ESP8266 and ESP32