From 6670f6e186565d3a27b23c8688e6d89de3079688 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Sun, 14 Jun 2026 00:05:33 +0200 Subject: [PATCH] Extract preview main live sample wrapping --- docs/modernization/debt.md | 4 ++++ docs/modernization/tasks.md | 4 +++- src/node_stroke_preview.cpp | 35 ++++++++++++++++++++++++----------- src/node_stroke_preview.h | 5 +++++ 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index b66b6f8..9b3d875 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -205,6 +205,10 @@ agent or engineer to remove them without reconstructing context from chat. now routes the mix-pass execution request through `make_stroke_draw_mix_execution_request(...)`; the retained path still owns the concrete framebuffer, viewport, and draw ordering. +- 2026-06-14: DEBT-0036 was narrowed again. `NodeStrokePreview::make_stroke_draw_immediate_main_live_pass_request()` + now routes sample shader setup through + `execute_stroke_draw_immediate_main_live_sample_pass(...)`; the retained path + still owns the concrete preview frame mutation and copy behavior. - 2026-06-13: DEBT-0036 was narrowed again. `Canvas::draw_merge()` temporary composite setup now routes through `execute_canvas_draw_merge_temporary_composite(...)`; setup, sampler, texture, draw, and unbind callbacks still remain retained in diff --git a/docs/modernization/tasks.md b/docs/modernization/tasks.md index 2bb80bd..da6152f 100644 --- a/docs/modernization/tasks.md +++ b/docs/modernization/tasks.md @@ -1901,7 +1901,7 @@ cmake --build --preset windows-msvc-default --config Debug --target PanoPainter ### STR-042 - Extract Preview Main Live Sample Callback Wrapping -Status: Ready +Status: Done Score: no score movement Debt: `DEBT-0036` Scope: `src/node_stroke_preview.cpp`, `tests/paint_renderer/compositor_tests.cpp` @@ -1912,6 +1912,8 @@ Move the remaining `NodeStrokePreview::make_stroke_draw_immediate_main_live_pass sample/copy callback wrapping into retained helpers so the request builder only forwards concrete preview state. +Closeout: `2053c55b` + Done Checks: - `make_stroke_draw_immediate_main_live_pass_request()` no longer owns the diff --git a/src/node_stroke_preview.cpp b/src/node_stroke_preview.cpp index e2b22a0..f8b53ed 100644 --- a/src/node_stroke_preview.cpp +++ b/src/node_stroke_preview.cpp @@ -745,13 +745,11 @@ NodeStrokePreview::make_stroke_draw_immediate_main_live_pass_request( frame.flow = glm::max(frame.flow, m_min_flow); }, .setup_sample_shader = [&](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, - }); + execute_stroke_draw_immediate_main_live_sample_pass( + brush, + copy_stroke_destination, + frame, + size); }, .draw_sample = [&](auto& frame) { /*auto rect =*/ stroke_draw_samples(frame.shapes, m_tex, copy_stroke_destination); @@ -762,10 +760,7 @@ NodeStrokePreview::make_stroke_draw_immediate_main_live_pass_request( size, stroke_preview_composite_slots::kStroke); }, - .finish_main_pass = [&] { - set_active_texture_unit(stroke_preview_live_slots::kMixer); - m_rtt_mixer.unbindTexture(); - }, + .finish_main_pass = [&] { set_active_texture_unit(stroke_preview_live_slots::kMixer); m_rtt_mixer.unbindTexture(); }, }; } @@ -878,6 +873,24 @@ NodeStrokePreview::make_stroke_draw_immediate_pass_sequence_request( }; } +void NodeStrokePreview::execute_stroke_draw_immediate_main_live_sample_pass( + const Brush& brush, + bool copy_stroke_destination, + const StrokeFrame& frame, + const glm::vec2& size) +{ + (void)brush; + (void)copy_stroke_destination; + (void)size; + 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, + }); +} + pp::panopainter::LegacyNodeStrokePreviewMixExecutionRequest NodeStrokePreview::make_stroke_draw_mix_execution_request( const pp::panopainter::LegacyNodeStrokePreviewMixPassPlan& mix_pass, diff --git a/src/node_stroke_preview.h b/src/node_stroke_preview.h index 9f0ad6b..d1a43bb 100644 --- a/src/node_stroke_preview.h +++ b/src/node_stroke_preview.h @@ -59,6 +59,11 @@ public: bool copy_stroke_destination, float zoom, const glm::vec2& size); + void execute_stroke_draw_immediate_main_live_sample_pass( + const Brush& brush, + bool copy_stroke_destination, + const StrokeFrame& frame, + const glm::vec2& size); void execute_stroke_draw_immediate_dual_pass( const Brush& brush, const pp::panopainter::LegacyNodeStrokePreviewPassOrchestrationPlan& pass_orchestration,