Extract pad destination dispatch helper

This commit is contained in:
2026-06-13 23:14:35 +02:00
parent 59a83468a6
commit 4bca83982c
4 changed files with 69 additions and 23 deletions

View File

@@ -1052,6 +1052,18 @@ void Canvas::stroke_draw()
.slot = 1,
},
};
const auto pad_destination_texture_dispatch =
pp::panopainter::make_legacy_canvas_stroke_pad_destination_texture_dispatch(
[&](int texture_slot) {
set_active_texture_unit(texture_slot);
},
[&](int dst_face_index) {
m_tex[dst_face_index].bind();
},
[&](int dst_face_index) {
m_tex[dst_face_index].unbind();
},
0);
[[maybe_unused]] const auto pad_result = pp::panopainter::execute_legacy_canvas_stroke_pad_face_callbacks(
pad_faces,
stroke_extent,
@@ -1067,17 +1079,7 @@ void Canvas::stroke_draw()
[&](int face_index) {
pp::panopainter::bind_legacy_canvas_stroke_texture_inputs(
pad_destination_texture_binding,
pp::panopainter::make_legacy_canvas_stroke_pad_destination_texture_dispatch(
[&](int texture_slot) {
set_active_texture_unit(texture_slot);
},
[&](int dst_face_index) {
m_tex[dst_face_index].bind();
},
[&](int dst_face_index) {
m_tex[dst_face_index].unbind();
},
face_index));
pad_destination_texture_dispatch);
},
[&](const pp::paint_renderer::CanvasStrokeCopyRegion& copy_region) {
pp::panopainter::execute_legacy_canvas_stroke_pad_copy_region(
@@ -1087,17 +1089,7 @@ void Canvas::stroke_draw()
[&](int face_index) {
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(
pad_destination_texture_binding,
pp::panopainter::make_legacy_canvas_stroke_pad_destination_texture_dispatch(
[&](int texture_slot) {
set_active_texture_unit(texture_slot);
},
[&](int dst_face_index) {
m_tex[dst_face_index].bind();
},
[&](int dst_face_index) {
m_tex[dst_face_index].unbind();
},
face_index));
pad_destination_texture_dispatch);
},
[&] {
m_brush_shape.draw_fill();