Extract preview sample pass request helper

This commit is contained in:
2026-06-14 00:09:36 +02:00
parent cc1dd0dd95
commit 5f66d0e76e
2 changed files with 79 additions and 34 deletions

View File

@@ -1958,6 +1958,34 @@ ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_composito
cmake --build --preset windows-msvc-default --config Debug --target PanoPainter cmake --build --preset windows-msvc-default --config Debug --target PanoPainter
``` ```
### STR-044 - Extract Preview Sample Pass Request Construction
Status: Ready
Score: no score movement
Debt: `DEBT-0036`
Scope: `src/node_stroke_preview.cpp`, `tests/paint_renderer/compositor_tests.cpp`
Goal:
Move the remaining `execute_stroke_preview_sample_pass()` request construction
into a retained helper so the executor wrapper keeps only request dispatch and
dirty-bounds return handling.
Done Checks:
- `execute_stroke_preview_sample_pass()` no longer owns the sample-request
construction inline.
- Regression coverage proves the helper preserves destination binding, copy,
and brush draw ordering.
- `docs/modernization/debt.md` records the reduced preview sample-pass surface.
Validation:
```powershell
ctest --preset desktop-fast --build-config Debug -R "pp_paint_renderer_compositor|pp_paint_renderer_stroke_execution" --output-onfailure
cmake --build --preset windows-msvc-default --config Debug --target PanoPainter
```
### STR-010 - Extract Remaining Draw Merge Composite Orchestration ### STR-010 - Extract Remaining Draw Merge Composite Orchestration
### STR-016 - Extract Draw Merge Layer Composite Execution ### STR-016 - Extract Draw Merge Layer Composite Execution

View File

@@ -322,23 +322,15 @@ std::array<pp::paint_renderer::CanvasStrokePoint, 4> make_stroke_preview_sample_
}; };
} }
void upload_stroke_preview_brush_vertices(DynamicShape& brush_shape, std::span<const vertex_t> vertices) pp::panopainter::LegacyStrokeSampleExecutionRequest make_stroke_preview_sample_request(
{
brush_shape.update_vertices(
const_cast<vertex_t*>(vertices.data()),
static_cast<int>(vertices.size()));
}
glm::vec4 execute_stroke_preview_sample_pass(
std::array<vertex_t, 4>& vertices, std::array<vertex_t, 4>& vertices,
const std::array<pp::paint_renderer::CanvasStrokePoint, 4>& sample_points,
glm::vec2 target_size, glm::vec2 target_size,
Texture2D& blend_texture, Texture2D& blend_texture,
DynamicShape& brush_shape, DynamicShape& brush_shape,
bool copy_stroke_destination) bool copy_stroke_destination)
{ {
const auto sample_points = make_stroke_preview_sample_points(vertices); return pp::panopainter::LegacyStrokeSampleExecutionRequest {
const auto result = pp::panopainter::execute_legacy_canvas_stroke_sample(
pp::panopainter::LegacyStrokeSampleExecutionRequest {
.context = "NodeStrokePreview::stroke_draw_samples", .context = "NodeStrokePreview::stroke_draw_samples",
.target_size = target_size, .target_size = target_size,
.vertices = vertices, .vertices = vertices,
@@ -371,7 +363,32 @@ glm::vec4 execute_stroke_preview_sample_pass(
.draw_brush_shape = [&] { .draw_brush_shape = [&] {
brush_shape.draw_fill(); brush_shape.draw_fill();
}, },
}); };
}
void upload_stroke_preview_brush_vertices(DynamicShape& brush_shape, std::span<const vertex_t> vertices)
{
brush_shape.update_vertices(
const_cast<vertex_t*>(vertices.data()),
static_cast<int>(vertices.size()));
}
glm::vec4 execute_stroke_preview_sample_pass(
std::array<vertex_t, 4>& vertices,
glm::vec2 target_size,
Texture2D& blend_texture,
DynamicShape& brush_shape,
bool copy_stroke_destination)
{
const auto sample_points = make_stroke_preview_sample_points(vertices);
const auto result = pp::panopainter::execute_legacy_canvas_stroke_sample(
make_stroke_preview_sample_request(
vertices,
sample_points,
target_size,
blend_texture,
brush_shape,
copy_stroke_destination));
return result.dirty_bounds; return result.dirty_bounds;
} }