5 pixels too wide? also cleaned up tft_espi further and readded comic font

This commit is contained in:
2026-01-10 11:09:11 +01:00
parent 1d053c5dd7
commit 6bd9d1a93b
11 changed files with 1042 additions and 118 deletions
-13
View File
@@ -155,19 +155,6 @@ void TFT_eSPI::loadMetrics(void)
uint32_t headerPtr = 24;
uint32_t bitmapPtr = headerPtr + gFont.gCount * 28;
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
if ( psramFound() )
{
gUnicode = (uint16_t*)ps_malloc( gFont.gCount * 2); // Unicode 16-bit Basic Multilingual Plane (0-FFFF)
gHeight = (uint8_t*)ps_malloc( gFont.gCount ); // Height of glyph
gWidth = (uint8_t*)ps_malloc( gFont.gCount ); // Width of glyph
gxAdvance = (uint8_t*)ps_malloc( gFont.gCount ); // xAdvance - to move x cursor
gdY = (int16_t*)ps_malloc( gFont.gCount * 2); // offset from bitmap top edge from lowest point in any character
gdX = (int8_t*)ps_malloc( gFont.gCount ); // offset for bitmap left edge relative to cursor X
gBitmap = (uint32_t*)ps_malloc( gFont.gCount * 4); // seek pointer to glyph bitmap in the file
}
else
#endif
{
gUnicode = (uint16_t*)malloc( gFont.gCount * 2); // Unicode 16-bit Basic Multilingual Plane (0-FFFF)
gHeight = (uint8_t*)malloc( gFont.gCount ); // Height of glyph
-22
View File
@@ -35,8 +35,6 @@ TFT_eSprite::TFT_eSprite(TFT_eSPI *tft)
_yptr = 0;
_colorMap = nullptr;
_psram_enable = true;
// Ensure end_tft_write() does nothing in inherited functions.
lockTransaction = true;
@@ -162,14 +160,6 @@ void* TFT_eSprite::callocSprite(int16_t w, int16_t h, uint8_t frames)
if (_bpp == 16)
{
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
if ( psramFound() && _psram_enable && !_tft->DMA_Enabled)
{
ptr8 = ( uint8_t*) ps_calloc(frames * w * h + frames, sizeof(uint16_t));
//Serial.println("PSRAM");
}
else
#endif
{
ptr8 = ( uint8_t*) calloc(frames * w * h + frames, sizeof(uint16_t));
//Serial.println("Normal RAM");
@@ -178,10 +168,6 @@ void* TFT_eSprite::callocSprite(int16_t w, int16_t h, uint8_t frames)
else if (_bpp == 8)
{
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
if ( psramFound() && _psram_enable ) ptr8 = ( uint8_t*) ps_calloc(frames * w * h + frames, sizeof(uint8_t));
else
#endif
ptr8 = ( uint8_t*) calloc(frames * w * h + frames, sizeof(uint8_t));
}
@@ -189,10 +175,6 @@ void* TFT_eSprite::callocSprite(int16_t w, int16_t h, uint8_t frames)
{
w = (w+1) & 0xFFFE; // width needs to be multiple of 2, with an extra "off screen" pixel
_iwidth = w;
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
if ( psramFound() && _psram_enable ) ptr8 = ( uint8_t*) ps_calloc(((frames * w * h) >> 1) + frames, sizeof(uint8_t));
else
#endif
ptr8 = ( uint8_t*) calloc(((frames * w * h) >> 1) + frames, sizeof(uint8_t));
}
@@ -206,10 +188,6 @@ void* TFT_eSprite::callocSprite(int16_t w, int16_t h, uint8_t frames)
_iwidth = w; // _iwidth is rounded up to be multiple of 8, so might not be = _dwidth
_bitwidth = w; // _bitwidth will not be rotated whereas _iwidth may be
#if defined (ESP32) && defined (CONFIG_SPIRAM_SUPPORT)
if ( psramFound() && _psram_enable ) ptr8 = ( uint8_t*) ps_calloc(frames * (w>>3) * h + frames, sizeof(uint8_t));
else
#endif
ptr8 = ( uint8_t*) calloc(frames * (w>>3) * h + frames, sizeof(uint8_t));
}