Extract canvas stroke runtime and preview draw shells

This commit is contained in:
2026-06-16 20:22:01 +02:00
parent d6a7512b94
commit a05afb24f3
11 changed files with 1159 additions and 971 deletions

View File

@@ -79,15 +79,15 @@ What is still carrying too much live ownership:
Current hotspot files:
- `src/canvas.cpp`: 1271 lines
- `src/canvas.cpp`: 1010 lines
- `src/app_layout.cpp`: 125 lines
- `src/canvas_modes.cpp`: 720 lines
- `src/node.cpp`: 803 lines
- `src/main.cpp`: 271 lines
- `src/node_panel_brush.cpp`: 435 lines
- `src/node_stroke_preview.cpp`: 751 lines
- `src/node_canvas.cpp`: 702 lines
- `src/app.cpp`: 575 lines
- `src/node_stroke_preview.cpp`: 607 lines
- `src/node_canvas.cpp`: 219 lines
- `src/app.cpp`: 502 lines
- `src/app_dialogs.cpp`: 168 lines
Current architecture mismatches that must be treated as real blockers:
@@ -268,6 +268,11 @@ Current architecture mismatches that must be treated as real blockers:
`Canvas::flood_fill(...)`, and `Canvas::FloodData::apply()` now also route
through `src/legacy_canvas_layer_services.cpp` instead of staying inline in
`src/canvas.cpp`, which trims another coherent retained layer/fill workflow
pocket, while `Canvas::stroke_end(...)`, `Canvas::stroke_cancel(...)`,
`Canvas::stroke_draw_mix(...)`, `Canvas::stroke_draw_project(...)`,
`Canvas::stroke_update(...)`, and `Canvas::stroke_start(...)` now also route
through `src/legacy_canvas_stroke_runtime_services.*` instead of staying
inline in `src/canvas.cpp`, which trims another large retained stroke/runtime
pocket, while the
`CanvasModeTransform` interaction family now also routes through
`src/legacy_canvas_mode_transform.cpp` instead of staying inline in
@@ -302,6 +307,14 @@ Current architecture mismatches that must be treated as real blockers:
`src/canvas_modes.cpp`, while
preview stroke preparation, dual-brush setup, and live pass-orchestration
request assembly now also route through retained preview execution helpers,
while `NodeStrokePreview` retained lifecycle, worker-thread shell,
render-to-image path, on-screen handling, and preview texture ownership now
also route through `src/legacy_node_stroke_preview_runtime_services.cpp`
instead of staying inline in `src/node_stroke_preview.cpp`, while
`NodeCanvas::init()` plus the remaining `NodeCanvas::draw()` outer shell now
also route through `src/legacy_node_canvas_draw_services.*` instead of
staying inline in `src/node_canvas.cpp`, which materially reduces the live
node to a thinner controller surface around event routing and state wrappers,
while `Node::on_event(...)` plus mouse/key capture and release ownership now
also route through `src/legacy_ui_node_event.*` instead of staying inline in
`src/node.cpp`, which materially thins the base scene-graph event shell

View File

@@ -91,7 +91,8 @@ Status: In Progress
Why now:
`src/canvas.cpp` is still the biggest single architectural blocker at about
1271 lines, with `src/canvas_modes.cpp` still large at about 720 lines.
1010 lines, with `src/canvas_modes.cpp` now materially thinner and the next
remaining render-shell pressure shifting toward preview/canvas nodes.
Current slice:
- Canvas state-management helpers for picking, clear/clear-all, layer
@@ -135,6 +136,12 @@ Current slice:
`src/legacy_canvas_layer_services.cpp` instead of staying inline in
`src/canvas.cpp`, which trims another coherent retained layer/fill workflow
pocket from the live canvas shell.
- `Canvas::stroke_end(...)`, `Canvas::stroke_cancel(...)`,
`Canvas::stroke_draw_mix(...)`, `Canvas::stroke_draw_project(...)`,
`Canvas::stroke_update(...)`, and `Canvas::stroke_start(...)` now also live
in `src/legacy_canvas_stroke_runtime_services.*` instead of staying inline in
`src/canvas.cpp`, which trims another large retained live stroke/runtime
pocket from the canvas shell.
- The `CanvasModePen` and `CanvasModeLine` interaction families now also live
in `src/legacy_canvas_mode_pen_line.cpp` instead of staying inline in
`src/canvas_modes.cpp`, which materially thins another retained pen/line
@@ -307,6 +314,16 @@ Current slice:
live in `src/legacy_node_canvas_state_services.*` instead of staying inline
in `src/node_canvas.cpp`, which materially thins another retained
state/control pocket without reopening the draw path.
- `NodeStrokePreview` retained lifecycle, worker-thread shell, render-to-image,
on-screen handling, and preview texture ownership now also live in
`src/legacy_node_stroke_preview_runtime_services.cpp` instead of staying
inline in `src/node_stroke_preview.cpp`, which materially thins the preview
node around its runtime-facing shell even though live pass execution still
remains.
- `NodeCanvas::init()` plus the remaining `NodeCanvas::draw()` outer shell now
also live in `src/legacy_node_canvas_draw_services.*` instead of staying
inline in `src/node_canvas.cpp`, which materially reduces the live node to a
thinner controller surface around event routing and state wrappers.
Write scope:
- `src/node_stroke_preview.cpp`