Browse Source

ProgressBar: Fixed a minor tesselation issue when rendering rounded progress bars.

Incidentally, the auto-tesselation path of PathArcTo() wasn't much tested.
ocornut 1 year ago
parent
commit
3b6d924acd
2 changed files with 6 additions and 4 deletions
  1. 2 0
      docs/CHANGELOG.txt
  2. 4 4
      imgui_draw.cpp

+ 2 - 0
docs/CHANGELOG.txt

@@ -53,6 +53,8 @@ Other changes:
   for auto-resizing of columns. (#6917)
 - Tables: Angled headers: fixed TableAngledHeadersRow() incorrect background fill
   drawn too low, particularly visible with tables that have no scrolling. (#6917)
+- ProgressBar: Fixed a minor tesselation issue when rendering rounded progress bars,
+  where in some situations the rounded section wouldn't follow regular tesselation rules.
 
 
 -----------------------------------------------------------------------

+ 4 - 4
imgui_draw.cpp

@@ -3997,8 +3997,8 @@ void ImGui::RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, Im
     }
     else
     {
-        draw_list->PathArcTo(ImVec2(x0, p1.y - rounding), rounding, IM_PI - arc0_e, IM_PI - arc0_b, 3); // BL
-        draw_list->PathArcTo(ImVec2(x0, p0.y + rounding), rounding, IM_PI + arc0_b, IM_PI + arc0_e, 3); // TR
+        draw_list->PathArcTo(ImVec2(x0, p1.y - rounding), rounding, IM_PI - arc0_e, IM_PI - arc0_b); // BL
+        draw_list->PathArcTo(ImVec2(x0, p0.y + rounding), rounding, IM_PI + arc0_b, IM_PI + arc0_e); // TR
     }
     if (p1.x > rect.Min.x + rounding)
     {
@@ -4017,8 +4017,8 @@ void ImGui::RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, Im
         }
         else
         {
-            draw_list->PathArcTo(ImVec2(x1, p0.y + rounding), rounding, -arc1_e, -arc1_b, 3); // TR
-            draw_list->PathArcTo(ImVec2(x1, p1.y - rounding), rounding, +arc1_b, +arc1_e, 3); // BR
+            draw_list->PathArcTo(ImVec2(x1, p0.y + rounding), rounding, -arc1_e, -arc1_b); // TR
+            draw_list->PathArcTo(ImVec2(x1, p1.y - rounding), rounding, +arc1_b, +arc1_e); // BR
         }
     }
     draw_list->PathFillConvex(col);