minor fix in drawutils

This commit is contained in:
Maschell 2024-04-28 02:12:02 +02:00
parent 958ba503c8
commit 8071ceabf4

View File

@ -305,12 +305,6 @@ void DrawUtils::print(uint32_t x, uint32_t y, const wchar_t *string, bool alignR
textureWidth = (mtx.minWidth + 3) & ~3; textureWidth = (mtx.minWidth + 3) & ~3;
textureHeight = mtx.minHeight; textureHeight = mtx.minHeight;
SFT_Image img = {
.pixels = nullptr,
.width = textureWidth,
.height = textureHeight,
};
if (textureWidth == 0) { if (textureWidth == 0) {
textureWidth = 4; textureWidth = 4;
} }
@ -318,6 +312,12 @@ void DrawUtils::print(uint32_t x, uint32_t y, const wchar_t *string, bool alignR
textureHeight = 4; textureHeight = 4;
} }
SFT_Image img = {
.pixels = nullptr,
.width = textureWidth,
.height = textureHeight,
};
auto buffer = make_unique_nothrow<uint8_t[]>((uint32_t) (img.width * img.height)); auto buffer = make_unique_nothrow<uint8_t[]>((uint32_t) (img.width * img.height));
if (!buffer) { if (!buffer) {
DEBUG_FUNCTION_LINE_ERR("Failed to allocate memory for glyph"); DEBUG_FUNCTION_LINE_ERR("Failed to allocate memory for glyph");