Merge pull request #56169 from dkaste/fix-clip-rects

Fix canvas items being drawn outside clip rects
This commit is contained in:
Rémi Verschelde 2022-01-12 23:59:42 +01:00 committed by GitHub
commit 586a973b6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}