@@ -1479,24 +1479,22 @@ void ImDrawList::AddCircle(const ImVec2& center, float radius, ImU32 col, int nu
1479
1479
if ((col & IM_COL32_A_MASK) == 0 || radius <= 0 .0f )
1480
1480
return ;
1481
1481
1482
- // Obtain segment count
1483
1482
if (num_segments <= 0 )
1484
1483
{
1485
- // Automatic segment count
1486
- num_segments = _CalcCircleAutoSegmentCount (radius);
1484
+ // Use arc with automatic segment count
1485
+ _PathArcToFastEx (center, radius - 0 .5f , 0 , IM_DRAWLIST_ARCFAST_SAMPLE_MAX, 0 );
1486
+ _Path.Size --;
1487
1487
}
1488
1488
else
1489
1489
{
1490
1490
// Explicit segment count (still clamp to avoid drawing insanely tessellated shapes)
1491
1491
num_segments = ImClamp (num_segments, 3 , IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX);
1492
- }
1493
1492
1494
- // Because we are filling a closed shape we remove 1 from the count of segments/points
1495
- const float a_max = (IM_PI * 2 .0f ) * ((float )num_segments - 1 .0f ) / (float )num_segments;
1496
- if (num_segments == 12 )
1497
- PathArcToFast (center, radius - 0 .5f , 0 , 12 - 1 );
1498
- else
1493
+ // Because we are filling a closed shape we remove 1 from the count of segments/points
1494
+ const float a_max = (IM_PI * 2 .0f ) * ((float )num_segments - 1 .0f ) / (float )num_segments;
1499
1495
PathArcTo (center, radius - 0 .5f , 0 .0f , a_max, num_segments - 1 );
1496
+ }
1497
+
1500
1498
PathStroke (col, ImDrawFlags_Closed, thickness);
1501
1499
}
1502
1500
@@ -1505,24 +1503,22 @@ void ImDrawList::AddCircleFilled(const ImVec2& center, float radius, ImU32 col,
1505
1503
if ((col & IM_COL32_A_MASK) == 0 || radius <= 0 .0f )
1506
1504
return ;
1507
1505
1508
- // Obtain segment count
1509
1506
if (num_segments <= 0 )
1510
1507
{
1511
- // Automatic segment count
1512
- num_segments = _CalcCircleAutoSegmentCount (radius);
1508
+ // Use arc with automatic segment count
1509
+ _PathArcToFastEx (center, radius, 0 , IM_DRAWLIST_ARCFAST_SAMPLE_MAX, 0 );
1510
+ _Path.Size --;
1513
1511
}
1514
1512
else
1515
1513
{
1516
1514
// Explicit segment count (still clamp to avoid drawing insanely tessellated shapes)
1517
1515
num_segments = ImClamp (num_segments, 3 , IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX);
1518
- }
1519
1516
1520
- // Because we are filling a closed shape we remove 1 from the count of segments/points
1521
- const float a_max = (IM_PI * 2 .0f ) * ((float )num_segments - 1 .0f ) / (float )num_segments;
1522
- if (num_segments == 12 )
1523
- PathArcToFast (center, radius, 0 , 12 - 1 );
1524
- else
1517
+ // Because we are filling a closed shape we remove 1 from the count of segments/points
1518
+ const float a_max = (IM_PI * 2 .0f ) * ((float )num_segments - 1 .0f ) / (float )num_segments;
1525
1519
PathArcTo (center, radius, 0 .0f , a_max, num_segments - 1 );
1520
+ }
1521
+
1526
1522
PathFillConvex (col);
1527
1523
}
1528
1524
0 commit comments