Extract stroke draw samples request assembly

This commit is contained in:
2026-06-13 23:41:04 +02:00
parent 3d8f798412
commit 3acb2da300
2 changed files with 40 additions and 25 deletions

View File

@@ -759,37 +759,48 @@ glm::vec4 Canvas::stroke_draw_samples(
m_tex[i].unbind(); m_tex[i].unbind();
}); });
const auto result = pp::panopainter::execute_legacy_canvas_stroke_face_sample_polygon( const auto result = pp::panopainter::execute_legacy_canvas_stroke_face_sample_polygon(
pp::panopainter::LegacyStrokeFaceSamplePolygonExecutionRequest { make_stroke_draw_samples_request(
.context = "Canvas::stroke_draw_samples", i,
.target_size = { m_width, m_height }, P,
.polygon_vertices = P, copy_stroke_destination),
.face_index = i,
.copy_stroke_destination = copy_stroke_destination,
.copy_framebuffer_to_destination_texture = [](
int,
int src_x,
int src_y,
int dst_x,
int dst_y,
int width,
int height) {
copy_framebuffer_to_texture_2d(src_x, src_y, dst_x, dst_y, width, height);
},
.upload_brush_vertices = [&](int, std::span<const vertex_t> vertices) {
m_brush_shape.update_vertices(
const_cast<vertex_t*>(vertices.data()),
static_cast<int>(vertices.size()));
},
.draw_brush_shape = [&](int) {
m_brush_shape.draw_fill();
},
},
destination_texture_binding, destination_texture_binding,
destination_texture_dispatch); destination_texture_dispatch);
return result.dirty_bounds; return result.dirty_bounds;
} }
pp::panopainter::LegacyStrokeFaceSamplePolygonExecutionRequest Canvas::make_stroke_draw_samples_request(
int face_index,
std::vector<vertex_t>& polygon_vertices,
bool copy_stroke_destination) const
{
return pp::panopainter::LegacyStrokeFaceSamplePolygonExecutionRequest {
.context = "Canvas::stroke_draw_samples",
.target_size = { m_width, m_height },
.polygon_vertices = polygon_vertices,
.face_index = face_index,
.copy_stroke_destination = copy_stroke_destination,
.copy_framebuffer_to_destination_texture = [](
int,
int src_x,
int src_y,
int dst_x,
int dst_y,
int width,
int height) {
copy_framebuffer_to_texture_2d(src_x, src_y, dst_x, dst_y, width, height);
},
.upload_brush_vertices = [&](int, std::span<const vertex_t> vertices) {
m_brush_shape.update_vertices(
const_cast<vertex_t*>(vertices.data()),
static_cast<int>(vertices.size()));
},
.draw_brush_shape = [&](int) {
m_brush_shape.draw_fill();
},
};
}
template <typename BuildRequest> template <typename BuildRequest>
static auto execute_canvas_stroke_commit_sequence( static auto execute_canvas_stroke_commit_sequence(
BuildRequest&& build_request) BuildRequest&& build_request)

View File

@@ -279,6 +279,10 @@ private:
void draw_merge_final_plane_composite( void draw_merge_final_plane_composite(
const glm::mat4& ortho, const glm::mat4& ortho,
bool draw_checkerboard); bool draw_checkerboard);
pp::panopainter::LegacyStrokeFaceSamplePolygonExecutionRequest make_stroke_draw_samples_request(
int face_index,
std::vector<vertex_t>& polygon_vertices,
bool copy_stroke_destination) const;
void stroke_draw_dual_pass( void stroke_draw_dual_pass(
const std::vector<StrokeFrame>& frames_dual, const std::vector<StrokeFrame>& frames_dual,
const std::array<pp::panopainter::LegacyCanvasStrokeTextureBinding, 1>& dual_pass_texture_bindings, const std::array<pp::panopainter::LegacyCanvasStrokeTextureBinding, 1>& dual_pass_texture_bindings,