21 {
22 if (radius_ < 0.0) {
23 return {};
24 }
27 if (determinant == 0) {
28 return {};
29 }
30
31 Scalar min_size = 1.0f /
sqrt(std::abs(determinant));
32 Scalar radius = std::max(radius_, min_size);
33
34 HostBuffer& host_buffer =
renderer.GetTransientsBuffer();
35 VertexBufferBuilder<SolidFillVertexShader::PerVertexData> vtx_builder;
36
37 if (round_) {
38
39
40 auto generator =
43 std::vector<Point> circle_vertices;
44 circle_vertices.reserve(generator.GetVertexCount());
45 generator.GenerateVertices([&circle_vertices](
const Point& p) {
46 circle_vertices.push_back(p);
47 });
48 FML_DCHECK(circle_vertices.size() == generator.GetVertexCount());
49
50 vtx_builder.Reserve((circle_vertices.size() + 2) * points_.size() - 2);
51 for (
auto&
center : points_) {
52 if (vtx_builder.HasVertices()) {
53 vtx_builder.AppendVertex(vtx_builder.Last());
54 vtx_builder.AppendVertex({
center + circle_vertices[0]});
55 }
56
57 for (auto& vertex : circle_vertices) {
58 vtx_builder.AppendVertex({
center + vertex});
59 }
60 }
61 } else {
62 vtx_builder.Reserve(6 * points_.size() - 2);
63 for (auto& point : points_) {
64 auto first =
Point(point.x - radius, point.y - radius);
65
66 if (vtx_builder.HasVertices()) {
67 vtx_builder.AppendVertex(vtx_builder.Last());
68 vtx_builder.AppendVertex({first});
69 }
70
71
72 vtx_builder.AppendVertex({first});
73 vtx_builder.AppendVertex({{point.x + radius, point.y - radius}});
74 vtx_builder.AppendVertex({{point.x - radius, point.y + radius}});
75 vtx_builder.AppendVertex({{point.x + radius, point.y + radius}});
76 }
77 }
78
79 return GeometryResult{
81 .vertex_buffer = vtx_builder.CreateVertexBuffer(host_buffer),
82 .transform = entity.GetShaderTransform(pass),
83 };
84}
static SkScalar center(float pos0, float pos1)
#define FML_DCHECK(condition)
SIN Vec< N, float > sqrt(const Vec< N, float > &x)