27 if (determinant == 0) {
34 HostBuffer& host_buffer =
renderer.GetTransientsBuffer();
35 VertexBufferBuilder<SolidFillVertexShader::PerVertexData> vtx_builder;
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);
48 FML_DCHECK(circle_vertices.size() == generator.GetVertexCount());
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]});
57 for (
auto& vertex : circle_vertices) {
58 vtx_builder.AppendVertex({
center + vertex});
62 vtx_builder.Reserve(6 * points_.size() - 2);
63 for (
auto& point : points_) {
64 auto first =
Point(point.x - radius, point.y - radius);
66 if (vtx_builder.HasVertices()) {
67 vtx_builder.AppendVertex(vtx_builder.Last());
68 vtx_builder.AppendVertex({first});
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}});
79 return GeometryResult{
81 .vertex_buffer = vtx_builder.CreateVertexBuffer(host_buffer),
87std::optional<Rect> PointFieldGeometry::GetCoverage(
89 if (points_.size() > 0) {
92 auto first = points_.begin();
93 auto last = points_.end();
96 auto right = first->x;
97 auto bottom = first->y;
98 for (
auto it = first + 1; it < last; ++it) {
105 right + radius_, bottom + radius_);
static void round(SkPoint *p)
static const int points[]
Matrix GetShaderTransform(const RenderPass &pass) const
Get the vertex shader transform used for drawing this Entity.
const Matrix & GetTransform() const
Get the global transform matrix for this Entity.
PointFieldGeometry(std::vector< Point > points, Scalar radius, bool round)
Render passes encode render commands directed as one specific render target into an underlying comman...
#define FML_DCHECK(condition)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
SK_API sk_sp< PrecompileColorFilter > Matrix()
SIN Vec< N, float > abs(const Vec< N, float > &x)
SIN Vec< N, float > sqrt(const Vec< N, float > &x)
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)