From ca7ea820ba6c916fd8ab8980fc160266eca717fe Mon Sep 17 00:00:00 2001 From: omigamedev Date: Sat, 13 Jun 2026 19:25:45 +0200 Subject: [PATCH] Extract stroke mix shell wrapper --- docs/modernization/debt.md | 4 ++++ docs/modernization/tasks.md | 4 ++++ src/canvas.cpp | 43 +++++++++++++++++++++---------------- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index 49c8661..4ec32be 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -441,6 +441,10 @@ agent or engineer to remove them without reconstructing context from chat. preserving caller-specific texture slot uniforms. Mixer framebuffer, viewport/scissor/capability state, sampler binding, texture binding, and draw execution remain retained Canvas code. +- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_draw_mix()` now + routes retained mix-shell execution through a local wrapper around + `execute_legacy_canvas_stroke_mix_pass_shell(...)`; the live path still owns + the concrete mixer framebuffer setup and GL capability toggles. - 2026-06-13: DEBT-0036 was narrowed again. `Canvas::draw_merge` checkerboard background shader setup and final merged-texture redraw setup now route through `legacy_canvas_draw_merge_services.h`. The retained Canvas path still diff --git a/docs/modernization/tasks.md b/docs/modernization/tasks.md index 10b693e..cf59eae 100644 --- a/docs/modernization/tasks.md +++ b/docs/modernization/tasks.md @@ -619,6 +619,10 @@ Progress Notes: closeout. - 2026-06-13: `STR-004` closed the last inline stroke dispatch glue. `LATER-003` remains at the binding-only tail. +- 2026-06-13: `Canvas::stroke_draw_mix()` now routes the retained shell + execution through a local wrapper around + `execute_legacy_canvas_stroke_mix_pass_shell(...)`; the live path still owns + the concrete mixer framebuffer setup and GL capability toggles. - 2026-06-13: `Canvas::stroke_draw_samples()` now reuses a retained destination texture dispatch helper for the live sample path; `Canvas` still owns the concrete face textures and callback execution. diff --git a/src/canvas.cpp b/src/canvas.cpp index e0c8ab4..160905e 100644 --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -405,26 +405,22 @@ void Canvas::stroke_draw_mix(const glm::vec2& bb_min, const glm::vec2& bb_sz) const auto& b = m_current_stroke->m_brush; const auto mix_shell = pp::panopainter::make_legacy_canvas_stroke_mix_pass_shell( [&] { - m_mixer.bindFramebuffer(); - apply_canvas_viewport(0, 0, m_mixer.getWidth(), m_mixer.getHeight()); - apply_canvas_capability(depth_test_state(), false); - apply_canvas_capability(scissor_test_state(), true); - apply_canvas_capability(blend_state(), false); - apply_canvas_scissor( - static_cast(bb_min.x), - static_cast(bb_min.y), - static_cast(bb_sz.x), - static_cast(bb_sz.y)); - }, + m_mixer.bindFramebuffer(); + apply_canvas_viewport(0, 0, m_mixer.getWidth(), m_mixer.getHeight()); + apply_canvas_capability(depth_test_state(), false); + apply_canvas_capability(scissor_test_state(), true); + apply_canvas_capability(blend_state(), false); + apply_canvas_scissor( + static_cast(bb_min.x), + static_cast(bb_min.y), + static_cast(bb_sz.x), + static_cast(bb_sz.y)); + }, [&] { - m_mixer.unbindFramebuffer(); - }); - [[maybe_unused]] const auto mix_result = - pp::panopainter::execute_legacy_canvas_stroke_mix_pass_shell( - mix_shell.setup.begin, - mix_shell.setup.end, - mix_shell.request); - + m_mixer.unbindFramebuffer(); + }); + [[maybe_unused]] const auto mix_result = execute_canvas_stroke_mix_pass_shell(mix_shell); + gl.restore(); } @@ -537,6 +533,15 @@ static void execute_canvas_draw_merge_final_plane_composite( pp::panopainter::execute_legacy_canvas_draw_merge_final_plane_composite(uniforms, execution); } +static void execute_canvas_stroke_mix_pass_shell( + const pp::panopainter::LegacyCanvasStrokeMixPassShell& shell) +{ + pp::panopainter::execute_legacy_canvas_stroke_mix_pass_shell( + shell.setup.begin, + shell.setup.end, + shell.request); +} + glm::vec4 Canvas::stroke_draw_samples( int i, std::vector& P,