Extract pad stroke copy region helper

This commit is contained in:
2026-06-13 23:10:48 +02:00
parent 884357e18e
commit d03f0c6371
5 changed files with 55 additions and 8 deletions

View File

@@ -541,6 +541,9 @@ agent or engineer to remove them without reconstructing context from chat.
brush-tip dispatch now uses a retained helper object, with regression
coverage proving the helper order; the live path still owns the concrete
brush-tip texture object and dual-pass branch wiring.
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::stroke_draw()` pad copy
behavior now uses a retained helper for copy-region wiring; the pad branch
still owns the concrete framebuffer and texture-object callbacks.
- 2026-06-13: DEBT-0036 was narrowed again. `Canvas::draw_merge` checkerboard
background shader setup and final merged-texture redraw setup now route
through `legacy_canvas_draw_merge_services.h`. The retained Canvas path still

View File

@@ -840,7 +840,7 @@ ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_composito
### STR-029 - Extract Stroke Draw Pad Copy Callback Body
Status: Ready
Status: Done
Score: +1 renderer boundary and OpenGL parity
Debt: `DEBT-0036`
Scope: `src/canvas.cpp`, `src/legacy_canvas_stroke_execution_services.h`, `tests/paint_renderer/compositor_tests.cpp`
@@ -864,6 +864,12 @@ Validation:
ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_compositor|pp_paint_renderer_stroke_execution" --output-onfailure
```
### Completed Task Log
| Date | Task | Score | Validation | Commit |
| --- | --- | --- | --- | --- |
| 2026-06-13 | STR-029 | +1 renderer boundary and OpenGL parity | `ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_compositor|pp_paint_renderer_stroke_execution" --output-onfailure` | `pending` |
Progress Notes:
- 2026-06-13: `NodeStrokePreview::draw_stroke_immediate()` now routes final

View File

@@ -1080,13 +1080,9 @@ void Canvas::stroke_draw()
face_index));
},
[&](const pp::paint_renderer::CanvasStrokeCopyRegion& copy_region) {
copy_framebuffer_to_texture_2d(
copy_region.x,
copy_region.y,
copy_region.x,
copy_region.y,
copy_region.width,
copy_region.height);
pp::panopainter::execute_legacy_canvas_stroke_pad_copy_region(
copy_region,
copy_framebuffer_to_texture_2d);
},
[&](int face_index) {
pp::panopainter::unbind_legacy_canvas_stroke_texture_inputs(

View File

@@ -311,6 +311,19 @@ struct LegacyCanvasStrokePadExecutionResult {
[[nodiscard]] inline LegacyCanvasStrokePadExecutionResult execute_legacy_canvas_stroke_pad_faces(
const LegacyCanvasStrokePadExecutionRequest& request);
inline void execute_legacy_canvas_stroke_pad_copy_region(
const pp::paint_renderer::CanvasStrokeCopyRegion& copy_region,
const std::function<void(int, int, int, int, int, int)>& copy_framebuffer_to_texture_2d)
{
copy_framebuffer_to_texture_2d(
copy_region.x,
copy_region.y,
copy_region.x,
copy_region.y,
copy_region.width,
copy_region.height);
}
struct LegacyCanvasStrokeMixPassPlane {
int index = 0;
bool visible = true;

View File

@@ -1934,6 +1934,32 @@ void legacy_canvas_stroke_dual_pass_brush_tip_dispatch_preserves_order(pp::tests
PP_EXPECT(h, steps == expected);
}
void legacy_canvas_stroke_pad_copy_region_preserves_coordinates(pp::tests::Harness& h)
{
std::vector<std::string> steps;
pp::panopainter::execute_legacy_canvas_stroke_pad_copy_region(
pp::paint_renderer::CanvasStrokeCopyRegion {
.x = 7,
.y = 11,
.width = 13,
.height = 17,
},
[&](int src_x, int src_y, int dst_x, int dst_y, int width, int height) {
steps.emplace_back(
std::to_string(src_x) + "," +
std::to_string(src_y) + "," +
std::to_string(dst_x) + "," +
std::to_string(dst_y) + "," +
std::to_string(width) + "," +
std::to_string(height));
});
const std::vector<std::string> expected {
"7,11,7,11,13,17",
};
PP_EXPECT(h, steps == expected);
}
void plans_canvas_stroke_commit_erase_sequence(pp::tests::Harness& h)
{
const auto plan = plan_canvas_stroke_commit_sequence(
@@ -3812,6 +3838,9 @@ int main()
harness.run(
"legacy_canvas_stroke_dual_pass_brush_tip_dispatch_preserves_order",
legacy_canvas_stroke_dual_pass_brush_tip_dispatch_preserves_order);
harness.run(
"legacy_canvas_stroke_pad_copy_region_preserves_coordinates",
legacy_canvas_stroke_pad_copy_region_preserves_coordinates);
harness.run("plans_canvas_stroke_commit_erase_sequence", plans_canvas_stroke_commit_erase_sequence);
harness.run("plans_canvas_stroke_commit_composite_sequence", plans_canvas_stroke_commit_composite_sequence);
harness.run(