Extract preview dual pass live body

This commit is contained in:
2026-06-13 23:51:52 +02:00
parent a2e805f991
commit 3672f9a514
4 changed files with 88 additions and 28 deletions

View File

@@ -165,6 +165,10 @@ agent or engineer to remove them without reconstructing context from chat.
`make_stroke_draw_immediate_main_live_pass_request(...)`; the retained path `make_stroke_draw_immediate_main_live_pass_request(...)`; the retained path
still owns the concrete frame mutation, sample shader setup, and final mixer still owns the concrete frame mutation, sample shader setup, and final mixer
unbind. unbind.
- 2026-06-13: DEBT-0036 was narrowed again. `NodeStrokePreview::draw_stroke_immediate()`
now routes the dual-pass live body through
`execute_stroke_draw_immediate_dual_pass(...)`; the retained path still owns
the concrete frame mutation, shader setup, and preview copy behavior.
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::draw_merge()` now routes - 2026-06-13: DEBT-0036 was narrowed again. `Canvas::draw_merge()` now routes
the remaining per-layer branch orchestration through the remaining per-layer branch orchestration through
`execute_legacy_canvas_draw_merge_layer_composite(...)`; the retained path `execute_legacy_canvas_draw_merge_layer_composite(...)`; the retained path

View File

@@ -1745,6 +1745,36 @@ ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_composito
cmake --build --preset windows-msvc-default --config Debug --target PanoPainter cmake --build --preset windows-msvc-default --config Debug --target PanoPainter
``` ```
### STR-037 - Extract Preview Dual Pass Live Body
Status: Done
Score: no score movement
Debt: `DEBT-0036`
Scope: `src/node_stroke_preview.cpp`, `tests/paint_renderer/compositor_tests.cpp`
Goal:
Move the remaining `NodeStrokePreview::draw_stroke_immediate()` dual-pass live
body into a retained helper so the callsite keeps only sequence orchestration
and preview copy handling.
Closeout: `a2e805f9`
Done Checks:
- `NodeStrokePreview::draw_stroke_immediate()` no longer owns the dual-pass live
body inline.
- Regression coverage proves the helper preserves the dual-pass callback order
and preview copy behavior.
- `docs/modernization/debt.md` records the reduced dual-pass live surface.
Validation:
```powershell
ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_compositor|pp_paint_renderer_stroke_execution" --output-onfailure
cmake --build --preset windows-msvc-default --config Debug --target PanoPainter
```
### STR-010 - Extract Remaining Draw Merge Composite Orchestration ### STR-010 - Extract Remaining Draw Merge Composite Orchestration
### STR-016 - Extract Draw Merge Layer Composite Execution ### STR-016 - Extract Draw Merge Layer Composite Execution

View File

@@ -748,34 +748,13 @@ void NodeStrokePreview::draw_stroke_immediate()
bind_stroke_preview_dual_pass_textures(*dual_brush); bind_stroke_preview_dual_pass_textures(*dual_brush);
}, },
.execute_dual_pass = [&] { .execute_dual_pass = [&] {
pp::panopainter::execute_legacy_stroke_preview_live_pass( execute_stroke_draw_immediate_dual_pass(
[&] { *b,
m_rtt.clear(); pass_orchestration,
}, dual_brush,
[&] { copy_stroke_destination,
return stroke_draw_compute(m_dual_stroke, zoom); zoom,
}, size);
[](auto& frame) {
frame.col = { 0, 0, 0, 1 };
},
[&](auto& frame) {
pp::panopainter::use_legacy_stroke_shader();
pp::panopainter::apply_legacy_stroke_sample_uniforms(
pp::panopainter::LegacyStrokeSampleUniforms {
.color = frame.col,
.alpha = frame.flow,
.opacity = frame.opacity,
});
},
[&](auto& frame) {
/*auto rect =*/ stroke_draw_samples(frame.shapes, m_tex_dual, copy_stroke_destination);
},
[&] {
copy_stroke_preview_framebuffer_to_texture(
m_tex_dual,
size,
stroke_preview_composite_slots::kStroke);
});
}, },
.capture_background = [&] { .capture_background = [&] {
execute_stroke_preview_background_capture_pass( execute_stroke_preview_background_capture_pass(
@@ -893,6 +872,46 @@ NodeStrokePreview::make_stroke_draw_immediate_main_live_pass_request(
}; };
} }
void NodeStrokePreview::execute_stroke_draw_immediate_dual_pass(
const Brush& brush,
const pp::panopainter::LegacyNodeStrokePreviewPassOrchestrationPlan& pass_orchestration,
std::shared_ptr<Brush> dual_brush,
bool copy_stroke_destination,
float zoom,
const glm::vec2& size)
{
(void)pass_orchestration;
(void)dual_brush;
pp::panopainter::execute_legacy_stroke_preview_live_pass(
[&] {
m_rtt.clear();
},
[&] {
return stroke_draw_compute(m_dual_stroke, zoom);
},
[](auto& frame) {
frame.col = { 0, 0, 0, 1 };
},
[&](auto& frame) {
pp::panopainter::use_legacy_stroke_shader();
pp::panopainter::apply_legacy_stroke_sample_uniforms(
pp::panopainter::LegacyStrokeSampleUniforms {
.color = frame.col,
.alpha = frame.flow,
.opacity = frame.opacity,
});
},
[&](auto& frame) {
/*auto rect =*/ stroke_draw_samples(frame.shapes, m_tex_dual, copy_stroke_destination);
},
[&] {
copy_stroke_preview_framebuffer_to_texture(
m_tex_dual,
size,
stroke_preview_composite_slots::kStroke);
});
}
Image NodeStrokePreview::render_to_image() Image NodeStrokePreview::render_to_image()
{ {
std::lock_guard<std::mutex> _lock(s_render_mutex); std::lock_guard<std::mutex> _lock(s_render_mutex);

View File

@@ -59,6 +59,13 @@ public:
bool copy_stroke_destination, bool copy_stroke_destination,
float zoom, float zoom,
const glm::vec2& size); const glm::vec2& size);
void execute_stroke_draw_immediate_dual_pass(
const Brush& brush,
const pp::panopainter::LegacyNodeStrokePreviewPassOrchestrationPlan& pass_orchestration,
std::shared_ptr<Brush> dual_brush,
bool copy_stroke_destination,
float zoom,
const glm::vec2& size);
void draw_stroke(); void draw_stroke();
void draw_stroke_immediate(); void draw_stroke_immediate();
Image render_to_image(); Image render_to_image();