mirror of
https://github.com/ocornut/imgui.git
synced 2025-10-26 12:27:30 +00:00
DrawList, Fonts: fixed ImFontAtlasTextureRepack() overwriting draw list shared data UV's etc. even when not bound. (#8694, #8465)
ImFontAtlasUpdateDrawListsSharedData() call from ImFontAtlasTextureRepack() would trigger this. For simplicity we also track current atlas in ImDrawListSharedData, but we could probably use Font->ContainerAtlas.
This commit is contained in:
@@ -2694,10 +2694,11 @@ void ImFontAtlas::ClearFonts()
|
||||
Fonts.clear_delete();
|
||||
TexIsBuilt = false;
|
||||
for (ImDrawListSharedData* shared_data : DrawListSharedDatas)
|
||||
{
|
||||
shared_data->Font = NULL;
|
||||
shared_data->FontScale = shared_data->FontSize = 0.0f;
|
||||
}
|
||||
if (shared_data->FontAtlas == this)
|
||||
{
|
||||
shared_data->Font = NULL;
|
||||
shared_data->FontScale = shared_data->FontSize = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
static void ImFontAtlasBuildUpdateRendererHasTexturesFromContext(ImFontAtlas* atlas)
|
||||
@@ -3914,10 +3915,11 @@ void ImFontAtlasUpdateDrawListsTextures(ImFontAtlas* atlas, ImTextureRef old_tex
|
||||
void ImFontAtlasUpdateDrawListsSharedData(ImFontAtlas* atlas)
|
||||
{
|
||||
for (ImDrawListSharedData* shared_data : atlas->DrawListSharedDatas)
|
||||
{
|
||||
shared_data->TexUvWhitePixel = atlas->TexUvWhitePixel;
|
||||
shared_data->TexUvLines = atlas->TexUvLines;
|
||||
}
|
||||
if (shared_data->FontAtlas == atlas)
|
||||
{
|
||||
shared_data->TexUvWhitePixel = atlas->TexUvWhitePixel;
|
||||
shared_data->TexUvLines = atlas->TexUvLines;
|
||||
}
|
||||
}
|
||||
|
||||
// Set current texture. This is mostly called from AddTexture() + to handle a failed resize.
|
||||
|
||||
Reference in New Issue
Block a user