impr: Drastically reduce font-related memory usage

This commit is contained in:
WerWolv
2025-02-10 12:02:05 +01:00
parent e1580e51cf
commit 02b5df03ab
4 changed files with 41 additions and 4 deletions

View File

@@ -334,6 +334,9 @@ namespace hex {
}
void Window::frameBegin() {
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
// Create font textures if necessary
{
const auto &fontDefinitions = ImHexApi::Fonts::impl::getFontDefinitions();
@@ -345,6 +348,8 @@ namespace hex {
currentFont = font->ContainerAtlas;
ImGui_ImplOpenGL3_CreateFontsTexture();
currentFont->ClearInputData();
currentFont->ClearTexData();
}
{
@@ -359,6 +364,8 @@ namespace hex {
cfg.SizePixels = ImHexApi::Fonts::DefaultFontSize;
io.Fonts->AddFontDefault(&cfg);
ImGui_ImplOpenGL3_CreateFontsTexture();
io.Fonts->ClearInputData();
io.Fonts->ClearTexData();
} else {
currentFont = font->ContainerAtlas;
}
@@ -366,8 +373,7 @@ namespace hex {
}
// Start new ImGui Frame
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
TutorialManager::drawTutorial();