| Flutter Impeller |

point_field_geometry.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_IMPELLER_ENTITY_GEOMETRY_POINT_FIELD_GEOMETRY_H_
6 #define FLUTTER_IMPELLER_ENTITY_GEOMETRY_POINT_FIELD_GEOMETRY_H_
7
8 #include "impeller/entity/geometry/geometry.h"
9
10 namespace impeller {
11
12 class PointFieldGeometry final : public Geometry {
13 public:
14 PointFieldGeometry(std::vector<Point> points, Scalar radius, bool round);
15
16 ~PointFieldGeometry() = default;
17
18 static size_t ComputeCircleDivisions(Scalar scaled_radius, bool round);
19
20 /// If the platform can use compute safely.
21 static bool CanUseCompute(const ContentContext& renderer);
22
23 private:
24 // |Geometry|
25 GeometryResult GetPositionBuffer(const ContentContext& renderer,
26 const Entity& entity,
27 RenderPass& pass) const override;
28
29 // |Geometry|
30 GeometryResult GetPositionUVBuffer(Rect texture_coverage,
31 Matrix effect_transform,
32 const ContentContext& renderer,
33 const Entity& entity,
34 RenderPass& pass) const override;
35
36 // |Geometry|
37 GeometryVertexType GetVertexType() const override;
38
39 // |Geometry|
40 std::optional<Rect> GetCoverage(const Matrix& transform) const override;
41
42 GeometryResult GetPositionBufferGPU(
43 const ContentContext& renderer,
44 const Entity& entity,
45 RenderPass& pass,
46 std::optional<Rect> texture_coverage = std::nullopt,
47 std::optional<Matrix> effect_transform = std::nullopt) const;
48
49 std::optional<VertexBufferBuilder<SolidFillVertexShader::PerVertexData>>
50 GetPositionBufferCPU(const ContentContext& renderer,
51 const Entity& entity,
52 RenderPass& pass) const;
53
54 std::vector<Point> points_;
55 Scalar radius_;
56 bool round_;
57
58 PointFieldGeometry(const PointFieldGeometry&) = delete;
59
60 PointFieldGeometry& operator=(const PointFieldGeometry&) = delete;
61 };
62
63 } // namespace impeller
64
65 #endif // FLUTTER_IMPELLER_ENTITY_GEOMETRY_POINT_FIELD_GEOMETRY_H_
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::PointFieldGeometry
Definition: point_field_geometry.h:12
impeller::PointFieldGeometry::PointFieldGeometry
PointFieldGeometry(std::vector< Point > points, Scalar radius, bool round)
Definition: point_field_geometry.cc:12
impeller::GeometryVertexType
GeometryVertexType
Definition: geometry.h:34
impeller::Entity
Definition: entity.h:21
impeller::PointFieldGeometry::CanUseCompute
static bool CanUseCompute(const ContentContext &renderer)
If the platform can use compute safely.
Definition: point_field_geometry.cc:277
geometry.h
impeller::GeometryResult
Definition: geometry.h:20
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:29
impeller::PointFieldGeometry::~PointFieldGeometry
~PointFieldGeometry()=default
impeller::Geometry
Definition: geometry.h:58
impeller::PointFieldGeometry::ComputeCircleDivisions
static size_t ComputeCircleDivisions(Scalar scaled_radius, bool round)
Compute the number of vertices to divide each circle into.
Definition: point_field_geometry.cc:247
impeller
Definition: aiks_context.cc:10
impeller::ContentContext
Definition: content_context.h:332
impeller::TRect< Scalar >
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37