From 818f2b10adc8d8c1163439e9636038f20271d6e7 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Sat, 13 Jun 2026 16:54:27 +0200 Subject: [PATCH] Add stroke sampler dispatch helper coverage --- docs/modernization/tasks.md | 5 +++ .../paint_renderer/stroke_execution_tests.cpp | 31 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/docs/modernization/tasks.md b/docs/modernization/tasks.md index 5dedad5..3d00ad9 100644 --- a/docs/modernization/tasks.md +++ b/docs/modernization/tasks.md @@ -509,6 +509,11 @@ Done Checks: Progress Notes: +- 2026-06-13: `pp_paint_renderer_stroke_execution_tests` now covers the new + retained sampler dispatch helper builder and its pattern bind/unbind wiring. + Next slice should target another narrow `stroke_draw()` seam or another + helper-builder regression without reopening landed texture or dual-pass + helpers. - 2026-06-13: `Canvas::stroke_draw()` live-pass sampler dispatch now reuses a retained helper builder for brush-tip, destination, pattern, and mixer sampler callbacks; the live adapter still owns the concrete sampler objects. diff --git a/tests/paint_renderer/stroke_execution_tests.cpp b/tests/paint_renderer/stroke_execution_tests.cpp index 7feb854..e4a252b 100644 --- a/tests/paint_renderer/stroke_execution_tests.cpp +++ b/tests/paint_renderer/stroke_execution_tests.cpp @@ -232,6 +232,34 @@ void retained_stroke_sampler_dispatch_routes_bind_and_unbind_per_input(pp::tests PP_EXPECT(h, events == expected_events); } +void retained_stroke_sampler_dispatch_helper_builds_expected_callback_wiring(pp::tests::Harness& h) +{ + std::vector events; + const auto dispatch = pp::panopainter::make_legacy_canvas_stroke_sampler_dispatch( + [&](int slot) { events.emplace_back("bind:brush_tip:" + std::to_string(slot)); }, + [&] { events.emplace_back("unbind:brush_tip"); }, + [&](int slot) { events.emplace_back("bind:destination:" + std::to_string(slot)); }, + [&] { events.emplace_back("unbind:destination"); }, + [&](int slot) { events.emplace_back("bind:pattern:" + std::to_string(slot)); }, + [&] { events.emplace_back("unbind:pattern"); }, + [&](int slot) { events.emplace_back("bind:mixer:" + std::to_string(slot)); }, + [&] { events.emplace_back("unbind:mixer"); }); + + pp::panopainter::bind_legacy_canvas_stroke_sampler_input( + LegacyCanvasStrokeTextureInput::pattern, + 6, + dispatch); + pp::panopainter::unbind_legacy_canvas_stroke_sampler_input( + LegacyCanvasStrokeTextureInput::pattern, + dispatch); + + const std::vector expected_events { + "bind:pattern:6", + "unbind:pattern", + }; + PP_EXPECT(h, events == expected_events); +} + void retained_stroke_sample_executor_copies_destination_and_expands_quads(pp::tests::Harness& h) { const auto vertices = make_quad_vertices(); @@ -1309,6 +1337,9 @@ int main() harness.run( "retained_stroke_sampler_dispatch_routes_bind_and_unbind_per_input", retained_stroke_sampler_dispatch_routes_bind_and_unbind_per_input); + harness.run( + "retained_stroke_sampler_dispatch_helper_builds_expected_callback_wiring", + retained_stroke_sampler_dispatch_helper_builds_expected_callback_wiring); harness.run( "retained_stroke_sample_executor_unbinds_and_skips_draw_when_bounds_are_empty", retained_stroke_sample_executor_unbinds_and_skips_draw_when_bounds_are_empty);