ソースを参照

ImFontAtlas: made calling ClearFonts() call ClearInputData(). (#8174, #6556, #6336, #4723)

ocornut 7 ヶ月 前
コミット
10199341b1
3 ファイル変更5 行追加2 行削除
  1. 3 1
      docs/CHANGELOG.txt
  2. 1 1
      imgui.h
  3. 1 0
      imgui_draw.cpp

+ 3 - 1
docs/CHANGELOG.txt

@@ -54,7 +54,6 @@ Breaking changes:
 
 Other changes:
 
-- ImDrawList: texture baked storage for thick line reduced from ~64x64 to ~32x32. (#3245)
 - imgui_freetype: fixed issue where glyph advances would incorrectly be
   snapped to pixels. Effectively it would only be noticeable when hinting
   is disabled with ImGuiFreeTypeBuilderFlags_NoHinting, as hinting itself
@@ -74,6 +73,9 @@ Other changes:
   increased default rounding (style.TabRounding). (#8334) [@Kian738, @ocornut]
   styles as the current look is not right (but ImGuiCol_TabSelectedOverline stays the same).
 - Debug Tools: Tweaked font preview.
+- ImDrawList: texture baked storage for thick line reduced from ~64x64 to ~32x32. (#3245)
+- ImFontAtlas: made calling ClearFonts() call ClearInputData(), as calling
+  one without the other is never correct. (#8174, #6556, #6336, #4723)
 - Examples: DirectX12: Reduced number of frame in flight from 3 to 2 in
   provided example, to reduce latency.
 - Examples: Vulkan: better handle VK_SUBOPTIMAL_KHR being returned by

+ 1 - 1
imgui.h

@@ -3355,8 +3355,8 @@ struct ImFontAtlas
     IMGUI_API ImFont*           AddFontFromMemoryCompressedTTF(const void* compressed_font_data, int compressed_font_data_size, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // 'compressed_font_data' still owned by caller. Compress with binary_to_compressed_c.cpp.
     IMGUI_API ImFont*           AddFontFromMemoryCompressedBase85TTF(const char* compressed_font_data_base85, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL);              // 'compressed_font_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 parameter.
     IMGUI_API void              ClearInputData();           // Clear input data (all ImFontConfig structures including sizes, TTF data, glyph ranges, etc.) = all the data used to build the texture and fonts.
+    IMGUI_API void              ClearFonts();               // Clear input+output font data (same as ClearInputData() + glyphs storage, UV coordinates).
     IMGUI_API void              ClearTexData();             // Clear output texture data (CPU side). Saves RAM once the texture has been copied to graphics memory.
-    IMGUI_API void              ClearFonts();               // Clear output font data (glyphs storage, UV coordinates).
     IMGUI_API void              Clear();                    // Clear all input and output.
 
     // Build atlas, retrieve pixel data.

+ 1 - 0
imgui_draw.cpp

@@ -2520,6 +2520,7 @@ void    ImFontAtlas::ClearTexData()
 void    ImFontAtlas::ClearFonts()
 {
     IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!");
+    ClearInputData();
     Fonts.clear_delete();
     TexReady = false;
 }