ImDrawList: Added missing early-out in AddPolyline() and AddConvexPolyFilled() when color alpha is zero. Window: Avoid rendering shapes for hidden resize grips.

This commit is contained in:
ocornut 2023-01-24 17:30:22 +01:00
parent f6db9e2f39
commit 739a79b1e9
3 changed files with 10 additions and 4 deletions

View File

@ -37,17 +37,20 @@ HOW TO UPDATE?
All changes:
- Window: Avoid rendering shapes for hidden resize grips.
- Tables: Raised max Columns count from 64 to 512. (#6094, #5305, #4876, #3572)
The previous limit was due to using 64-bit integers but we moved to bits-array
and tweaked the system enough to ensure no performance loss.
- Text: Fixed layouting of wrapped-text block skipping successive empty lines,
regression from the fix in 1.89.2. (#5720, #5919)
- Text: Fix clipping of single-character "..." ellipsis (U+2026 or U+0085) when font
- Text: Fixed clipping of single-character "..." ellipsis (U+2026 or U+0085) when font
is scaled. Scaling wasn't taken into account, leading to ellipsis character straying
slightly out of its expected boundaries. (#2775)
- Text: Tweaked rendering of three-dots "..." ellipsis variant. (#2775, #4269)
- Menus: Fixed layout of MenuItem()/BeginMenu() when label contains a '\n'. (#6116) [@imkcy9]
- PlotHistogram, PlotLines: Passing negative sizes honor alignment like other widgets.
- ImDrawList: Added missing early-out in AddPolyline() and AddConvexPolyFilled() when
color alpha is zero.
-----------------------------------------------------------------------

View File

@ -5810,12 +5810,15 @@ void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar
{
for (int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++)
{
const ImU32 col = resize_grip_col[resize_grip_n];
if ((col & IM_COL32_A_MASK) == 0)
continue;
const ImGuiResizeGripDef& grip = resize_grip_def[resize_grip_n];
const ImVec2 corner = ImLerp(window->Pos, window->Pos + window->Size, grip.CornerPosN);
window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(window_border_size, resize_grip_draw_size) : ImVec2(resize_grip_draw_size, window_border_size)));
window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(resize_grip_draw_size, window_border_size) : ImVec2(window_border_size, resize_grip_draw_size)));
window->DrawList->PathArcToFast(ImVec2(corner.x + grip.InnerDir.x * (window_rounding + window_border_size), corner.y + grip.InnerDir.y * (window_rounding + window_border_size)), window_rounding, grip.AngleMin12, grip.AngleMax12);
window->DrawList->PathFillConvex(resize_grip_col[resize_grip_n]);
window->DrawList->PathFillConvex(col);
}
}

View File

@ -706,7 +706,7 @@ void ImDrawList::PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, c
// We avoid using the ImVec2 math operators here to reduce cost to a minimum for debug/non-inlined builds.
void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32 col, ImDrawFlags flags, float thickness)
{
if (points_count < 2)
if (points_count < 2 || (col & IM_COL32_A_MASK) == 0)
return;
const bool closed = (flags & ImDrawFlags_Closed) != 0;
@ -964,7 +964,7 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32
// - Filled shapes must always use clockwise winding order. The anti-aliasing fringe depends on it. Counter-clockwise shapes will have "inward" anti-aliasing.
void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_count, ImU32 col)
{
if (points_count < 3)
if (points_count < 3 || (col & IM_COL32_A_MASK) == 0)
return;
const ImVec2 uv = _Data->TexUvWhitePixel;