mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-08-03 20:54:42 +02:00
Fix #2376
This commit is contained in:
@@ -223,11 +223,6 @@ void* TFT_eSprite::callocSprite(int16_t w, int16_t h, uint8_t frames)
|
|||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
void TFT_eSprite::createPalette(uint16_t colorMap[], uint8_t colors)
|
void TFT_eSprite::createPalette(uint16_t colorMap[], uint8_t colors)
|
||||||
{
|
{
|
||||||
if (_colorMap != nullptr)
|
|
||||||
{
|
|
||||||
free(_colorMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (colorMap == nullptr)
|
if (colorMap == nullptr)
|
||||||
{
|
{
|
||||||
// Create a color map using the default FLASH map
|
// Create a color map using the default FLASH map
|
||||||
@@ -236,7 +231,7 @@ void TFT_eSprite::createPalette(uint16_t colorMap[], uint8_t colors)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Allocate and clear memory for 16 color map
|
// Allocate and clear memory for 16 color map
|
||||||
_colorMap = (uint16_t *)calloc(16, sizeof(uint16_t));
|
if (_colorMap == nullptr) _colorMap = (uint16_t *)calloc(16, sizeof(uint16_t));
|
||||||
|
|
||||||
if (colors > 16) colors = 16;
|
if (colors > 16) colors = 16;
|
||||||
|
|
||||||
@@ -261,7 +256,7 @@ void TFT_eSprite::createPalette(const uint16_t colorMap[], uint8_t colors)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Allocate and clear memory for 16 color map
|
// Allocate and clear memory for 16 color map
|
||||||
_colorMap = (uint16_t *)calloc(16, sizeof(uint16_t));
|
if (_colorMap == nullptr) _colorMap = (uint16_t *)calloc(16, sizeof(uint16_t));
|
||||||
|
|
||||||
if (colors > 16) colors = 16;
|
if (colors > 16) colors = 16;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user