From 8071ceabf4811c5405a0977b3e34e24d4e068dce Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 28 Apr 2024 02:12:02 +0200 Subject: [PATCH] minor fix in drawutils --- source/utils/DrawUtils.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/utils/DrawUtils.cpp b/source/utils/DrawUtils.cpp index 2c438da..d1684ca 100644 --- a/source/utils/DrawUtils.cpp +++ b/source/utils/DrawUtils.cpp @@ -305,12 +305,6 @@ void DrawUtils::print(uint32_t x, uint32_t y, const wchar_t *string, bool alignR textureWidth = (mtx.minWidth + 3) & ~3; textureHeight = mtx.minHeight; - SFT_Image img = { - .pixels = nullptr, - .width = textureWidth, - .height = textureHeight, - }; - if (textureWidth == 0) { textureWidth = 4; } @@ -318,6 +312,12 @@ void DrawUtils::print(uint32_t x, uint32_t y, const wchar_t *string, bool alignR textureHeight = 4; } + SFT_Image img = { + .pixels = nullptr, + .width = textureWidth, + .height = textureHeight, + }; + auto buffer = make_unique_nothrow((uint32_t) (img.width * img.height)); if (!buffer) { DEBUG_FUNCTION_LINE_ERR("Failed to allocate memory for glyph");