imDrawList: PathArcTo() returns when passed zero radius.

This commit is contained in:
omar 2017-08-28 16:02:25 +08:00
parent e1d81f4dc5
commit 808d631e35

View File

@ -694,14 +694,11 @@ void ImDrawList::PathArcToFast(const ImVec2& centre, float radius, int a_min_of_
circle_vtx_builds = true; circle_vtx_builds = true;
} }
if (a_min_of_12 > a_max_of_12) if (radius == 0.0f || a_min_of_12 > a_max_of_12)
return;
if (radius == 0.0f)
{ {
_Path.push_back(centre); _Path.push_back(centre);
return;
} }
else
{
_Path.reserve(_Path.Size + (a_max_of_12 - a_min_of_12 + 1)); _Path.reserve(_Path.Size + (a_max_of_12 - a_min_of_12 + 1));
for (int a = a_min_of_12; a <= a_max_of_12; a++) for (int a = a_min_of_12; a <= a_max_of_12; a++)
{ {
@ -709,12 +706,14 @@ void ImDrawList::PathArcToFast(const ImVec2& centre, float radius, int a_min_of_
_Path.push_back(ImVec2(centre.x + c.x * radius, centre.y + c.y * radius)); _Path.push_back(ImVec2(centre.x + c.x * radius, centre.y + c.y * radius));
} }
} }
}
void ImDrawList::PathArcTo(const ImVec2& centre, float radius, float amin, float amax, int num_segments) void ImDrawList::PathArcTo(const ImVec2& centre, float radius, float amin, float amax, int num_segments)
{ {
if (radius == 0.0f) if (radius == 0.0f)
{
_Path.push_back(centre); _Path.push_back(centre);
return;
}
_Path.reserve(_Path.Size + (num_segments + 1)); _Path.reserve(_Path.Size + (num_segments + 1));
for (int i = 0; i <= num_segments; i++) for (int i = 0; i <= num_segments; i++)
{ {