Merge pull request #69430 from Rindbee/fix-clip-contents

Fix child nodes still being drawn when the visible area of a control with `clip_contents` enabled is `0`
This commit is contained in:
Rémi Verschelde 2022-12-01 23:55:18 +01:00 committed by GitHub
commit 1bd7b0b269
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -275,12 +275,12 @@ void RendererCanvasCull::_cull_canvas_item(Item *p_canvas_item, const Transform2
if (ci->clip) { if (ci->clip) {
if (p_canvas_clip != nullptr) { if (p_canvas_clip != nullptr) {
ci->final_clip_rect = p_canvas_clip->final_clip_rect.intersection(global_rect); 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 { } else {
ci->final_clip_rect = global_rect; ci->final_clip_rect = p_clip_rect.intersection(global_rect);
}
if (ci->final_clip_rect.size.width < 0.5 || ci->final_clip_rect.size.height < 0.5) {
// The clip rect area is 0, so don't draw the item.
return;
} }
ci->final_clip_rect.position = ci->final_clip_rect.position.round(); ci->final_clip_rect.position = ci->final_clip_rect.position.round();
ci->final_clip_rect.size = ci->final_clip_rect.size.round(); ci->final_clip_rect.size = ci->final_clip_rect.size.round();