Fix canvas items being drawn outside clip rects

This commit is contained in:
Darren Kaste 2021-12-22 12:45:35 -05:00
parent 5f7c1081a7
commit b0d9e14155

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