mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Fonts: ImFontAtlas accept DrawListSharedData not being set.
This commit is contained in:
parent
43cc3fc8b1
commit
ac13683c26
1 changed files with 10 additions and 3 deletions
|
|
@ -2629,9 +2629,12 @@ void ImFontAtlas::ClearFonts()
|
|||
ClearInputData();
|
||||
Fonts.clear_delete();
|
||||
TexIsBuilt = false;
|
||||
if (DrawListSharedData)
|
||||
{
|
||||
DrawListSharedData->Font = NULL;
|
||||
DrawListSharedData->FontScale = DrawListSharedData->FontSize = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void ImFontAtlas::Clear()
|
||||
{
|
||||
|
|
@ -3155,7 +3158,7 @@ bool ImFontAtlas::Build()
|
|||
|
||||
// [LEGACY] For backends not supporting RendererHasTextures: preload all glyphs
|
||||
ImFontAtlasBuildUpdateRendererHasTexturesFromContext(this);
|
||||
if (DrawListSharedData->RendererHasTextures == false) // ~ImGuiBackendFlags_RendererHasTextures
|
||||
if (DrawListSharedData && DrawListSharedData->RendererHasTextures == false) // ~ImGuiBackendFlags_RendererHasTextures
|
||||
ImFontAtlasBuildPreloadAllGlyphRanges(this);
|
||||
TexIsBuilt = true;
|
||||
|
||||
|
|
@ -3493,6 +3496,8 @@ void ImFontAtlasRemoveDrawListSharedData(ImFontAtlas* atlas, ImDrawListSharedDat
|
|||
void ImFontAtlasUpdateDrawListsTextures(ImFontAtlas* atlas, ImTextureRef old_tex, ImTextureRef new_tex)
|
||||
{
|
||||
ImDrawListSharedData* shared_data = atlas->DrawListSharedData;
|
||||
if (shared_data == NULL)
|
||||
return;
|
||||
for (ImDrawList* draw_list : shared_data->DrawLists)
|
||||
{
|
||||
// Replace in command-buffer
|
||||
|
|
@ -3512,6 +3517,8 @@ void ImFontAtlasUpdateDrawListsTextures(ImFontAtlas* atlas, ImTextureRef old_tex
|
|||
void ImFontAtlasUpdateDrawListsSharedData(ImFontAtlas* atlas)
|
||||
{
|
||||
ImDrawListSharedData* shared_data = atlas->DrawListSharedData;
|
||||
if (shared_data == NULL)
|
||||
return;
|
||||
shared_data->FontAtlas = atlas;
|
||||
shared_data->TexUvWhitePixel = atlas->TexUvWhitePixel;
|
||||
shared_data->TexUvLines = atlas->TexUvLines;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue