5#ifndef FLUTTER_IMPELLER_TESSELLATOR_TESSELLATOR_H_
6#define FLUTTER_IMPELLER_TESSELLATOR_TESSELLATOR_H_
39 explicit Trigs(std::vector<Trig>& trigs,
size_t divisions) : trigs_(trigs) {
44 explicit Trigs(
size_t divisions)
45 : local_storage_(std::make_unique<std::vector<Trig>>()),
46 trigs_(*local_storage_) {
52 auto inline size()
const {
return trigs_.size(); }
53 auto inline begin()
const {
return trigs_.begin(); }
54 auto inline end()
const {
return trigs_.end(); }
58 std::unique_ptr<std::vector<Trig>> local_storage_;
62 std::vector<Trig>& trigs_;
66 void init(
size_t divisions);
130 return trigs_.size() * vertices_per_trig_;
135 impl_(trigs_, data_, proc);
146 const Point reference_centers[2];
154 typedef void GeneratorProc(
const Trigs& trigs,
158 GeneratorProc& impl_;
161 const size_t vertices_per_trig_;
166 size_t vertices_per_trig,
197 std::vector<Point>& point_buffer,
198 std::vector<uint16_t>& index_buffer,
294 static constexpr size_t kCachedTrigCount = 300;
295 std::vector<Trig> precomputed_trigs_[kCachedTrigCount];
297 Trigs GetTrigsForDivisions(
size_t divisions);
299 static void GenerateFilledCircle(
const Trigs& trigs,
303 static void GenerateStrokedCircle(
const Trigs& trigs,
307 static void GenerateRoundCapLine(
const Trigs& trigs,
311 static void GenerateFilledEllipse(
const Trigs& trigs,
315 static void GenerateFilledRoundRect(
Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments....
The |VertexGenerator| implementation common to all shapes that are based on a polygonal representatio...
PrimitiveType GetTriangleType() const override
|VertexGenerator|
size_t GetVertexCount() const override
|VertexGenerator|
void GenerateVertices(const TessellatedVertexProc &proc) const override
|VertexGenerator|
An object which produces a list of vertices as |Point|s that tessellate a previously provided shape a...
virtual size_t GetVertexCount() const =0
Returns the number of vertices that the generator plans to produce, if known.
virtual PrimitiveType GetTriangleType() const =0
Returns the |PrimitiveType| that describes the relationship among the list of vertices produced by th...
virtual void GenerateVertices(const TessellatedVertexProc &proc) const =0
Generate the vertices and deliver them in the necessary order (as required by the PrimitiveType) to t...
A utility that generates triangles of the specified fill type given a polyline. This happens on the C...
VertexBuffer TessellateConvex(const Path &path, HostBuffer &host_buffer, Scalar tolerance)
Given a convex path, create a triangle fan structure.
EllipticalVertexGenerator RoundCapLine(const Matrix &view_transform, const Point &p0, const Point &p1, Scalar radius)
Create a |VertexGenerator| that can produce vertices for a line with round end caps of the given radi...
EllipticalVertexGenerator FilledRoundRect(const Matrix &view_transform, const Rect &bounds, const Size &radii)
Create a |VertexGenerator| that can produce vertices for a filled round rect within the given bounds ...
static constexpr Scalar kCircleTolerance
The pixel tolerance used by the algorighm to determine how many divisions to create for a circle.
static void TessellateConvexInternal(const Path &path, std::vector< Point > &point_buffer, std::vector< uint16_t > &index_buffer, Scalar tolerance)
Path::Polyline CreateTempPolyline(const Path &path, Scalar tolerance)
Create a temporary polyline. Only one per-process can exist at a time.
EllipticalVertexGenerator FilledCircle(const Matrix &view_transform, const Point ¢er, Scalar radius)
Create a |VertexGenerator| that can produce vertices for a filled circle of the given radius around t...
EllipticalVertexGenerator StrokedCircle(const Matrix &view_transform, const Point ¢er, Scalar radius, Scalar half_width)
Create a |VertexGenerator| that can produce vertices for a stroked circle of the given radius and hal...
std::unique_ptr< std::vector< Point > > point_buffer_
Used for polyline generation.
std::unique_ptr< std::vector< uint16_t > > index_buffer_
EllipticalVertexGenerator FilledEllipse(const Matrix &view_transform, const Rect &bounds)
Create a |VertexGenerator| that can produce vertices for a filled ellipse inscribed within the given ...
std::function< void(const Point &p)> TessellatedVertexProc
A callback function for a |VertexGenerator| to deliver the vertices it computes as |Point| objects.
static const char * begin(const StringSlice &s)
#define FML_DCHECK(condition)
Dart_NativeFunction function
Optional< SkRect > bounds
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
struct PathData * Data(SkPath *path)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
PrimitiveType
Decides how backend draws pixels based on input vertices.
A 4x4 matrix using column-major storage.
std::shared_ptr< const fml::Mapping > data