summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-18 22:28:24 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-18 22:28:24 +0100
commit2050f59e3aaf0020a51235ac4e583643c79b898d (patch)
tree50f26d3a058d756da6c39e27f52afe331e429759 /servers
parentf2dbd011b6884a5f8a61f44f57e157f0c96bd3d3 (diff)
parent43fc483e6cf609301004c37039aa45a2ca79e070 (diff)
Merge pull request #71623 from kleonc/draw_arc_clamp_to_single_circle
`CanvasItem::draw_arc` Clamp angle difference so arc won't overlap itself
Diffstat (limited to 'servers')
-rw-r--r--servers/rendering/renderer_canvas_cull.cpp15
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;