gfx_print: use global buffer instead of allocating it to the stack

replace/95788b1dd3c5258a505b18a7e91389da406c8cda
Federico Amedeo Izzo 2021-04-05 10:00:35 +02:00
rodzic 341ab84ce9
commit 0e33848d68
1 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -95,6 +95,7 @@ bw_t _color2bw(color_t true_color)
bool initialized = 0; bool initialized = 0;
PIXEL_T *buf; PIXEL_T *buf;
uint16_t fbSize; uint16_t fbSize;
char text[32];
void gfx_init() void gfx_init()
{ {
@ -111,6 +112,8 @@ void gfx_init()
if((fbSize * 8) < (SCREEN_HEIGHT * SCREEN_WIDTH)) fbSize += 1; if((fbSize * 8) < (SCREEN_HEIGHT * SCREEN_WIDTH)) fbSize += 1;
fbSize *= sizeof(uint8_t); fbSize *= sizeof(uint8_t);
#endif #endif
// Clear text buffer
memset(text, 0x00, 32);
} }
void gfx_terminate() void gfx_terminate()
@ -386,9 +389,7 @@ point_t gfx_print(point_t start, fontSize_t size, textAlign_t alignment,
color_t color, const char *fmt, ... ) color_t color, const char *fmt, ... )
{ {
va_list ap; va_list ap;
char text[128];
va_start(ap, fmt); va_start(ap, fmt);
vsnprintf(text, sizeof(text)-1, fmt, ap); vsnprintf(text, sizeof(text)-1, fmt, ap);
va_end(ap); va_end(ap);