Wire stroke commit service boundary

This commit is contained in:
2026-06-13 23:56:03 +02:00
parent 7cafaaa1a6
commit a860c74f60
3 changed files with 61 additions and 33 deletions

View File

@@ -178,6 +178,10 @@ agent or engineer to remove them without reconstructing context from chat.
`execute_legacy_canvas_draw_merge_layer_composite(...)`; the retained path
still owns the concrete temporary-stroke, layer-texture, and layer-blend
callback bodies.
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_commit()` now
routes the remaining service wiring through `make_canvas_stroke_commit_request(...)`;
the retained path still owns the concrete history mutation and layer dirty
box updates.
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_commit()` now
builds its retained callback table through
`make_legacy_canvas_stroke_commit_callbacks(...)`; the legacy executor still

View File

@@ -1808,7 +1808,7 @@ cmake --build --preset windows-msvc-default --config Debug --target PanoPainter
### STR-039 - Wire Stroke Commit Service Boundary
Status: Ready
Status: Done
Score: +1 renderer boundary and OpenGL parity
Debt: `DEBT-0036`
Scope: `src/canvas.cpp`, `src/legacy_canvas_stroke_commit_services.h`, `tests/paint_renderer/stroke_execution_tests.cpp`
@@ -1819,6 +1819,8 @@ Move the remaining `Canvas::stroke_commit()` service wiring behind the retained
stroke-commit helper boundary so the callsite keeps only local history and
layer mutation logic.
Closeout: `7cafaaa1`
Done Checks:
- `Canvas::stroke_commit()` no longer owns the retained commit-service wiring

View File

@@ -813,6 +813,41 @@ static auto execute_canvas_stroke_commit_sequence(
build_request());
}
template <typename SetActiveTextureUnit>
static auto make_canvas_stroke_commit_request(
Canvas& canvas,
const glm::vec4& vp,
const glm::vec4& cc,
bool blend,
SetActiveTextureUnit&& set_active_texture_unit,
ActionStroke* action,
const Stroke* current_stroke,
const pp::paint_renderer::CanvasStrokeCommitSequencePlan& sequence,
const pp::paint_renderer::CanvasStrokeCommitMaterialPlan& stroke_material)
{
const auto commit_callbacks = make_canvas_stroke_commit_callbacks(
canvas,
vp,
cc,
blend,
std::forward<SetActiveTextureUnit>(set_active_texture_unit),
action,
current_stroke,
sequence,
stroke_material);
const std::array<pp::panopainter::LegacyCanvasStrokeCommitFace, 6> faces {
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 0, .dirty = canvas.m_dirty_face[0] },
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 1, .dirty = canvas.m_dirty_face[1] },
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 2, .dirty = canvas.m_dirty_face[2] },
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 3, .dirty = canvas.m_dirty_face[3] },
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 4, .dirty = canvas.m_dirty_face[4] },
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 5, .dirty = canvas.m_dirty_face[5] },
};
return pp::panopainter::make_legacy_canvas_stroke_commit_request(faces, sequence, commit_callbacks);
}
std::vector<Canvas::StrokeFrame> Canvas::stroke_draw_compute(Stroke& stroke) const
{
auto samples = stroke.compute_samples();
@@ -1678,16 +1713,9 @@ void Canvas::stroke_commit()
const auto& b = m_current_stroke->m_brush;
const auto stroke_material = canvas_stroke_material_plan(*b, false);
const auto sequence = pp::paint_renderer::plan_canvas_stroke_commit_sequence(
pp::paint_renderer::CanvasStrokeCommitRequest {
.erase_mode = m_current_mode == kCanvasMode::Erase,
.alpha_locked = m_layers[m_current_layer_idx]->m_alpha_locked,
.selection_mask_active = m_smask_active,
.dual_stroke_enabled = stroke_material.composite_pass.use_dual,
.pattern_enabled = stroke_material.composite_pass.use_pattern,
});
const auto commit_callbacks = make_canvas_stroke_commit_callbacks(
[[maybe_unused]] const auto commit_result = execute_canvas_stroke_commit_sequence(
[&]() {
return make_canvas_stroke_commit_request(
*this,
vp,
cc,
@@ -1697,21 +1725,15 @@ void Canvas::stroke_commit()
},
action,
m_current_stroke,
sequence,
pp::paint_renderer::plan_canvas_stroke_commit_sequence(
pp::paint_renderer::CanvasStrokeCommitRequest {
.erase_mode = m_current_mode == kCanvasMode::Erase,
.alpha_locked = m_layers[m_current_layer_idx]->m_alpha_locked,
.selection_mask_active = m_smask_active,
.dual_stroke_enabled = stroke_material.composite_pass.use_dual,
.pattern_enabled = stroke_material.composite_pass.use_pattern,
}),
stroke_material);
const std::array<pp::panopainter::LegacyCanvasStrokeCommitFace, 6> faces {
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 0, .dirty = m_dirty_face[0] },
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 1, .dirty = m_dirty_face[1] },
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 2, .dirty = m_dirty_face[2] },
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 3, .dirty = m_dirty_face[3] },
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 4, .dirty = m_dirty_face[4] },
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 5, .dirty = m_dirty_face[5] },
};
[[maybe_unused]] const auto commit_result = execute_canvas_stroke_commit_sequence(
[&]() {
return pp::panopainter::make_legacy_canvas_stroke_commit_request(faces, sequence, commit_callbacks);
});
}