Extract stroke destination dispatch helper

This commit is contained in:
2026-06-13 17:42:40 +02:00
parent 38a73fc6f0
commit 6bb1268edb
4 changed files with 51 additions and 11 deletions

View File

@@ -564,17 +564,17 @@ glm::vec4 Canvas::stroke_draw_samples(
.slot = 1,
},
};
const pp::panopainter::LegacyCanvasStrokeTextureInputDispatch destination_texture_dispatch {
.activate_texture_unit = [&](int texture_slot) {
set_active_texture_unit(texture_slot);
},
.bind_stroke_destination = [&] {
m_tex[i].bind(); // bg, copy of framebuffer (copied before drawing)
},
.unbind_stroke_destination = [&] {
m_tex[i].unbind();
},
};
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(
pp::panopainter::LegacyStrokeFaceSamplePolygonExecutionRequest {
.context = "Canvas::stroke_draw_samples",

View File

@@ -116,6 +116,18 @@ struct LegacyCanvasStrokeTextureInputDispatch {
};
}
[[nodiscard]] inline LegacyCanvasStrokeTextureInputDispatch make_legacy_canvas_stroke_destination_texture_dispatch(
std::function<void(int)> activate_texture_unit,
std::function<void()> bind_stroke_destination,
std::function<void()> unbind_stroke_destination)
{
return LegacyCanvasStrokeTextureInputDispatch {
.activate_texture_unit = std::move(activate_texture_unit),
.bind_stroke_destination = std::move(bind_stroke_destination),
.unbind_stroke_destination = std::move(unbind_stroke_destination),
};
}
[[nodiscard]] inline LegacyCanvasStrokeTextureInputDispatch make_legacy_canvas_stroke_pad_destination_texture_dispatch(
std::function<void(int)> activate_texture_unit,
std::function<void()> bind_stroke_destination,