mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-08-03 12:44:46 +02:00
@@ -223,6 +223,8 @@ void* TFT_eSprite::callocSprite(int16_t w, int16_t h, uint8_t frames)
|
||||
***************************************************************************************/
|
||||
void TFT_eSprite::createPalette(uint16_t colorMap[], uint8_t colors)
|
||||
{
|
||||
if (!_created) return;
|
||||
|
||||
if (colorMap == nullptr)
|
||||
{
|
||||
// Create a color map using the default FLASH map
|
||||
@@ -249,6 +251,8 @@ void TFT_eSprite::createPalette(uint16_t colorMap[], uint8_t colors)
|
||||
***************************************************************************************/
|
||||
void TFT_eSprite::createPalette(const uint16_t colorMap[], uint8_t colors)
|
||||
{
|
||||
if (!_created) return;
|
||||
|
||||
if (colorMap == nullptr)
|
||||
{
|
||||
// Create a color map using the default FLASH map
|
||||
@@ -305,13 +309,9 @@ void* TFT_eSprite::setColorDepth(int8_t b)
|
||||
else if ( b > 1 ) _bpp = 4;
|
||||
else _bpp = 1;
|
||||
|
||||
// Can't change an existing sprite's colour depth so delete it
|
||||
if (_created) free(_img8_1);
|
||||
|
||||
// If it existed, re-create the sprite with the new colour depth
|
||||
if (_created)
|
||||
{
|
||||
_created = false;
|
||||
// Can't change an existing sprite's colour depth so delete and create a new one
|
||||
if (_created) {
|
||||
deleteSprite();
|
||||
return createSprite(_dwidth, _dheight);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user