Share retained stroke sample and mix helpers

This commit is contained in:
2026-06-13 10:46:58 +02:00
parent 2fadfdcd3e
commit 78790e9b52
6 changed files with 145 additions and 48 deletions

View File

@@ -535,25 +535,11 @@ glm::vec4 Canvas::stroke_draw_samples(
std::vector<vertex_t>& P,
bool copy_stroke_destination)
{
if (P.size() != 3 && P.size() != 4) {
P = triangulate_simple(P);
}
std::vector<pp::paint_renderer::CanvasStrokePoint> sample_points;
sample_points.reserve(P.size());
for (const auto& vertex : P) {
sample_points.push_back(pp::paint_renderer::CanvasStrokePoint {
.x = vertex.pos.x,
.y = vertex.pos.y,
});
}
const auto result = pp::panopainter::execute_legacy_canvas_stroke_sample(
pp::panopainter::LegacyStrokeSampleExecutionRequest {
const auto result = pp::panopainter::execute_legacy_canvas_stroke_sample_polygon(
pp::panopainter::LegacyStrokeSamplePolygonExecutionRequest {
.context = "Canvas::stroke_draw_samples",
.target_size = { m_width, m_height },
.vertices = P,
.sample_points = sample_points,
.polygon_vertices = P,
.copy_stroke_destination = copy_stroke_destination,
.bind_destination_texture = [&] {
set_active_texture_unit(1);