Tables: Fixed top-most outer border being drawn with both TableBorderLight and TableBorderStrong in some situations, causing the earlier to be visible underneath when alpha is not 1.0f.

This commit is contained in:
ocornut 2023-09-11 15:02:49 +02:00
parent a34071876f
commit 5a483c2ffb
2 changed files with 8 additions and 7 deletions

View File

@ -57,6 +57,8 @@ Other changes:
Previously was inconsistent and only enabled when stepping through a non-input item. Previously was inconsistent and only enabled when stepping through a non-input item.
(#6802, #3092, #5759, #787) (#6802, #3092, #5759, #787)
- Tables: Fixed bottom-most and right-most outer border offset by one. (#6765, #3752) [@v-ein] - Tables: Fixed bottom-most and right-most outer border offset by one. (#6765, #3752) [@v-ein]
- Tables: Fixed top-most outer border being drawn with both TableBorderLight and TableBorderStrong
in some situations, causing the earlier to be visible underneath when alpha is not 1.0f.
- Fonts: 'float size_pixels' passed to AddFontXXX() functions is now rounded to lowest integer. - Fonts: 'float size_pixels' passed to AddFontXXX() functions is now rounded to lowest integer.
This is because our layout/font system currently doesn't fully support non-integer sizes. Until This is because our layout/font system currently doesn't fully support non-integer sizes. Until
it does, this has been a common pitfall leading to more or less subtle issues. (#3164, #3309, #6800) it does, this has been a common pitfall leading to more or less subtle issues. (#3164, #3309, #6800)

View File

@ -1840,15 +1840,14 @@ void ImGui::TableEndRow(ImGuiTable* table)
bg_col1 = table->RowBgColor[1]; bg_col1 = table->RowBgColor[1];
// Decide of top border color // Decide of top border color
ImU32 border_col = 0; ImU32 top_border_col = 0;
const float border_size = TABLE_BORDER_SIZE; const float border_size = TABLE_BORDER_SIZE;
if (table->CurrentRow > 0 || table->InnerWindow == table->OuterWindow) if (table->CurrentRow > 0 && (table->Flags & ImGuiTableFlags_BordersInnerH))
if (table->Flags & ImGuiTableFlags_BordersInnerH) top_border_col = (table->LastRowFlags & ImGuiTableRowFlags_Headers) ? table->BorderColorStrong : table->BorderColorLight;
border_col = (table->LastRowFlags & ImGuiTableRowFlags_Headers) ? table->BorderColorStrong : table->BorderColorLight;
const bool draw_cell_bg_color = table->RowCellDataCurrent >= 0; const bool draw_cell_bg_color = table->RowCellDataCurrent >= 0;
const bool draw_strong_bottom_border = unfreeze_rows_actual; const bool draw_strong_bottom_border = unfreeze_rows_actual;
if ((bg_col0 | bg_col1 | border_col) != 0 || draw_strong_bottom_border || draw_cell_bg_color) if ((bg_col0 | bg_col1 | top_border_col) != 0 || draw_strong_bottom_border || draw_cell_bg_color)
{ {
// In theory we could call SetWindowClipRectBeforeSetChannel() but since we know TableEndRow() is // In theory we could call SetWindowClipRectBeforeSetChannel() but since we know TableEndRow() is
// always followed by a change of clipping rectangle we perform the smallest overwrite possible here. // always followed by a change of clipping rectangle we perform the smallest overwrite possible here.
@ -1887,8 +1886,8 @@ void ImGui::TableEndRow(ImGuiTable* table)
} }
// Draw top border // Draw top border
if (border_col && bg_y1 >= table->BgClipRect.Min.y && bg_y1 < table->BgClipRect.Max.y) if (top_border_col && bg_y1 >= table->BgClipRect.Min.y && bg_y1 < table->BgClipRect.Max.y)
window->DrawList->AddLine(ImVec2(table->BorderX1, bg_y1), ImVec2(table->BorderX2, bg_y1), border_col, border_size); window->DrawList->AddLine(ImVec2(table->BorderX1, bg_y1), ImVec2(table->BorderX2, bg_y1), top_border_col, border_size);
// Draw bottom border at the row unfreezing mark (always strong) // Draw bottom border at the row unfreezing mark (always strong)
if (draw_strong_bottom_border && bg_y2 >= table->BgClipRect.Min.y && bg_y2 < table->BgClipRect.Max.y) if (draw_strong_bottom_border && bg_y2 >= table->BgClipRect.Min.y && bg_y2 < table->BgClipRect.Max.y)