Extract stroke mix setup shell

This commit is contained in:
2026-06-13 19:17:36 +02:00
parent defb1af0d9
commit 55fb02e472
5 changed files with 51 additions and 5 deletions

View File

@@ -403,9 +403,8 @@ void Canvas::stroke_draw_mix(const glm::vec2& bb_min, const glm::vec2& bb_sz)
return current_layer.face(plane_index);
});
const auto& b = m_current_stroke->m_brush;
[[maybe_unused]] const auto mix_result =
pp::panopainter::execute_legacy_canvas_stroke_mix_pass_with_setup(
[&] {
const auto mix_setup = pp::panopainter::make_legacy_canvas_stroke_mix_pass_setup(
[&] {
m_mixer.bindFramebuffer();
apply_canvas_viewport(0, 0, m_mixer.getWidth(), m_mixer.getHeight());
apply_canvas_capability(depth_test_state(), false);
@@ -417,9 +416,13 @@ void Canvas::stroke_draw_mix(const glm::vec2& bb_min, const glm::vec2& bb_sz)
static_cast<std::int32_t>(bb_sz.x),
static_cast<std::int32_t>(bb_sz.y));
},
[&] {
[&] {
m_mixer.unbindFramebuffer();
},
});
[[maybe_unused]] const auto mix_result =
pp::panopainter::execute_legacy_canvas_stroke_mix_pass_with_setup(
mix_setup.begin,
mix_setup.end,
pp::panopainter::make_legacy_canvas_stroke_mix_pass_request(
"Canvas::stroke_draw_mix",
m_size,

View File

@@ -340,6 +340,21 @@ struct LegacyCanvasStrokeMixPassResult {
std::size_t composed_planes = 0;
};
struct LegacyCanvasStrokeMixPassSetup {
std::function<void()> begin;
std::function<void()> end;
};
[[nodiscard]] inline LegacyCanvasStrokeMixPassSetup make_legacy_canvas_stroke_mix_pass_setup(
std::function<void()> begin,
std::function<void()> end)
{
return LegacyCanvasStrokeMixPassSetup {
.begin = std::move(begin),
.end = std::move(end),
};
}
[[nodiscard]] inline LegacyCanvasStrokeMixPassRequest make_legacy_canvas_stroke_mix_pass_request(
std::string_view context,
glm::vec2 resolution,