Skip to content

Commit

Permalink
Internals: Disable 0xCC stack fill for ItemAdd()/ItemSize().
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed May 31, 2024
1 parent 854e21d commit 0fce21e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10120,6 +10120,7 @@ void ImGui::KeepAliveID(ImGuiID id)
// Note that the size can be different than the one provided to ItemSize(). Typically, widgets that spread over available surface
// declare their minimum size requirement to ItemSize() and provide a larger region to ItemAdd() which is used drawing/interaction.
// THIS IS IN THE PERFORMANCE CRITICAL PATH (UNTIL THE CLIPPING TEST AND EARLY-RETURN)
IM_MSVC_RUNTIME_CHECKS_OFF
bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGuiItemFlags extra_flags)
{
ImGuiContext& g = *GImGui;
Expand Down Expand Up @@ -10207,7 +10208,7 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGu
g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredRect;
return true;
}

IM_MSVC_RUNTIME_CHECKS_RESTORE

//-----------------------------------------------------------------------------
// [SECTION] LAYOUT
Expand Down Expand Up @@ -10244,6 +10245,7 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGu
// Register minimum needed size so it can extend the bounding box used for auto-fit calculation.
// See comments in ItemAdd() about how/why the size provided to ItemSize() vs ItemAdd() may often different.
// THIS IS IN THE PERFORMANCE CRITICAL PATH.
IM_MSVC_RUNTIME_CHECKS_OFF
void ImGui::ItemSize(const ImVec2& size, float text_baseline_y)
{
ImGuiContext& g = *GImGui;
Expand Down Expand Up @@ -10279,6 +10281,7 @@ void ImGui::ItemSize(const ImVec2& size, float text_baseline_y)
if (window->DC.LayoutType == ImGuiLayoutType_Horizontal)
SameLine();
}
IM_MSVC_RUNTIME_CHECKS_RESTORE

// Gets back to previous line and continue with horizontal layout
// offset_from_start_x == 0 : follow right after previous item
Expand Down

0 comments on commit 0fce21e

Please sign in to comment.