summaryrefslogtreecommitdiffstats
path: root/servers
diff options
context:
space:
mode:
authorMika Viskari <miv391@gmail.com>2023-11-25 21:52:08 +0200
committerMika Viskari <miv391@gmail.com>2024-11-16 13:27:45 +0200
commit39423d99fae23b3239bfc21ecbd4209010e83f4b (patch)
treed39e669134725c2c2ac573f90ab8899433f8012e /servers
parent1ba920fada9efc8c4476ded50fe673b8db541366 (diff)
downloadredot-engine-39423d99fae23b3239bfc21ecbd4209010e83f4b.tar.gz
Faster exit from _cull_canvas_item if alpha is zero
Diffstat (limited to 'servers')
-rw-r--r--servers/rendering/renderer_canvas_cull.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/servers/rendering/renderer_canvas_cull.cpp b/servers/rendering/renderer_canvas_cull.cpp
index c5206017f7..39d26c5893 100644
--- a/servers/rendering/renderer_canvas_cull.cpp
+++ b/servers/rendering/renderer_canvas_cull.cpp
@@ -239,6 +239,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) {
@@ -256,19 +269,6 @@ void RendererCanvasCull::_cull_canvas_item(Item *p_canvas_item, const Transform2
Rect2 global_rect = xform.xform(rect);
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();