diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-08-10 10:52:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-10 10:52:11 +0200 |
commit | 8b960a2d2b456b98efabd736e4db776580a5f846 (patch) | |
tree | 770fb74230a72c947f36d1db469aad866332b088 /servers/rendering | |
parent | 483bbd6eccffeb12bde6c6bcb7669222e6d20a29 (diff) | |
parent | 59c137a99b4473efe3231af5adcce8988905bd79 (diff) |
Merge pull request #51467 from Chaosus/fix_aa
Fix incorrect border width of antialiased lines
Diffstat (limited to 'servers/rendering')
-rw-r--r-- | servers/rendering/renderer_canvas_cull.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/servers/rendering/renderer_canvas_cull.cpp b/servers/rendering/renderer_canvas_cull.cpp index ec0a8347f8..fd7d5b91fa 100644 --- a/servers/rendering/renderer_canvas_cull.cpp +++ b/servers/rendering/renderer_canvas_cull.cpp @@ -639,17 +639,19 @@ void RendererCanvasCull::canvas_item_add_polyline(RID p_item, const Vector<Point j2 = j + 1; - Vector2 tangent = ((t + prev_t).normalized()) * p_width * 0.5; + Vector2 dir = (t + prev_t).normalized(); + Vector2 tangent = dir * p_width * 0.5; + Vector2 border = dir * 2.0; Vector2 pos = p_points[i]; points_ptr[j] = pos + tangent; points_ptr[j2] = pos - tangent; - points_top_ptr[j] = pos + tangent + tangent; + points_top_ptr[j] = pos + tangent + border; points_top_ptr[j2] = pos + tangent; points_bottom_ptr[j] = pos - tangent; - points_bottom_ptr[j2] = pos - tangent - tangent; + points_bottom_ptr[j2] = pos - tangent - border; if (i < p_colors.size()) { color = p_colors[i]; |