1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-09 23:54:20 +00:00

Fonts: remove unnecessary ImDrawListSharedData::FontAtlas which is actually getting in the way of using multiple atlases.

This commit is contained in:
ocornut 2025-05-09 22:46:39 +02:00
parent 46fa9e8efb
commit 65e6039979
2 changed files with 2 additions and 6 deletions

View file

@ -3865,16 +3865,14 @@ void ImFontAtlasBuildDiscardBakes(ImFontAtlas* atlas, int unused_frames)
// Those functions are designed to facilitate changing the underlying structures for ImFontAtlas to store an array of ImDrawListSharedData*
void ImFontAtlasAddDrawListSharedData(ImFontAtlas* atlas, ImDrawListSharedData* data)
{
IM_ASSERT(!atlas->DrawListSharedDatas.contains(data) && data->FontAtlas == NULL);
IM_ASSERT(!atlas->DrawListSharedDatas.contains(data));
atlas->DrawListSharedDatas.push_back(data);
data->FontAtlas = atlas;
}
void ImFontAtlasRemoveDrawListSharedData(ImFontAtlas* atlas, ImDrawListSharedData* data)
{
IM_ASSERT(atlas->DrawListSharedDatas.contains(data) && data->FontAtlas == atlas);
IM_ASSERT(atlas->DrawListSharedDatas.contains(data));
atlas->DrawListSharedDatas.find_erase(data);
data->FontAtlas = NULL;
}
// Update texture identifier in all active draw lists
@ -3902,7 +3900,6 @@ void ImFontAtlasUpdateDrawListsSharedData(ImFontAtlas* atlas)
{
for (ImDrawListSharedData* shared_data : atlas->DrawListSharedDatas)
{
shared_data->FontAtlas = atlas;
shared_data->TexUvWhitePixel = atlas->TexUvWhitePixel;
shared_data->TexUvLines = atlas->TexUvLines;
}

View file

@ -838,7 +838,6 @@ struct IMGUI_API ImDrawListSharedData
{
ImVec2 TexUvWhitePixel; // UV of white pixel in the atlas (== FontAtlas->TexUvWhitePixel)
const ImVec4* TexUvLines; // UV of anti-aliased lines in the atlas (== FontAtlas->TexUvLines)
ImFontAtlas* FontAtlas; // Current font atlas
ImFont* Font; // Current/default font (optional, for simplified AddText overload)
float FontSize; // Current/default font size (optional, for simplified AddText overload)
float FontScale; // Current/default font scale (== FontSize / Font->FontSize)