From 3c3405d796e7548ce0bf8b5fef126337d3dbf6bc Mon Sep 17 00:00:00 2001 From: omigamedev Date: Sat, 13 Jun 2026 23:45:46 +0200 Subject: [PATCH] Extract stroke draw samples destination dispatch --- src/canvas.cpp | 28 ++++++++++++++++------------ src/canvas.h | 2 ++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/canvas.cpp b/src/canvas.cpp index d1e3090..ff772a8 100644 --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -747,28 +747,32 @@ glm::vec4 Canvas::stroke_draw_samples( .slot = 1, }, }; - const auto destination_texture_dispatch = - pp::panopainter::make_legacy_canvas_stroke_destination_texture_dispatch( - [&](int texture_slot) { - set_active_texture_unit(texture_slot); - }, - [&] { - m_tex[i].bind(); // bg, copy of framebuffer (copied before drawing) - }, - [&] { - m_tex[i].unbind(); - }); const auto result = pp::panopainter::execute_legacy_canvas_stroke_face_sample_polygon( make_stroke_draw_samples_request( i, P, copy_stroke_destination), destination_texture_binding, - destination_texture_dispatch); + make_stroke_draw_samples_destination_texture_dispatch(i)); return result.dirty_bounds; } +pp::panopainter::LegacyCanvasStrokeTextureInputDispatch Canvas::make_stroke_draw_samples_destination_texture_dispatch( + int face_index) +{ + return pp::panopainter::make_legacy_canvas_stroke_destination_texture_dispatch( + [&](int texture_slot) { + set_active_texture_unit(texture_slot); + }, + [&, face_index] { + m_tex[face_index].bind(); // bg, copy of framebuffer (copied before drawing) + }, + [&, face_index] { + m_tex[face_index].unbind(); + }); +} + pp::panopainter::LegacyStrokeFaceSamplePolygonExecutionRequest Canvas::make_stroke_draw_samples_request( int face_index, std::vector& polygon_vertices, diff --git a/src/canvas.h b/src/canvas.h index b467ce4..498d722 100644 --- a/src/canvas.h +++ b/src/canvas.h @@ -283,6 +283,8 @@ private: int face_index, std::vector& polygon_vertices, bool copy_stroke_destination) const; + pp::panopainter::LegacyCanvasStrokeTextureInputDispatch make_stroke_draw_samples_destination_texture_dispatch( + int face_index); void stroke_draw_dual_pass( const std::vector& frames_dual, const std::array& dual_pass_texture_bindings,