Wire stroke commit service boundary
This commit is contained in:
@@ -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,40 +1713,27 @@ 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(
|
||||
*this,
|
||||
vp,
|
||||
cc,
|
||||
blend,
|
||||
[&](int texture_slot) {
|
||||
set_active_texture_unit(texture_slot);
|
||||
},
|
||||
action,
|
||||
m_current_stroke,
|
||||
sequence,
|
||||
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);
|
||||
return make_canvas_stroke_commit_request(
|
||||
*this,
|
||||
vp,
|
||||
cc,
|
||||
blend,
|
||||
[&](int texture_slot) {
|
||||
set_active_texture_unit(texture_slot);
|
||||
},
|
||||
action,
|
||||
m_current_stroke,
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user