Skip to content

Commit 3ded11d

Browse files
committed
Merge pull request #85359 from miv391/faster-exit-from-cull_canvas_item
Faster exit from `_cull_canvas_item` if alpha is zero
2 parents 449d90b + 39423d9 commit 3ded11d

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

servers/rendering/renderer_canvas_cull.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,19 @@ void RendererCanvasCull::_cull_canvas_item(Item *p_canvas_item, const Transform2
278278
ci->children_order_dirty = false;
279279
}
280280

281+
if (ci->use_parent_material && p_material_owner) {
282+
ci->material_owner = p_material_owner;
283+
} else {
284+
p_material_owner = ci;
285+
ci->material_owner = nullptr;
286+
}
287+
288+
Color modulate = ci->modulate * p_modulate;
289+
290+
if (modulate.a < 0.007) {
291+
return;
292+
}
293+
281294
Rect2 rect = ci->get_rect();
282295

283296
if (ci->visibility_notifier) {
@@ -346,19 +359,6 @@ void RendererCanvasCull::_cull_canvas_item(Item *p_canvas_item, const Transform2
346359
}
347360
global_rect.position += p_clip_rect.position;
348361

349-
if (ci->use_parent_material && p_material_owner) {
350-
ci->material_owner = p_material_owner;
351-
} else {
352-
p_material_owner = ci;
353-
ci->material_owner = nullptr;
354-
}
355-
356-
Color modulate(ci->modulate.r * p_modulate.r, ci->modulate.g * p_modulate.g, ci->modulate.b * p_modulate.b, ci->modulate.a * p_modulate.a);
357-
358-
if (modulate.a < 0.007) {
359-
return;
360-
}
361-
362362
int child_item_count = ci->child_items.size();
363363
Item **child_items = ci->child_items.ptrw();
364364

0 commit comments

Comments
 (0)