summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-01-12 23:59:42 +0100
committerGitHub <noreply@github.com>2022-01-12 23:59:42 +0100
commit586a973b6b7daa072eef36eb6a42b60e6d539f94 (patch)
tree9adfb6e5d7808118cc8caeb7e73843aa1ad8b29e
parenteba047eff5101cf6821f419cc3c1013f91f1c2a1 (diff)
parentb0d9e141551efe6c1e632b8e45139385f2cbfe70 (diff)
Merge pull request #56169 from dkaste/fix-clip-rects
Fix canvas items being drawn outside clip rects
-rw-r--r--servers/rendering/renderer_canvas_cull.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/servers/rendering/renderer_canvas_cull.cpp b/servers/rendering/renderer_canvas_cull.cpp
index 02af3c6eb9..f5e2cbcd6c 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;
}