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

Fonts: Basic heuristic to repack instead of growing. Moved rects count/surface to internals.

This commit is contained in:
ocornut 2025-01-13 17:56:36 +01:00
parent 2137b3448b
commit 8ed4e2dde7
4 changed files with 27 additions and 15 deletions

View file

@ -3685,6 +3685,8 @@ struct ImFontAtlasBuilder
ImVector<ImFontAtlasRectEntry> RectsIndex; // ImFontAtlasRectId -> index into Rects[]
ImVector<unsigned char> TempBuffer; // Misc scratch buffer
int RectsIndexFreeListStart;// First unused entry
int RectsPackedCount; // Number of packed rectangles.
int RectsPackedSurface; // Number of packed pixels. Used when compacting to heuristically find the ideal texture size.
int RectsDiscardedCount;
int RectsDiscardedSurface;
ImVec2i MaxRectSize; // Largest rectangle to pack (de-facto used as a "minimum texture size")
@ -3709,6 +3711,7 @@ IMGUI_API void ImFontAtlasBuildInit(ImFontAtlas* atlas);
IMGUI_API void ImFontAtlasBuildDestroy(ImFontAtlas* atlas);
IMGUI_API ImTextureData* ImFontAtlasBuildAddTexture(ImFontAtlas* atlas, int w, int h);
IMGUI_API void ImFontAtlasBuildMakeSpace(ImFontAtlas* atlas);
IMGUI_API void ImFontAtlasBuildRepackTexture(ImFontAtlas* atlas, int w, int h);
IMGUI_API void ImFontAtlasBuildGrowTexture(ImFontAtlas* atlas, int old_w = -1, int old_h = -1);
IMGUI_API void ImFontAtlasBuildCompactTexture(ImFontAtlas* atlas);