DrawList: added PushDrawFlag(), PopDrawFlag(), ImSmallStack_<>

This commit is contained in:
ocornut
2026-07-28 15:48:40 +02:00
parent 59014d15e7
commit fb9fd9a250
5 changed files with 52 additions and 18 deletions

View File

@@ -10488,8 +10488,8 @@ static void ShowExampleAppCustomRendering(bool* p_open)
ImGui::PopID();
ImGui::Spacing();
ImDrawFlags backup_draw_list_flags = draw_list->Flags;
draw_list->Flags = (draw_list->Flags & ~ImDrawFlags_AllowedInScope_) | scope_flags; // Equivalent to an hypothetical PushDrawFlags() API
draw_list->PushDrawFlag(ImDrawFlags_AllowedInScope_, false); // Reset all existing (very unusual: done for this demo)
draw_list->PushDrawFlag(scope_flags, true);
const ImDrawFlags flags = prim_stroke_flags | prim_other_flags;
const ImDrawFlags fill_flags = flags & (ImDrawFlags_AAFill | ImDrawFlags_UseTexForRoundCorners);
@@ -10622,11 +10622,12 @@ static void ShowExampleAppCustomRendering(bool* p_open)
}
ImGui::Dummy(ImVec2((sz + spacing) * 15.0f, (sz + spacing) * 4.0f));
draw_list->PopDrawFlag();
draw_list->PopDrawFlag();
ImGui::PopItemFlag();
ImGui::PopItemWidth();
ImGui::EndTabItem();
draw_list->Flags = backup_draw_list_flags;
}
if (ImGui::BeginTabItem("Canvas"))