diff options
author | kleonc <9283098+kleonc@users.noreply.github.com> | 2023-01-18 14:51:17 +0100 |
---|---|---|
committer | kleonc <9283098+kleonc@users.noreply.github.com> | 2023-01-18 15:16:22 +0100 |
commit | 43fc483e6cf609301004c37039aa45a2ca79e070 (patch) | |
tree | 522103835370d4aa10d586396e0a75b5d459331b /servers | |
parent | e514e3732a9588b650776cc962a9e4d8e6ded058 (diff) |
CanvasItem::draw_arc Clamp angle difference so arc won't overlap itself
Diffstat (limited to 'servers')
-rw-r--r-- | servers/rendering/renderer_canvas_cull.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/servers/rendering/renderer_canvas_cull.cpp b/servers/rendering/renderer_canvas_cull.cpp index df9dfaa276..4265ee5518 100644 --- a/servers/rendering/renderer_canvas_cull.cpp +++ b/servers/rendering/renderer_canvas_cull.cpp @@ -1207,20 +1207,23 @@ void RendererCanvasCull::canvas_item_add_circle(RID p_item, const Point2 &p_pos, static const int circle_points = 64; points.resize(circle_points); + Vector2 *points_ptr = points.ptrw(); const real_t circle_point_step = Math_TAU / circle_points; for (int i = 0; i < circle_points; i++) { float angle = i * circle_point_step; - points.write[i].x = Math::cos(angle) * p_radius; - points.write[i].y = Math::sin(angle) * p_radius; - points.write[i] += p_pos; + points_ptr[i].x = Math::cos(angle) * p_radius; + points_ptr[i].y = Math::sin(angle) * p_radius; + points_ptr[i] += p_pos; } + indices.resize((circle_points - 2) * 3); + int *indices_ptr = indices.ptrw(); for (int i = 0; i < circle_points - 2; i++) { - indices.write[i * 3 + 0] = 0; - indices.write[i * 3 + 1] = i + 1; - indices.write[i * 3 + 2] = i + 2; + indices_ptr[i * 3 + 0] = 0; + indices_ptr[i * 3 + 1] = i + 1; + indices_ptr[i * 3 + 2] = i + 2; } Vector<Color> color; |