Extract pad destination texture dispatch helper

This commit is contained in:
2026-06-13 17:38:48 +02:00
parent 384db00015
commit 5c03b13078
3 changed files with 75 additions and 12 deletions

View File

@@ -847,17 +847,16 @@ void Canvas::stroke_draw()
},
};
const auto make_pad_destination_texture_dispatch = [&](int face_index) {
return pp::panopainter::LegacyCanvasStrokeTextureInputDispatch {
.activate_texture_unit = [&](int texture_slot) {
return pp::panopainter::make_legacy_canvas_stroke_pad_destination_texture_dispatch(
[&](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 {

View File

@@ -116,6 +116,18 @@ struct LegacyCanvasStrokeTextureInputDispatch {
};
}
[[nodiscard]] inline LegacyCanvasStrokeTextureInputDispatch make_legacy_canvas_stroke_pad_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),
};
}
struct LegacyCanvasStrokeSamplerDispatch {
std::function<void(int)> bind_brush_tip_sampler;
std::function<void()> unbind_brush_tip_sampler;