From b0d9e141551efe6c1e632b8e45139385f2cbfe70 Mon Sep 17 00:00:00 2001 From: Darren Kaste Date: Wed, 22 Dec 2021 12:45:35 -0500 Subject: [PATCH] Fix canvas items being drawn outside clip rects --- servers/rendering/renderer_canvas_cull.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/servers/rendering/renderer_canvas_cull.cpp b/servers/rendering/renderer_canvas_cull.cpp index 02af3c6eb92..f5e2cbcd6c4 100644 --- a/servers/rendering/renderer_canvas_cull.cpp +++ b/servers/rendering/renderer_canvas_cull.cpp @@ -261,6 +261,10 @@ void RendererCanvasCull::_cull_canvas_item(Item *p_canvas_item, const Transform2 if (ci->clip) { if (p_canvas_clip != nullptr) { ci->final_clip_rect = p_canvas_clip->final_clip_rect.intersection(global_rect); + if (ci->final_clip_rect == Rect2()) { + // Clip rects do not intersect, so don't draw this item. + return; + } } else { ci->final_clip_rect = global_rect; }