mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-05 20:48:46 +02:00
Merge branch 'viewport' into docking
# Conflicts: # docs/CHANGELOG.txt
This commit is contained in:
@ -961,6 +961,9 @@ void ImDrawList::PathArcTo(const ImVec2& centre, float radius, float a_min, floa
|
||||
_Path.push_back(centre);
|
||||
return;
|
||||
}
|
||||
|
||||
// Note that we are adding a point at both a_min and a_max.
|
||||
// If you are trying to draw a full closed circle you don't want the overlapping points!
|
||||
_Path.reserve(_Path.Size + (num_segments + 1));
|
||||
for (int i = 0; i <= num_segments; i++)
|
||||
{
|
||||
@ -1144,21 +1147,23 @@ void ImDrawList::AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec
|
||||
|
||||
void ImDrawList::AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments, float thickness)
|
||||
{
|
||||
if ((col & IM_COL32_A_MASK) == 0)
|
||||
if ((col & IM_COL32_A_MASK) == 0 || num_segments <= 2)
|
||||
return;
|
||||
|
||||
// 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(centre, radius-0.5f, 0.0f, a_max, num_segments);
|
||||
PathArcTo(centre, radius-0.5f, 0.0f, a_max, num_segments - 1);
|
||||
PathStroke(col, true, thickness);
|
||||
}
|
||||
|
||||
void ImDrawList::AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments)
|
||||
{
|
||||
if ((col & IM_COL32_A_MASK) == 0)
|
||||
if ((col & IM_COL32_A_MASK) == 0 || num_segments <= 2)
|
||||
return;
|
||||
|
||||
// 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(centre, radius, 0.0f, a_max, num_segments);
|
||||
PathArcTo(centre, radius, 0.0f, a_max, num_segments - 1);
|
||||
PathFillConvex(col);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user