5 #ifndef FLUTTER_IMPELLER_GEOMETRY_PATH_COMPONENT_H_
6 #define FLUTTER_IMPELLER_GEOMETRY_PATH_COMPONENT_H_
11 #include <type_traits>
44 size_t index_count_ = 0;
45 Point* point_buffer_ =
nullptr;
46 uint16_t* index_buffer_ =
nullptr;
65 size_t index_count_ = 0;
66 size_t contour_start_ = 0;
67 Point* point_buffer_ =
nullptr;
68 uint16_t* index_buffer_ =
nullptr;
88 std::vector<Point>& points_;
89 std::vector<Point> overflow_;
96 std::vector<uint16_t>& indices);
105 bool previous_contour_odd_points_ =
false;
106 size_t contour_start_ = 0u;
107 std::vector<Point>& points_;
108 std::vector<uint16_t>& indices_;
123 std::vector<Point>
Extrema()
const;
126 return p1 == other.
p1 &&
p2 == other.
p2;
146 :
p1(ap1),
cp(acp),
p2(ap2) {}
153 std::vector<Point>& points)
const;
163 std::vector<Point>
Extrema()
const;
166 return p1 == other.
p1 &&
cp == other.
cp &&
p2 == other.
p2;
253 std::vector<Point>& points)
const;
263 std::vector<Point>
Extrema()
const;
266 return p1 == other.
p1 &&
cp == other.
cp &&
p2 == other.
p2 &&
294 cp1(q.
p1 + (q.cp - q.
p1) * (2.0 / 3.0)),
295 cp2(q.
p2 + (q.cp - q.
p2) * (2.0 / 3.0)),
307 std::vector<Point>
Extrema()
const;
A vertex writer that generates a triangle fan and requires primitive restart.
void EndContour() override
size_t GetIndexCount() const
void Write(Point point) override
FanVertexWriter(Point *point_buffer, uint16_t *index_buffer)
A vertex writer that has no hardware requirements.
GLESVertexWriter(std::vector< Point > &points, std::vector< uint16_t > &indices)
void Write(Point point) override
~GLESVertexWriter()=default
void EndContour() override
A vertex writer that generates a line strip topology.
std::pair< size_t, size_t > GetVertexCount() const
LineStripVertexWriter(std::vector< Point > &points)
void Write(Point point) override
void EndContour() override
~LineStripVertexWriter()=default
const std::vector< Point > & GetOversizedBuffer() const
A vertex writer that generates a triangle strip and requires primitive restart.
void Write(Point point) override
size_t GetIndexCount() const
StripVertexWriter(Point *point_buffer, uint16_t *index_buffer)
void EndContour() override
An interface for generating a multi contour polyline as a triangle strip.
virtual void EndContour()=0
virtual void Write(Point point)=0
std::optional< Vector2 > GetEndDirection() const
std::array< QuadraticPathComponent, 2 > ToQuadraticPathComponents() const
size_t CountLinearPathComponents(Scalar scale) const
Point Solve(Scalar time) const
ConicPathComponent(Point ap1, Point acp, Point ap2, Scalar weight)
bool operator==(const ConicPathComponent &other) const
void ToLinearPathComponents(Scalar scale_factor, const PointProc &proc) const
std::vector< Point > Extrema() const
std::optional< Vector2 > GetStartDirection() const
void SubdivideToQuadraticPoints(std::array< Point, 5 > &points) const
std::function< void(const Point &point)> PointProc
void AppendPolylinePoints(Scalar scale_factor, std::vector< Point > &points) const
bool operator==(const ContourComponent &other) const
constexpr bool IsClosed() const
ContourComponent(Point p, Point closed)
void ToLinearPathComponents(Scalar scale, const PointProc &proc) const
size_t CountLinearPathComponents(Scalar scale) const
void AppendPolylinePoints(Scalar scale, std::vector< Point > &points) const
CubicPathComponent(Point ap1, Point acp1, Point acp2, Point ap2)
bool operator==(const CubicPathComponent &other) const
std::function< void(const Point &point)> PointProc
CubicPathComponent Subsegment(Scalar t0, Scalar t1) const
Point Solve(Scalar time) const
std::optional< Vector2 > GetStartDirection() const
std::vector< Point > Extrema() const
std::optional< Vector2 > GetEndDirection() const
Point SolveDerivative(Scalar time) const
CubicPathComponent(const QuadraticPathComponent &q)
std::optional< Vector2 > GetEndDirection() const
LinearPathComponent(Point ap1, Point ap2)
std::optional< Vector2 > GetStartDirection() const
std::vector< Point > Extrema() const
bool operator==(const LinearPathComponent &other) const
Point Solve(Scalar time) const
void AppendPolylinePoints(std::vector< Point > &points) const
size_t CountLinearPathComponents(Scalar scale) const
std::optional< Vector2 > GetEndDirection() const
QuadraticPathComponent(Point ap1, Point acp, Point ap2)
void AppendPolylinePoints(Scalar scale_factor, std::vector< Point > &points) const
bool operator==(const QuadraticPathComponent &other) const
std::function< void(const Point &point)> PointProc
std::vector< Point > Extrema() const
Point SolveDerivative(Scalar time) const
std::optional< Vector2 > GetStartDirection() const
void ToLinearPathComponents(Scalar scale_factor, const PointProc &proc) const
Point Solve(Scalar time) const