#9601
Widgets, Columns: fixed rounding of negative screen positions
This PR fixes incorrect rounding of negative coordinates in some widgets. This could cause elements to be drawn one pixel away from their correct position. The fix makes rounding work correctly for both positive and negative coordinates.
// Same window at a positive and a negative position, vertices compared relative to the window.
ImGui::GetStyle().FramePadding.y = 3.5f; // 20 px frame with the default 13 px font
ImGui::SetNextWindowPos(pos, ImGuiCond_Always); // e.g. (200, 50) and (-200, 50)
ImGui::SetNextWindowSize(ImVec2(500, 500), ImGuiCond_Always);
ImGui::Begin("Rounding reproduction", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar);
ImGui::PushClipRect(ImVec2(-4096, -4096), ImVec2(4096, 4096), false);
ImGui::SetCursorPos(ImVec2(16, 32));
ImGui::RadioButton("##radio", true);
// vertex.pos - ImGui::GetWindowPos() for every vertex the radio button addedmaster:
case=0 active=1 border=0 actual=(200.00,50.00)/(-200.00,50.00) vertices=52 first-relative=(34.9871368,42)/(35.9871368,42)
case=3 active=1 border=0 actual=(200.00,200.00)/(-200.00,-200.00) vertices=52 first-relative=(34.9871368,42)/(35.9871368,43)this branch:
case=0 active=1 border=0 actual=(200.00,50.00)/(-200.00,50.00) vertices=52 first-relative=(34.9871368,42)/(34.9871368,42)
case=3 active=1 border=0 actual=(200.00,200.00)/(-200.00,-200.00) vertices=52 first-relative=(34.9871368,42)/(34.9871368,42)
cc: #2884 #2176 #6144