Fonts: proof of concept support for user textures.

# Conflicts:
#	imgui.h
#	imgui_internal.h
This commit is contained in:
ocornut
2025-05-12 10:22:15 +02:00
committed by ocornut
parent 91ed6e67b4
commit 39f6c793b3
3 changed files with 22 additions and 1 deletions

View File

@@ -5231,6 +5231,8 @@ static void ImGui::UpdateTexturesEndFrame()
tex->RefCount = (unsigned short)atlas->RefCount;
g.PlatformIO.Textures.push_back(tex);
}
for (ImTextureData* tex : g.UserTextures)
g.PlatformIO.Textures.push_back(tex);
}
// Called once a frame. Followed by SetCurrentFont() which sets up the remaining data.
@@ -8613,6 +8615,19 @@ void ImGui::UpdateFontsEndFrame()
PopFont();
}
void ImGui::RegisterUserTexture(ImTextureData* tex)
{
ImGuiContext& g = *GImGui;
IM_ASSERT(tex->RefCount > 0);
g.UserTextures.push_back(tex);
}
void ImGui::UnregisterUserTexture(ImTextureData* tex)
{
ImGuiContext& g = *GImGui;
g.UserTextures.find_erase(tex);
}
void ImGui::RegisterFontAtlas(ImFontAtlas* atlas)
{
ImGuiContext& g = *GImGui;