mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-07 13:35:49 +02:00
ImDrawList: clarified that PathArcTo()/PathArcToFast() cannot take radius < 0.0f. (#3491) + changed poor-man ceiling in _CalcCircleAutoSegmentCount() to use 0.999999f to reduce gaps
Previously it sorts of accidentally worked but would lead to counter-clockwise paths which and have an effect on anti-aliasing.
This commit is contained in:
@ -545,7 +545,7 @@ void ImDrawList::_OnChangedVtxOffset()
|
||||
int ImDrawList::_CalcCircleAutoSegmentCount(float radius) const
|
||||
{
|
||||
// Automatic segment count
|
||||
const int radius_idx = (int)(radius + 0.999f); // ceil to never reduce accuracy
|
||||
const int radius_idx = (int)(radius + 0.999999f); // ceil to never reduce accuracy
|
||||
if (radius_idx < IM_ARRAYSIZE(_Data->CircleSegmentCounts))
|
||||
return _Data->CircleSegmentCounts[radius_idx]; // Use cached value
|
||||
else
|
||||
@ -1026,9 +1026,10 @@ void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_coun
|
||||
}
|
||||
}
|
||||
|
||||
// 0: East, 3: South, 6: West, 9: North, 12: East
|
||||
void ImDrawList::PathArcToFast(const ImVec2& center, float radius, int a_min_of_12, int a_max_of_12)
|
||||
{
|
||||
if (radius == 0.0f)
|
||||
if (radius <= 0.0f)
|
||||
{
|
||||
_Path.push_back(center);
|
||||
return;
|
||||
@ -1052,7 +1053,7 @@ void ImDrawList::PathArcToFast(const ImVec2& center, float radius, int a_min_of_
|
||||
|
||||
void ImDrawList::PathArcTo(const ImVec2& center, float radius, float a_min, float a_max, int num_segments)
|
||||
{
|
||||
if (radius == 0.0f)
|
||||
if (radius <= 0.0f)
|
||||
{
|
||||
_Path.push_back(center);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user