From e5e334bf74ff6f162c2e83632d39ed6c337f61b3 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Sat, 13 Jun 2026 23:26:13 +0200 Subject: [PATCH] Extract stroke draw dual pass request helper --- docs/modernization/debt.md | 4 ++ docs/modernization/tasks.md | 5 +- src/canvas.cpp | 110 +++++++++++++++++++++++------------- src/canvas.h | 13 +++++ 4 files changed, 92 insertions(+), 40 deletions(-) diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index eb31411..eac3390 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -267,6 +267,10 @@ agent or engineer to remove them without reconstructing context from chat. frame callback body now routes through `stroke_draw_dual_pass_frame_pass(...)`; the retained path still owns the concrete dual-pass request shell and frame execution wiring. +- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_draw()` dual-pass + request assembly now routes through `make_stroke_draw_dual_pass_request(...)`; + the retained path still owns the concrete request execution shell and frame + callbacks. - 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_draw()` main-pass live face orchestration now routes through `execute_legacy_canvas_stroke_live_pass_with_face_framebuffers(...)`; the diff --git a/docs/modernization/tasks.md b/docs/modernization/tasks.md index 2da70f5..d132514 100644 --- a/docs/modernization/tasks.md +++ b/docs/modernization/tasks.md @@ -675,6 +675,7 @@ ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_composito | 2026-06-13 | STR-022 | +1 renderer boundary and OpenGL parity | `ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_compositor|pp_paint_renderer_stroke_execution" --output-on-failure` | `065ddf8e` | | 2026-06-13 | STR-023 | +1 renderer boundary and OpenGL parity | `ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_compositor|pp_paint_renderer_stroke_execution" --output-on-failure` | `07b188de` | | 2026-06-13 | STR-024 | +1 renderer boundary and OpenGL parity | `ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_compositor|pp_paint_renderer_stroke_execution" --output-on-failure` | `b1d6e5e2` | +| 2026-06-13 | STR-025 | +1 renderer boundary and OpenGL parity | `ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_compositor|pp_paint_renderer_stroke_execution" --output-on-failure` | `77ac50b9` | ### STR-023 - Extract Stroke Draw Dual Pass Frame Orchestration @@ -707,7 +708,7 @@ ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_composito ### STR-024 - Extract Stroke Draw Dual Pass Frame Callback Body -Status: Ready +Status: Done Score: +1 renderer boundary and OpenGL parity Debt: `DEBT-0036` Scope: `src/canvas.cpp`, `src/legacy_canvas_stroke_execution_services.h`, `tests/paint_renderer/compositor_tests.cpp` @@ -755,6 +756,8 @@ Done Checks: wiring. - `docs/modernization/debt.md` records the reduced dual-pass request surface. +Closeout: `77ac50b9` + Validation: ```powershell diff --git a/src/canvas.cpp b/src/canvas.cpp index 9830223..e9202a2 100644 --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -887,45 +887,77 @@ void Canvas::stroke_draw_dual_pass( { [[maybe_unused]] const auto dual_result = pp::panopainter::execute_legacy_canvas_stroke_dual_pass( - pp::panopainter::LegacyCanvasStrokeDualPassRequest { - .context = "Canvas::stroke_draw", - .bind_brush_tip = [&] { - pp::panopainter::bind_legacy_canvas_stroke_texture_inputs( - dual_pass_texture_bindings, - dual_pass_brush_tip_dispatch); - }, - .unbind_brush_tip = [&] { - pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs( - dual_pass_texture_bindings, - dual_pass_brush_tip_dispatch); - }, - .setup_dual_shader = [&] { - pp::panopainter::setup_legacy_canvas_stroke_dual_shader( - uses_pattern); - }, - .execute_frame_pass = [&] { - pp::panopainter::execute_legacy_canvas_stroke_dual_pass_frame_callbacks( - frames_dual, - stroke_extent, - std::span(m_dirty_box), - std::span(), - std::span(include_dual_dirty), - [&](auto& f) { - pp::panopainter::apply_legacy_stroke_sample_uniforms( - pp::panopainter::LegacyStrokeSampleUniforms { - .color = f.col, - .alpha = f.flow, - .opacity = f.opacity, - }); - }, - [](auto&, int, auto&) {}, - [&](auto&, int i, auto& P) { - return stroke_draw_samples(i, P, copy_stroke_destination); - }, - m_tmp_dual, - true); - }, - }); + make_stroke_draw_dual_pass_request( + frames_dual, + dual_pass_texture_bindings, + dual_pass_brush_tip_dispatch, + stroke_extent, + include_dual_dirty, + uses_pattern, + copy_stroke_destination)); +} + +pp::panopainter::LegacyCanvasStrokeDualPassRequest Canvas::make_stroke_draw_dual_pass_request( + const std::vector& frames_dual, + const std::array& dual_pass_texture_bindings, + const pp::panopainter::LegacyCanvasStrokeTextureInputDispatch& dual_pass_brush_tip_dispatch, + const pp::renderer::Extent2D& stroke_extent, + const std::array& include_dual_dirty, + bool uses_pattern, + bool copy_stroke_destination) +{ + return pp::panopainter::LegacyCanvasStrokeDualPassRequest { + .context = "Canvas::stroke_draw", + .bind_brush_tip = [&] { + pp::panopainter::bind_legacy_canvas_stroke_texture_inputs( + dual_pass_texture_bindings, + dual_pass_brush_tip_dispatch); + }, + .unbind_brush_tip = [&] { + pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs( + dual_pass_texture_bindings, + dual_pass_brush_tip_dispatch); + }, + .setup_dual_shader = [&] { + pp::panopainter::setup_legacy_canvas_stroke_dual_shader( + uses_pattern); + }, + .execute_frame_pass = [&] { + stroke_draw_dual_pass_frame_pass( + frames_dual, + stroke_extent, + include_dual_dirty, + copy_stroke_destination); + }, + }; +} + +void Canvas::stroke_draw_dual_pass_frame_pass( + const std::vector& frames_dual, + const pp::renderer::Extent2D& stroke_extent, + const std::array& include_dual_dirty, + bool copy_stroke_destination) +{ + pp::panopainter::execute_legacy_canvas_stroke_dual_pass_frame_callbacks( + frames_dual, + stroke_extent, + std::span(m_dirty_box), + std::span(), + std::span(include_dual_dirty), + [&](auto& f) { + pp::panopainter::apply_legacy_stroke_sample_uniforms( + pp::panopainter::LegacyStrokeSampleUniforms { + .color = f.col, + .alpha = f.flow, + .opacity = f.opacity, + }); + }, + [](auto&, int, auto&) {}, + [&](auto&, int i, auto& P) { + return stroke_draw_samples(i, P, copy_stroke_destination); + }, + m_tmp_dual, + true); } void Canvas::stroke_draw() diff --git a/src/canvas.h b/src/canvas.h index 1963cf9..8f752d6 100644 --- a/src/canvas.h +++ b/src/canvas.h @@ -255,6 +255,19 @@ private: const std::array& include_dual_dirty, bool uses_pattern, bool copy_stroke_destination); + pp::panopainter::LegacyCanvasStrokeDualPassRequest make_stroke_draw_dual_pass_request( + const std::vector& frames_dual, + const std::array& dual_pass_texture_bindings, + const pp::panopainter::LegacyCanvasStrokeTextureInputDispatch& dual_pass_brush_tip_dispatch, + const pp::renderer::Extent2D& stroke_extent, + const std::array& include_dual_dirty, + bool uses_pattern, + bool copy_stroke_destination); + void stroke_draw_dual_pass_frame_pass( + const std::vector& frames_dual, + const pp::renderer::Extent2D& stroke_extent, + const std::array& include_dual_dirty, + bool copy_stroke_destination); Image thumbnail_read(std::string file_path); void draw_objects(std::function, int frame, bool save_history); void draw_objects(std::function, Layer& layer, int frame, bool save_history);