Эксперт
-
Автор темы
- #1
Код:
void ImDrawList::AddCircularProgressBar(const ImVec2& center, float radius, ImU32 col, float progress, int num_segments, float thickness)
{
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);
}
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 = progress * 6.1f;
if (num_segments == 12)
PathArcToFast(center, radius - 0.5f, 0, 12 - 1);
else
PathArcTo(center, radius - 0.5f, 0.0f, a_max, num_segments - 1);
PathStroke(col, ImDrawFlags_None, thickness);
}
Код:
В ImDrawList::_PathArcToN
IM_ASSERT(a_min <= a_max); на IM_ASSERT(a_min <= ImMax(a_max, 0.f));
Код:
И в ImDrawList::_PathArcTo
IM_ASSERT(a_min <= a_max); на IM_ASSERT(a_min <= ImMax(a_max, 0.f));
Последнее редактирование: