Extract stroke commit request assembly

This commit is contained in:
2026-06-13 20:00:21 +02:00
parent 532286e81a
commit 536f268349
3 changed files with 84 additions and 14 deletions

View File

@@ -1922,6 +1922,56 @@ void retained_stroke_commit_face_input_binder_forwards_sequence_slots(pp::tests:
PP_EXPECT(h, bound_samplers[3].second == 3);
}
void retained_stroke_commit_request_builder_preserves_dirty_face_order(pp::tests::Harness& h)
{
const pp::panopainter::LegacyCanvasStrokeCommitCallbacks callbacks {
.mark_commit_started = []() {},
.capture_render_state = []() {},
.prepare_render_state = []() {},
.restore_render_state = []() {},
.publish_history = []() {},
.capture_timelapse_frame = []() {},
.bind_layer_framebuffer = [](int) {},
.capture_history_region = [](int) {},
.apply_layer_dirty_region = [](int) {},
.copy_layer_to_commit_destination = [](int) {},
.bind_commit_inputs = [](int) {},
.execute_erase_composite = [](int) {},
.execute_paint_composite = [](int) {},
.copy_committed_to_dilate_source = [](int) {},
.execute_commit_dilate = [](int) {},
.unbind_layer_framebuffer = [](int) {},
};
const auto sequence = plan_canvas_stroke_commit_sequence(
CanvasStrokeCommitRequest {
.erase_mode = false,
.alpha_locked = false,
.selection_mask_active = true,
.dual_stroke_enabled = true,
.pattern_enabled = true,
});
const std::array<pp::panopainter::LegacyCanvasStrokeCommitFace, 6> faces {
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 0, .dirty = false },
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 1, .dirty = true },
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 2, .dirty = false },
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 3, .dirty = true },
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 4, .dirty = false },
pp::panopainter::LegacyCanvasStrokeCommitFace { .index = 5, .dirty = true },
};
const auto request = pp::panopainter::LegacyCanvasStrokeCommitRequest {
.context = "test",
.faces = faces,
.sequence = sequence,
.callbacks = callbacks,
};
PP_EXPECT(h, request.faces[0].index == 0);
PP_EXPECT(h, request.faces[1].index == 1);
PP_EXPECT(h, request.faces[3].dirty);
PP_EXPECT(h, request.faces[5].index == 5);
}
void retained_stroke_commit_dilate_copy_uses_layer_scratch_slot(pp::tests::Harness& h)
{
const auto sequence = plan_canvas_stroke_commit_sequence(