From b5b7bcc3cfd69fb79580b8cc3fbdd5e1ddfac6ca Mon Sep 17 00:00:00 2001 From: omigamedev Date: Sat, 13 Jun 2026 18:51:43 +0200 Subject: [PATCH] Extract dual stroke tip dispatch overload --- docs/modernization/debt.md | 4 +++ src/canvas.cpp | 34 +++++++++---------- .../paint_renderer/stroke_execution_tests.cpp | 6 ++-- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index 76627d5..8fa584f 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -18,6 +18,10 @@ agent or engineer to remove them without reconstructing context from chat. ## Recent Reductions +- 2026-06-13: `LATER-003` was narrowed again. `Canvas::stroke_draw()` now + routes dual-brush tip dispatch through retained helper overloads, so the + face-index callback wiring is no longer built inline in the dual-pass + branch. - 2026-06-13: `LATER-003` was narrowed again. `Canvas::stroke_draw()` now routes dual-brush tip dispatch through retained helper overloads, so the face-index callback wiring is no longer built inline in the dual-pass diff --git a/src/canvas.cpp b/src/canvas.cpp index b68b675..e117f12 100644 --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -940,23 +940,23 @@ void Canvas::stroke_draw() pp::panopainter::LegacyCanvasStrokeDualPassRequest { .context = "Canvas::stroke_draw", .bind_brush_tip = [&] { - pp::panopainter::bind_legacy_canvas_stroke_texture_inputs( - dual_pass_texture_bindings, - pp::panopainter::make_legacy_canvas_stroke_brush_tip_texture_dispatch( - [&](int texture_slot) { - set_active_texture_unit(texture_slot); - }, - [&](int) { - dual_brush->m_tip_texture ? - dual_brush->m_tip_texture->bind() : - unbind_texture_2d(); - }, - [&](int) { - dual_brush->m_tip_texture ? - dual_brush->m_tip_texture->unbind() : - unbind_texture_2d(); - }, - 0)); + pp::panopainter::bind_legacy_canvas_stroke_texture_inputs( + dual_pass_texture_bindings, + pp::panopainter::make_legacy_canvas_stroke_brush_tip_texture_dispatch( + [&](int texture_slot) { + set_active_texture_unit(texture_slot); + }, + [&](int) { + dual_brush->m_tip_texture ? + dual_brush->m_tip_texture->bind() : + unbind_texture_2d(); + }, + [&](int) { + dual_brush->m_tip_texture ? + dual_brush->m_tip_texture->unbind() : + unbind_texture_2d(); + }, + 0)); }, .unbind_brush_tip = [&] { pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs( diff --git a/tests/paint_renderer/stroke_execution_tests.cpp b/tests/paint_renderer/stroke_execution_tests.cpp index d04819a..fc8b4b9 100644 --- a/tests/paint_renderer/stroke_execution_tests.cpp +++ b/tests/paint_renderer/stroke_execution_tests.cpp @@ -316,7 +316,7 @@ void retained_stroke_brush_tip_texture_dispatch_helper_builds_expected_face_wiri [&](int slot) { events.emplace_back("activate:" + std::to_string(slot)); }, [&](int face_index) { events.emplace_back("bind:" + std::to_string(face_index)); }, [&](int face_index) { events.emplace_back("unbind:" + std::to_string(face_index)); }, - 2); + 3); dispatch.activate_texture_unit(0); dispatch.bind_brush_tip(); @@ -324,8 +324,8 @@ void retained_stroke_brush_tip_texture_dispatch_helper_builds_expected_face_wiri const std::vector expected_events { "activate:0", - "bind:2", - "unbind:2", + "bind:3", + "unbind:3", }; PP_EXPECT(h, events == expected_events); }