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();
});
const auto result = pp::panopainter::execute_legacy_canvas_stroke_face_sample_polygon(
pp::panopainter::LegacyStrokeFaceSamplePolygonExecutionRequest {
.context = "Canvas::stroke_draw_samples",
.target_size = { m_width, m_height },
.polygon_vertices = P,
.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();
},
},
make_stroke_draw_samples_request(
i,
P,
copy_stroke_destination),
destination_texture_binding,
destination_texture_dispatch);
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>
static auto execute_canvas_stroke_commit_sequence(
BuildRequest&& build_request)