mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-09 23:54:20 +00:00
Textures: Added atlas's TexMinWidth/TexMinHeight/TexMaxWidth/TexMaxHeight.
Fixed ImFontAtlasBuildGetTextureSizeEstimate(). Basic error handling on OOM.
This commit is contained in:
parent
14614f561b
commit
2137b3448b
4 changed files with 43 additions and 9 deletions
|
|
@ -509,6 +509,13 @@ bool ImGui_ImplFreeType_FontAddGlyph(ImFontAtlas* atlas, ImFont* font, ImFontCon
|
|||
if (is_visible)
|
||||
{
|
||||
ImFontAtlasRectId pack_id = ImFontAtlasPackAddRect(atlas, w, h);
|
||||
if (pack_id < 0)
|
||||
{
|
||||
// Pathological out of memory case (TexMaxWidth/TexMaxHeight set too small?)
|
||||
IM_ASSERT_USER_ERROR(pack_id >= 0, "Out of texture memory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
ImFontAtlasRect* r = ImFontAtlasPackGetRect(atlas, pack_id);
|
||||
font->MetricsTotalSurface += w * h;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue