diff --git a/imgui.h b/imgui.h index 7a57732e6..b733544ac 100644 --- a/imgui.h +++ b/imgui.h @@ -3623,7 +3623,6 @@ struct ImFontAtlas int RefCount; // Number of contexts using this atlas int _PackedSurface; // Number of packed pixels. Used when compacting to heuristically find the ideal texture size. int _PackedRects; // Number of packed rectangles. - float _PackNodesFactor = 1.0f; // [Obsolete] //int TexDesiredWidth; // OBSOLETED in 1.91.5 (force texture width before calling Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index ae63798f9..d100d7e08 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -2579,7 +2579,6 @@ ImFontAtlas::ImFontAtlas() TexGlyphPadding = 1; TexRef._TexData = NULL;// this; TexNextUniqueID = 1; - _PackNodesFactor = 1.0f; Builder = NULL; } @@ -3742,11 +3741,8 @@ void ImFontAtlasPackInit(ImFontAtlas* atlas) ImTextureData* tex = atlas->TexData; ImFontAtlasBuilder* builder = atlas->Builder; - // FIXME-NEWATLAS-V2: Expose other glyph padding settings for custom alteration (e.g. drop shadows). See #7962 - // FIXME-NEWATLAS-V2: Experiment with number of nodes. 2024-11-05: Seems to be quite fine to reduce this. - //int pack_padding = atlas->TexGlyphPadding; + // In theory we could decide to reduce the number of nodes, e.g. halve them, and waste a little texture space, but it doesn't seem worth it. int pack_node_count = tex->Width; - //pack_node_count *= atlas->_PackNodesFactor; builder->PackNodes.resize(pack_node_count); IM_STATIC_ASSERT(sizeof(stbrp_context) <= sizeof(stbrp_context_opaque)); stbrp_init_target((stbrp_context*)(void*)&builder->PackContext, tex->Width, tex->Height, builder->PackNodes.Data, builder->PackNodes.Size); @@ -3756,6 +3752,7 @@ void ImFontAtlasPackInit(ImFontAtlas* atlas) } // Important: Calling this may recreate a new texture and therefore change atlas->TexData +// FIXME-NEWATLAS-V2: Expose other glyph padding settings for custom alteration (e.g. drop shadows). See #7962 ImFontAtlasRectId ImFontAtlasPackAddRect(ImFontAtlas* atlas, int w, int h) { IM_ASSERT(w > 0 && w <= 0xFFFF); @@ -3857,7 +3854,7 @@ void ImFontAtlasDebugLogTextureRequests(ImFontAtlas* atlas) for (const ImTextureRect& r : tex->Updates) { IM_ASSERT(r.x >= 0 && r.y >= 0); - IM_ASSERT(r.x + r.w < tex->Width && r.y + r.h < tex->Height); + IM_ASSERT(r.x + r.w <= tex->Width && r.y + r.h <= tex->Height); // In theory should subtract PackPadding but it's currently part of atlas and mid-frame change would wreck assert. //IMGUI_DEBUG_LOG_FONT("[font] Texture #%03d: update (% 4d..%-4d)->(% 4d..%-4d), texid=0x%" IM_PRIX64 ", backend_data=0x%" IM_PRIX64 "\n", tex->UniqueID, r.x, r.y, r.x + r.w, r.y + r.h, tex->TexID, (ImU64)(intptr_t)tex->BackendUserData); } }