|
@@ -1479,24 +1479,22 @@ void ImDrawList::AddCircle(const ImVec2& center, float radius, ImU32 col, int nu
|
|
|
if ((col & IM_COL32_A_MASK) == 0 || radius <= 0.0f)
|
|
|
return;
|
|
|
|
|
|
- // Obtain segment count
|
|
|
if (num_segments <= 0)
|
|
|
{
|
|
|
- // Automatic segment count
|
|
|
- num_segments = _CalcCircleAutoSegmentCount(radius);
|
|
|
+ // Use arc with automatic segment count
|
|
|
+ _PathArcToFastEx(center, radius - 0.5f, 0, IM_DRAWLIST_ARCFAST_SAMPLE_MAX, 0);
|
|
|
+ _Path.Size--;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
// Explicit segment count (still clamp to avoid drawing insanely tessellated shapes)
|
|
|
num_segments = ImClamp(num_segments, 3, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX);
|
|
|
- }
|
|
|
|
|
|
- // Because we are filling a closed shape we remove 1 from the count of segments/points
|
|
|
- const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;
|
|
|
- if (num_segments == 12)
|
|
|
- PathArcToFast(center, radius - 0.5f, 0, 12 - 1);
|
|
|
- else
|
|
|
+ // Because we are filling a closed shape we remove 1 from the count of segments/points
|
|
|
+ const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;
|
|
|
PathArcTo(center, radius - 0.5f, 0.0f, a_max, num_segments - 1);
|
|
|
+ }
|
|
|
+
|
|
|
PathStroke(col, ImDrawFlags_Closed, thickness);
|
|
|
}
|
|
|
|
|
@@ -1505,24 +1503,22 @@ void ImDrawList::AddCircleFilled(const ImVec2& center, float radius, ImU32 col,
|
|
|
if ((col & IM_COL32_A_MASK) == 0 || radius <= 0.0f)
|
|
|
return;
|
|
|
|
|
|
- // Obtain segment count
|
|
|
if (num_segments <= 0)
|
|
|
{
|
|
|
- // Automatic segment count
|
|
|
- num_segments = _CalcCircleAutoSegmentCount(radius);
|
|
|
+ // Use arc with automatic segment count
|
|
|
+ _PathArcToFastEx(center, radius, 0, IM_DRAWLIST_ARCFAST_SAMPLE_MAX, 0);
|
|
|
+ _Path.Size--;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
// Explicit segment count (still clamp to avoid drawing insanely tessellated shapes)
|
|
|
num_segments = ImClamp(num_segments, 3, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX);
|
|
|
- }
|
|
|
|
|
|
- // Because we are filling a closed shape we remove 1 from the count of segments/points
|
|
|
- const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;
|
|
|
- if (num_segments == 12)
|
|
|
- PathArcToFast(center, radius, 0, 12 - 1);
|
|
|
- else
|
|
|
+ // Because we are filling a closed shape we remove 1 from the count of segments/points
|
|
|
+ const float a_max = (IM_PI * 2.0f) * ((float)num_segments - 1.0f) / (float)num_segments;
|
|
|
PathArcTo(center, radius, 0.0f, a_max, num_segments - 1);
|
|
|
+ }
|
|
|
+
|
|
|
PathFillConvex(col);
|
|
|
}
|
|
|
|