From 44471a66f6206a22113bc7996575e766f6f5594a Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 26 Aug 2024 00:25:35 +1000 Subject: [PATCH] dep/imgui: Don't copy the font data on building For the CJK and SVG fonts, this is a **considerable** memory allocation and copy, up to 20MB+. We really don't want to be doing this unnecessarily, since we keep the buffer around anyway. --- dep/imgui/src/imgui_draw.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dep/imgui/src/imgui_draw.cpp b/dep/imgui/src/imgui_draw.cpp index 5e1538add..9a8395e48 100644 --- a/dep/imgui/src/imgui_draw.cpp +++ b/dep/imgui/src/imgui_draw.cpp @@ -2504,12 +2504,15 @@ ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg) ImFontConfig& new_font_cfg = ConfigData.back(); if (new_font_cfg.DstFont == NULL) new_font_cfg.DstFont = Fonts.back(); +#if 0 + // DUCKSTATION-CHANGE: We maintain the allocations ourselves. Saves copying 14MB or so. if (!new_font_cfg.FontDataOwnedByAtlas) { new_font_cfg.FontData = IM_ALLOC(new_font_cfg.FontDataSize); new_font_cfg.FontDataOwnedByAtlas = true; memcpy(new_font_cfg.FontData, font_cfg->FontData, (size_t)new_font_cfg.FontDataSize); } +#endif if (new_font_cfg.DstFont->EllipsisChar == (ImWchar)-1) new_font_cfg.DstFont->EllipsisChar = font_cfg->EllipsisChar;