diff --git a/docs/modernization/tasks.md b/docs/modernization/tasks.md index b7bd84e..6623750 100644 --- a/docs/modernization/tasks.md +++ b/docs/modernization/tasks.md @@ -509,6 +509,11 @@ Done Checks: Progress Notes: +- 2026-06-13: `Canvas::stroke_draw()` now routes the pad-stroke destination + texture dispatch through a local helper lambda, so the repeated bind/unbind + callback construction is centralized while the pad executor still owns the + face loop and copy timing. Next slice should target another narrow canvas + stroke execution seam without reopening landed pad or sample helpers. - 2026-06-13: `Canvas::stroke_draw_mix()` now routes mix-pass plane planning through `plan_legacy_canvas_stroke_mix_pass_planes(...)` and wraps retained framebuffer setup/teardown with diff --git a/src/canvas.cpp b/src/canvas.cpp index fc7492f..982ff3e 100644 --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -846,6 +846,19 @@ void Canvas::stroke_draw() .slot = 1, }, }; + const auto make_pad_destination_texture_dispatch = [&](int face_index) { + return pp::panopainter::LegacyCanvasStrokeTextureInputDispatch { + .activate_texture_unit = [&](int texture_slot) { + set_active_texture_unit(texture_slot); + }, + .bind_stroke_destination = [&] { + m_tex[face_index].bind(); + }, + .unbind_stroke_destination = [&] { + m_tex[face_index].unbind(); + }, + }; + }; [[maybe_unused]] const auto pad_result = pp::panopainter::execute_legacy_canvas_stroke_pad_faces( pp::panopainter::LegacyCanvasStrokePadExecutionRequest { .context = "Canvas::stroke_draw", @@ -863,14 +876,7 @@ void Canvas::stroke_draw() .bind_destination_texture = [&](int face_index) { pp::panopainter::bind_legacy_canvas_stroke_texture_inputs( pad_destination_texture_binding, - pp::panopainter::LegacyCanvasStrokeTextureInputDispatch { - .activate_texture_unit = [&](int texture_slot) { - set_active_texture_unit(texture_slot); - }, - .bind_stroke_destination = [&] { - m_tex[face_index].bind(); - }, - }); + make_pad_destination_texture_dispatch(face_index)); }, .copy_framebuffer_to_destination_texture = [&](const pp::paint_renderer::CanvasStrokeCopyRegion& copy_region) { @@ -885,14 +891,7 @@ void Canvas::stroke_draw() .unbind_destination_texture = [&](int face_index) { pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs( pad_destination_texture_binding, - pp::panopainter::LegacyCanvasStrokeTextureInputDispatch { - .activate_texture_unit = [&](int texture_slot) { - set_active_texture_unit(texture_slot); - }, - .unbind_stroke_destination = [&] { - m_tex[face_index].unbind(); - }, - }); + make_pad_destination_texture_dispatch(face_index)); }, .draw_pad = [&] { m_brush_shape.draw_fill();