337 if (supports_primitive_restart) {
339 const auto [point_count, contour_count] =
341 BufferView point_buffer = data_host_buffer.Emplace(
342 nullptr,
sizeof(
Point) * point_count,
alignof(
Point));
343 BufferView index_buffer = indexes_host_buffer.Emplace(
344 nullptr,
sizeof(IndexT) * (point_count + contour_count),
348 reinterpret_cast<Point*
>(point_buffer.GetBuffer()->OnGetContents() +
349 point_buffer.GetRange().offset);
351 reinterpret_cast<IndexT*
>(index_buffer.GetBuffer()->OnGetContents() +
352 index_buffer.GetRange().offset);
354 auto tessellate_path = [&](
auto& writer) {
356 FML_DCHECK(writer.GetPointCount() <= point_count);
357 FML_DCHECK(writer.GetIndexCount() <= (point_count + contour_count));
358 point_buffer.GetBuffer()->Flush(point_buffer.GetRange());
359 index_buffer.GetBuffer()->Flush(index_buffer.GetRange());
362 .vertex_buffer = std::move(point_buffer),
363 .index_buffer = std::move(index_buffer),
364 .vertex_count = writer.GetIndexCount(),
365 .index_type = IndexTypeFor<IndexT>(),
369 if (supports_triangle_fan) {
370 FanPathVertexWriter writer(points_ptr, indices_ptr);
371 return tessellate_path(writer);
373 StripPathVertexWriter writer(points_ptr, indices_ptr);
374 return tessellate_path(writer);
378 DoTessellateConvexInternal(path, point_buffer_, index_buffer_, tolerance);
380 if (point_buffer_.empty()) {
385 .index_type = IndexTypeFor<IndexT>(),
389 BufferView vertex_buffer = data_host_buffer.Emplace(
390 point_buffer_.data(),
sizeof(
Point) * point_buffer_.size(),
393 BufferView index_buffer = indexes_host_buffer.Emplace(
394 index_buffer_.data(),
sizeof(IndexT) * index_buffer_.size(),
398 .vertex_buffer = std::move(vertex_buffer),
399 .index_buffer = std::move(index_buffer),
400 .vertex_count = index_buffer_.size(),
401 .index_type = IndexTypeFor<IndexT>(),
static void PathToFilledVertices(const PathSource &source, VertexWriter &writer, Scalar scale)
static std::pair< size_t, size_t > CountFillStorage(const PathSource &source, Scalar scale)