Extract preview sample pass request helper
This commit is contained in:
@@ -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
|
||||
```
|
||||
|
||||
### 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-016 - Extract Draw Merge Layer Composite Execution
|
||||
|
||||
@@ -322,6 +322,50 @@ std::array<pp::paint_renderer::CanvasStrokePoint, 4> make_stroke_preview_sample_
|
||||
};
|
||||
}
|
||||
|
||||
pp::panopainter::LegacyStrokeSampleExecutionRequest make_stroke_preview_sample_request(
|
||||
std::array<vertex_t, 4>& vertices,
|
||||
const std::array<pp::paint_renderer::CanvasStrokePoint, 4>& sample_points,
|
||||
glm::vec2 target_size,
|
||||
Texture2D& blend_texture,
|
||||
DynamicShape& brush_shape,
|
||||
bool copy_stroke_destination)
|
||||
{
|
||||
return pp::panopainter::LegacyStrokeSampleExecutionRequest {
|
||||
.context = "NodeStrokePreview::stroke_draw_samples",
|
||||
.target_size = target_size,
|
||||
.vertices = vertices,
|
||||
.sample_points = sample_points,
|
||||
.copy_stroke_destination = copy_stroke_destination,
|
||||
.bind_destination_texture = [&] {
|
||||
bind_stroke_preview_destination_texture(blend_texture);
|
||||
},
|
||||
.copy_framebuffer_to_destination_texture = [](
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height) {
|
||||
copy_stroke_preview_destination_texture_region(
|
||||
src_x,
|
||||
src_y,
|
||||
dst_x,
|
||||
dst_y,
|
||||
width,
|
||||
height);
|
||||
},
|
||||
.unbind_destination_texture = [&] {
|
||||
unbind_stroke_preview_destination_texture(blend_texture);
|
||||
},
|
||||
.upload_brush_vertices = [&](std::span<const vertex_t> brush_vertices) {
|
||||
upload_stroke_preview_brush_vertices(brush_shape, brush_vertices);
|
||||
},
|
||||
.draw_brush_shape = [&] {
|
||||
brush_shape.draw_fill();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
void upload_stroke_preview_brush_vertices(DynamicShape& brush_shape, std::span<const vertex_t> vertices)
|
||||
{
|
||||
brush_shape.update_vertices(
|
||||
@@ -338,40 +382,13 @@ glm::vec4 execute_stroke_preview_sample_pass(
|
||||
{
|
||||
const auto sample_points = make_stroke_preview_sample_points(vertices);
|
||||
const auto result = pp::panopainter::execute_legacy_canvas_stroke_sample(
|
||||
pp::panopainter::LegacyStrokeSampleExecutionRequest {
|
||||
.context = "NodeStrokePreview::stroke_draw_samples",
|
||||
.target_size = target_size,
|
||||
.vertices = vertices,
|
||||
.sample_points = sample_points,
|
||||
.copy_stroke_destination = copy_stroke_destination,
|
||||
.bind_destination_texture = [&] {
|
||||
bind_stroke_preview_destination_texture(blend_texture);
|
||||
},
|
||||
.copy_framebuffer_to_destination_texture = [](
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height) {
|
||||
copy_stroke_preview_destination_texture_region(
|
||||
src_x,
|
||||
src_y,
|
||||
dst_x,
|
||||
dst_y,
|
||||
width,
|
||||
height);
|
||||
},
|
||||
.unbind_destination_texture = [&] {
|
||||
unbind_stroke_preview_destination_texture(blend_texture);
|
||||
},
|
||||
.upload_brush_vertices = [&](std::span<const vertex_t> brush_vertices) {
|
||||
upload_stroke_preview_brush_vertices(brush_shape, brush_vertices);
|
||||
},
|
||||
.draw_brush_shape = [&] {
|
||||
brush_shape.draw_fill();
|
||||
},
|
||||
});
|
||||
make_stroke_preview_sample_request(
|
||||
vertices,
|
||||
sample_points,
|
||||
target_size,
|
||||
blend_texture,
|
||||
brush_shape,
|
||||
copy_stroke_destination));
|
||||
return result.dirty_bounds;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user