git.lucas.co / cce-ui
GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git

commit1fb91aa7e660f28b3fa9a6c8cbcf3415dd407961
parent70ea04423d
authorLucas Galante <[email protected]>
date2026-06-28 09:48
Restore default all_quads and implement background quad filtering for rounded children in container all_quads

 src/widget/container/backplate.rs | 13 ++++++-------
 src/widget/container/layer.rs     | 12 +++++++-----
 src/widget/container/plate.rs     | 13 ++++++-------
 src/widget/container/switcher.rs  | 12 +++++++-----
 src/widget/json_layout.rs         |  9 ++++++++-
 src/widget/mod.rs                 |  4 ----
 6 files changed, 34 insertions(+), 29 deletions(-)

diff --git a/src/widget/container/backplate.rs b/src/widget/container/backplate.rs
index ee8a6c8..64f6566 100644
--- a/src/widget/container/backplate.rs
+++ b/src/widget/container/backplate.rs
@@ -179,15 +179,14 @@ impl Element for Backplate {
         for &child_ptr in &self.children {
             let widget = unsafe { &*child_ptr };
             let mut child_quads = Vec::new();
-            let cc = widget.color();
-            let (cr1, cr2, cr3, cr4) = widget.rounded_corners();
-            if !(cr1 || cr2 || cr3 || cr4) {
-                if cc[3] > 0.0 {
-                    let (cx, cy, cw, ch) = widget.rect();
-                    child_quads.push((cx, cy, cw, ch, cc));
+            let (cx, cy, cw, ch) = widget.rect();
+            let has_rounded = widget.rounded_corners() != (false, false, false, false);
+            for (qx, qy, qw, qh, qc) in widget.all_quads(ctx) {
+                if has_rounded && (qx - cx).abs() < 0.1 && (qy - cy).abs() < 0.1 && (qw - cw).abs() < 0.1 && (qh - ch).abs() < 0.1 {
+                    continue;
                 }
+                child_quads.push((qx, qy, qw, qh, qc));
             }
-            child_quads.extend(widget.all_quads(ctx));
 
             for (qx, qy, qw, qh, qc) in child_quads {
                 let x0 = qx.max(wx);
diff --git a/src/widget/container/layer.rs b/src/widget/container/layer.rs
index 48f7860..ee39325 100644
--- a/src/widget/container/layer.rs
+++ b/src/widget/container/layer.rs
@@ -121,12 +121,14 @@ impl Element for Layer {
         }
         for &child_ptr in &self.children {
             let widget = unsafe { &*child_ptr };
-            let cc = widget.color();
-            if cc[3] > 0.0 {
-                let (wx, wy, ww, wh) = widget.rect();
-                quads.push((wx, wy, ww, wh, cc));
+            let (wx, wy, ww, wh) = widget.rect();
+            let has_rounded = widget.rounded_corners() != (false, false, false, false);
+            for (qx, qy, qw, qh, qc) in widget.all_quads(ctx) {
+                if has_rounded && (qx - wx).abs() < 0.1 && (qy - wy).abs() < 0.1 && (qw - ww).abs() < 0.1 && (qh - wh).abs() < 0.1 {
+                    continue;
+                }
+                quads.push((qx, qy, qw, qh, qc));
             }
-            quads.extend(widget.all_quads(ctx));
         }
         quads
     }
diff --git a/src/widget/container/plate.rs b/src/widget/container/plate.rs
index 2c9c129..e91e123 100644
--- a/src/widget/container/plate.rs
+++ b/src/widget/container/plate.rs
@@ -372,15 +372,14 @@ impl Element for Plate {
 
         for &child_ptr in &self.base.children {
             let widget = unsafe { &*child_ptr };
-            let (cr1, cr2, cr3, cr4) = widget.rounded_corners();
-            if !(cr1 || cr2 || cr3 || cr4) {
-                let c = widget.color();
-                if c[3] > 0.0 {
-                    let (wx, wy, ww, wh) = widget.rect();
-                    quads.push((wx, wy, ww, wh, c));
+            let (wx, wy, ww, wh) = widget.rect();
+            let has_rounded = widget.rounded_corners() != (false, false, false, false);
+            for (qx, qy, qw, qh, qc) in widget.all_quads(ctx) {
+                if has_rounded && (qx - wx).abs() < 0.1 && (qy - wy).abs() < 0.1 && (qw - ww).abs() < 0.1 && (qh - wh).abs() < 0.1 {
+                    continue;
                 }
+                quads.push((qx, qy, qw, qh, qc));
             }
-            quads.extend(widget.all_quads(ctx));
         }
         quads
     }
diff --git a/src/widget/container/switcher.rs b/src/widget/container/switcher.rs
index dc4645f..6b6831c 100644
--- a/src/widget/container/switcher.rs
+++ b/src/widget/container/switcher.rs
@@ -178,12 +178,14 @@ impl Element for Switcher {
         if let Some(idx) = self.active_index {
             if idx < self.children.len() {
                 let widget = unsafe { &*self.children[idx] };
-                let c = widget.color();
-                if c[3] > 0.0 {
-                    let (wx, wy, ww, wh) = widget.rect();
-                    quads.push((wx, wy, ww, wh, c));
+                let (wx, wy, ww, wh) = widget.rect();
+                let has_rounded = widget.rounded_corners() != (false, false, false, false);
+                for (qx, qy, qw, qh, qc) in widget.all_quads(ctx) {
+                    if has_rounded && (qx - wx).abs() < 0.1 && (qy - wy).abs() < 0.1 && (qw - ww).abs() < 0.1 && (qh - wh).abs() < 0.1 {
+                        continue;
+                    }
+                    quads.push((qx, qy, qw, qh, qc));
                 }
-                quads.extend(widget.all_quads(ctx));
             }
         }
         quads
diff --git a/src/widget/json_layout.rs b/src/widget/json_layout.rs
index 6c3ef5d..10d4d64 100644
--- a/src/widget/json_layout.rs
+++ b/src/widget/json_layout.rs
@@ -362,8 +362,15 @@ impl Element for JsonLayoutWidget {
             if w.page_idx != active_page {
                 continue;
             }
-            push_clipped(w.widget.rect().0, w.widget.rect().1, w.widget.rect().2, w.widget.rect().3, w.widget.color(), &mut quads);
+            let (wx, wy, ww, wh) = w.widget.rect();
+            let has_rounded = w.widget.rounded_corners() != (false, false, false, false);
+            if !has_rounded {
+                push_clipped(wx, wy, ww, wh, w.widget.color(), &mut quads);
+            }
             for q in w.widget.all_quads(ctx) {
+                if has_rounded && (q.0 - wx).abs() < 0.1 && (q.1 - wy).abs() < 0.1 && (q.2 - ww).abs() < 0.1 && (q.3 - wh).abs() < 0.1 {
+                    continue;
+                }
                 push_clipped(q.0, q.1, q.2, q.3, q.4, &mut quads);
             }
             if let Some(hq) = w.widget.highlight_quad(ctx) {
diff --git a/src/widget/mod.rs b/src/widget/mod.rs
index 15b7db3..9e7afbe 100644
--- a/src/widget/mod.rs
+++ b/src/widget/mod.rs
@@ -420,10 +420,6 @@ pub trait Element {
     fn extra_circles(&self) -> Vec<(f32, f32, f32, [f32; 4])> { Vec::new() }
     
     fn all_quads(&self, ctx: &UiContext) -> Vec<(f32, f32, f32, f32, [f32; 4])> {
-        let (r1, r2, r3, r4) = self.rounded_corners();
-        if r1 || r2 || r3 || r4 {
-            return Vec::new();
-        }
         let mut quads = self.extra_quads();
         if let Some(hq) = self.highlight_quad(ctx) {
             if hq.4 != colors::HIGHLIGHT_SECONDARY {