Imgui: ImDrawList::ChannelsMerge no longer honor clip planes

Created on 14 Jun 2019  路  5Comments  路  Source: ocornut/imgui

Affected Version: ImGui 1.71 (tag)
Branch: master
Compiler: any
Operating System: any

Pushing custom clip plane appears to break channel splitter. I'm pushing clip rectangle (0, 0, 300, 300) and drawing a filled rectangle in (0, 0, 100, 100).
This is the result:
image

But when I split channels and draw to non-zero channel rectangle is no longer drawn.
image

Issue is not present on 1.70.

Repro:

ImGui::SetNextWindowSize(ImVec2(200, 200));
ImGui::Begin("Example Bug");
auto draw_list = ImGui::GetWindowDrawList();

static bool split = false;
ImGui::Checkbox("Split channels", &split);

draw_list->PushClipRect(ImVec2(0.0f, 0.0f), ImVec2(300, 300));

if (split)
{
    draw_list->ChannelsSplit(2);
    draw_list->ChannelsSetCurrent(1);
}

draw_list->AddRectFilled(ImVec2(0, 0), ImVec2(100, 100), IM_COL32(255, 0, 0, 160), 5.0f);

if (split)
    draw_list->ChannelsMerge();

draw_list->PopClipRect();
ImGui::End();
bug drawindrawlist

All 5 comments

I found cef88f6aae52bf0e9e558ea5e30eca95676f439b introduced this bug.

Fixed now, apologies.
As you can see the initial value for last_cmd was wrong, so it would break merging commands between channel 0 and 1 (in my uses it was always merging after channel 1).
Thanks for reporting!

Thank you!

Thank you for staying up to date, your comments are precious!

I have one more mundane. I think ImDrawListSplitter is spelled wrong in commit message. : )

Was this page helpful?
0 / 5 - 0 ratings