Extract stroke commit callback orchestration

This commit is contained in:
2026-06-13 18:18:42 +02:00
parent e01c88921a
commit e7813c2ff0
5 changed files with 206 additions and 51 deletions

View File

@@ -7,6 +7,7 @@
#include <cstdint>
#include <functional>
#include <string_view>
#include <utility>
namespace pp::panopainter {
@@ -52,6 +53,61 @@ struct LegacyCanvasStrokeCommitCopyExtent {
int height = 0;
};
template <
typename MarkCommitStarted,
typename CaptureRenderState,
typename PrepareRenderState,
typename RestoreRenderState,
typename PublishHistory,
typename CaptureTimelapseFrame,
typename BindLayerFramebuffer,
typename CaptureHistoryRegion,
typename ApplyLayerDirtyRegion,
typename CopyLayerToCommitDestination,
typename BindCommitInputs,
typename ExecuteEraseComposite,
typename ExecutePaintComposite,
typename CopyCommittedToDilateSource,
typename ExecuteCommitDilate,
typename UnbindLayerFramebuffer>
[[nodiscard]] inline LegacyCanvasStrokeCommitCallbacks make_legacy_canvas_stroke_commit_callbacks(
MarkCommitStarted&& mark_commit_started,
CaptureRenderState&& capture_render_state,
PrepareRenderState&& prepare_render_state,
RestoreRenderState&& restore_render_state,
PublishHistory&& publish_history,
CaptureTimelapseFrame&& capture_timelapse_frame,
BindLayerFramebuffer&& bind_layer_framebuffer,
CaptureHistoryRegion&& capture_history_region,
ApplyLayerDirtyRegion&& apply_layer_dirty_region,
CopyLayerToCommitDestination&& copy_layer_to_commit_destination,
BindCommitInputs&& bind_commit_inputs,
ExecuteEraseComposite&& execute_erase_composite,
ExecutePaintComposite&& execute_paint_composite,
CopyCommittedToDilateSource&& copy_committed_to_dilate_source,
ExecuteCommitDilate&& execute_commit_dilate,
UnbindLayerFramebuffer&& unbind_layer_framebuffer)
{
return LegacyCanvasStrokeCommitCallbacks {
.mark_commit_started = std::forward<MarkCommitStarted>(mark_commit_started),
.capture_render_state = std::forward<CaptureRenderState>(capture_render_state),
.prepare_render_state = std::forward<PrepareRenderState>(prepare_render_state),
.restore_render_state = std::forward<RestoreRenderState>(restore_render_state),
.publish_history = std::forward<PublishHistory>(publish_history),
.capture_timelapse_frame = std::forward<CaptureTimelapseFrame>(capture_timelapse_frame),
.bind_layer_framebuffer = std::forward<BindLayerFramebuffer>(bind_layer_framebuffer),
.capture_history_region = std::forward<CaptureHistoryRegion>(capture_history_region),
.apply_layer_dirty_region = std::forward<ApplyLayerDirtyRegion>(apply_layer_dirty_region),
.copy_layer_to_commit_destination = std::forward<CopyLayerToCommitDestination>(copy_layer_to_commit_destination),
.bind_commit_inputs = std::forward<BindCommitInputs>(bind_commit_inputs),
.execute_erase_composite = std::forward<ExecuteEraseComposite>(execute_erase_composite),
.execute_paint_composite = std::forward<ExecutePaintComposite>(execute_paint_composite),
.copy_committed_to_dilate_source = std::forward<CopyCommittedToDilateSource>(copy_committed_to_dilate_source),
.execute_commit_dilate = std::forward<ExecuteCommitDilate>(execute_commit_dilate),
.unbind_layer_framebuffer = std::forward<UnbindLayerFramebuffer>(unbind_layer_framebuffer),
};
}
[[nodiscard]] inline std::size_t legacy_canvas_stroke_commit_step_count(
const pp::paint_renderer::CanvasStrokeCommitSequencePlan& sequence) noexcept
{