|
@@ -376,7 +376,7 @@ ImDrawListSharedData::ImDrawListSharedData()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void ImDrawListSharedData::SetCircleSegmentMaxError(float max_error)
|
|
|
|
|
|
+void ImDrawListSharedData::SetCircleTessellationMaxError(float max_error)
|
|
{
|
|
{
|
|
if (CircleSegmentMaxError == max_error)
|
|
if (CircleSegmentMaxError == max_error)
|
|
return;
|
|
return;
|
|
@@ -384,8 +384,7 @@ void ImDrawListSharedData::SetCircleSegmentMaxError(float max_error)
|
|
for (int i = 0; i < IM_ARRAYSIZE(CircleSegmentCounts); i++)
|
|
for (int i = 0; i < IM_ARRAYSIZE(CircleSegmentCounts); i++)
|
|
{
|
|
{
|
|
const float radius = (float)i;
|
|
const float radius = (float)i;
|
|
- const int segment_count = (i > 0) ? IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(radius, CircleSegmentMaxError) : 0;
|
|
|
|
- CircleSegmentCounts[i] = (ImU8)ImMin(segment_count, 255);
|
|
|
|
|
|
+ CircleSegmentCounts[i] = (ImU8)((i > 0) ? IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(radius, CircleSegmentMaxError) : 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -543,6 +542,21 @@ void ImDrawList::_OnChangedVtxOffset()
|
|
curr_cmd->VtxOffset = _CmdHeader.VtxOffset;
|
|
curr_cmd->VtxOffset = _CmdHeader.VtxOffset;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+int ImDrawList::_CalcCircleAutoSegmentCount(float radius) const
|
|
|
|
+{
|
|
|
|
+ int num_segments = 0;
|
|
|
|
+
|
|
|
|
+ const int radius_idx = (int)ImCeil(radius); // Use ceil to never reduce accuracy
|
|
|
|
+
|
|
|
|
+ // Automatic segment count
|
|
|
|
+ if (radius_idx < IM_ARRAYSIZE(_Data->CircleSegmentCounts))
|
|
|
|
+ num_segments = _Data->CircleSegmentCounts[radius_idx]; // Use cached value
|
|
|
|
+ else
|
|
|
|
+ num_segments = IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(radius, _Data->CircleSegmentMaxError);
|
|
|
|
+
|
|
|
|
+ return num_segments;
|
|
|
|
+}
|
|
|
|
+
|
|
// Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)
|
|
// Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)
|
|
void ImDrawList::PushClipRect(ImVec2 cr_min, ImVec2 cr_max, bool intersect_with_current_clip_rect)
|
|
void ImDrawList::PushClipRect(ImVec2 cr_min, ImVec2 cr_max, bool intersect_with_current_clip_rect)
|
|
{
|
|
{
|
|
@@ -1286,11 +1300,7 @@ void ImDrawList::AddCircle(const ImVec2& center, float radius, ImU32 col, int nu
|
|
if (num_segments <= 0)
|
|
if (num_segments <= 0)
|
|
{
|
|
{
|
|
// Automatic segment count
|
|
// Automatic segment count
|
|
- const int radius_idx = (int)radius;
|
|
|
|
- if (radius_idx < IM_ARRAYSIZE(_Data->CircleSegmentCounts))
|
|
|
|
- num_segments = _Data->CircleSegmentCounts[radius_idx]; // Use cached value
|
|
|
|
- else
|
|
|
|
- num_segments = IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(radius, _Data->CircleSegmentMaxError);
|
|
|
|
|
|
+ num_segments = _CalcCircleAutoSegmentCount(radius);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -1316,11 +1326,7 @@ void ImDrawList::AddCircleFilled(const ImVec2& center, float radius, ImU32 col,
|
|
if (num_segments <= 0)
|
|
if (num_segments <= 0)
|
|
{
|
|
{
|
|
// Automatic segment count
|
|
// Automatic segment count
|
|
- const int radius_idx = (int)radius;
|
|
|
|
- if (radius_idx < IM_ARRAYSIZE(_Data->CircleSegmentCounts))
|
|
|
|
- num_segments = _Data->CircleSegmentCounts[radius_idx]; // Use cached value
|
|
|
|
- else
|
|
|
|
- num_segments = IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(radius, _Data->CircleSegmentMaxError);
|
|
|
|
|
|
+ num_segments = _CalcCircleAutoSegmentCount(radius);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|