Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ImDrawList::ChannelsMerge no longer honor clip planes #2624

Closed
thedmd opened this issue Jun 13, 2019 · 5 comments
Closed

ImDrawList::ChannelsMerge no longer honor clip planes #2624

thedmd opened this issue Jun 13, 2019 · 5 comments

Comments

@thedmd
Copy link
Contributor

thedmd commented Jun 13, 2019

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();
@thedmd
Copy link
Contributor Author

thedmd commented Jun 13, 2019

I found cef88f6 introduced this bug.

ocornut added a commit that referenced this issue Jun 14, 2019
…erging draw commands between channels 0 and 1. (#2624) Introduced by cef88f6.
@ocornut
Copy link
Owner

ocornut commented Jun 14, 2019

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!

@ocornut ocornut closed this as completed Jun 14, 2019
@ocornut ocornut added the bug label Jun 14, 2019
@thedmd
Copy link
Contributor Author

thedmd commented Jun 14, 2019

Thank you!

@ocornut
Copy link
Owner

ocornut commented Jun 14, 2019

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

@thedmd
Copy link
Contributor Author

thedmd commented Jun 14, 2019

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants