git.lucas.co / cce-color-editor
color picker and palette editor
git clone https://git.lucas.co/cce-color-editor.git

commit94c044bd41ca22b2ed2fa4e2e2b580c6b30e8c81
parent8732edabba
authorLucas Galante <[email protected]>
date2026-07-07 21:52
feat: render via the single paint path by default (flat-list bridge, Phase 3)

cce-colors flattens its UI (including the color-channel gradient sliders) into an AppWidget quad list via rebuild_layout. display_list() builds the DisplayList from that flat list. Seventh app on the Phase 3 single paint path; CCE_LEGACY_PAINT falls back. Self-verified by screenshot: the gradient sliders, preview swatch and Apply/Cancel buttons all render correctly.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

 src/main.rs | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/main.rs b/src/main.rs
index 69c6538..46ca686 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -822,6 +822,26 @@ impl Application for ColorApp {
         }
     }
 
+    fn display_list(&mut self) -> Option<cce_ui::scene::paint::DisplayList> {
+        // Phase 3 single paint path (flat-list bridge). rebuild_layout flattens the UI (incl. color
+        // ramps/gradients) into self.widgets, which view_rounded_quads runs above. CCE_LEGACY_PAINT
+        // falls back.
+        if std::env::var("CCE_LEGACY_PAINT").is_ok() {
+            return None;
+        }
+        use cce_ui::scene::layout::Rect;
+        let mut pc = cce_ui::scene::paint::PaintCtx::new();
+        for w in &self.widgets {
+            let rect = Rect { x: w.x, y: w.y, width: w.w, height: w.h };
+            if w.radius > 0.1 {
+                pc.rounded_rect(rect, w.radius, w.corners, w.color);
+            } else {
+                pc.quad(rect, w.color);
+            }
+        }
+        Some(pc.finish())
+    }
+
     fn text_items(&self) -> &[cce_ui::widget::TextItem] {
         &self.text_items
     }