diff options
author | Thaddeus Crews <repiteo@outlook.com> | 2024-11-18 09:23:51 -0600 |
---|---|---|
committer | Thaddeus Crews <repiteo@outlook.com> | 2024-11-18 09:23:51 -0600 |
commit | 3ded11d0bcd8830aa8a3dbfa2c1565482bb6e19e (patch) | |
tree | c5ea1603ce302c68aa17b033fa68d09b1c7b060f /servers | |
parent | 449d90b64e5c2070cdf542379663ad1a35bf4100 (diff) | |
parent | 39423d99fae23b3239bfc21ecbd4209010e83f4b (diff) | |
download | redot-engine-3ded11d0bcd8830aa8a3dbfa2c1565482bb6e19e.tar.gz |
Merge pull request #85359 from miv391/faster-exit-from-cull_canvas_item
Faster exit from `_cull_canvas_item` if alpha is zero
Diffstat (limited to 'servers')
-rw-r--r-- | servers/rendering/renderer_canvas_cull.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/servers/rendering/renderer_canvas_cull.cpp b/servers/rendering/renderer_canvas_cull.cpp index d01976acf2..22a9a4632d 100644 --- a/servers/rendering/renderer_canvas_cull.cpp +++ b/servers/rendering/renderer_canvas_cull.cpp @@ -278,6 +278,19 @@ void RendererCanvasCull::_cull_canvas_item(Item *p_canvas_item, const Transform2 ci->children_order_dirty = false; } + if (ci->use_parent_material && p_material_owner) { + ci->material_owner = p_material_owner; + } else { + p_material_owner = ci; + ci->material_owner = nullptr; + } + + Color modulate = ci->modulate * p_modulate; + + if (modulate.a < 0.007) { + return; + } + Rect2 rect = ci->get_rect(); if (ci->visibility_notifier) { @@ -346,19 +359,6 @@ void RendererCanvasCull::_cull_canvas_item(Item *p_canvas_item, const Transform2 } global_rect.position += p_clip_rect.position; - if (ci->use_parent_material && p_material_owner) { - ci->material_owner = p_material_owner; - } else { - p_material_owner = ci; - ci->material_owner = nullptr; - } - - 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); - - if (modulate.a < 0.007) { - return; - } - int child_item_count = ci->child_items.size(); Item **child_items = ci->child_items.ptrw(); |