| Flutter Impeller |

Public Types | Public Member Functions | Public Attributes | List of all members
impeller::Path::Polyline Struct Reference

`#include <path.h>`

## Public Types
using | PointBufferPtr = std::unique_ptr< std::vector< Point > >
using | ReclaimPointBufferCallback = std::function< void(PointBufferPtr)>

## Public Member Functions
| Polyline (PointBufferPtr point_buffer, ReclaimPointBufferCallback reclaim)
| Polyline (Polyline &&other)
| ~Polyline ()
Point & | GetPoint (size_t index) const
std::tuple< size_t, size_t > | GetContourPointBounds (size_t contour_index) const

## Public Attributes
PointBufferPtr | points
std::vector< PolylineContour > | contours

## Detailed Description

One or more contours represented as a series of points and indices in the point vector representing the start of a new contour.

Polylines are ephemeral and meant to be used by the tessellator. They do not allocate their own point vectors to allow for optimizations around allocation and reuse of arenas.

Definition at line 110 of file path.h.

## Member Typedef Documentation

## ◆ PointBufferPtr

using impeller::Path::Polyline::PointBufferPtr = std::unique_ptr<std::vector<Point> >

The signature of a method called when it is safe to reclaim the point buffer provided to the constructor of this object.

Definition at line 113 of file path.h.

## ◆ ReclaimPointBufferCallback

using impeller::Path::Polyline::ReclaimPointBufferCallback = std::function<void(PointBufferPtr)>

Definition at line 114 of file path.h.

## Constructor & Destructor Documentation

## ◆ Polyline() [1/2]

impeller::Path::Polyline::Polyline | ( | PointBufferPtr | point_buffer,
|  | ReclaimPointBufferCallback | reclaim
| ) |  |

The buffer will be cleared and returned at the destruction of this polyline.

Definition at line 206 of file path.cc.

208 : points(std::move(point_buffer)), reclaim_points_(std::move(reclaim)) {
209 FML_DCHECK(points);
210 }

References points.

## ◆ Polyline() [2/2]

impeller::Path::Polyline::Polyline | ( | Path::Polyline && | other | ) |

Definition at line 212 of file path.cc.

212 {
213 points = std::move(other.points);
214 reclaim_points_ = std::move(other.reclaim_points_);
215 contours = std::move(other.contours);
216 }

## ◆ ~Polyline()

impeller::Path::Polyline::~Polyline | ( |  | ) |

Definition at line 218 of file path.cc.

218 {
219 if (reclaim_points_) {
220 points->clear();
221 reclaim_points_(std::move(points));
222 }
223 }

## Member Function Documentation

## ◆ GetContourPointBounds()

std::tuple< size_t, size_t > impeller::Path::Polyline::GetContourPointBounds | ( | size_t | contour_index | ) | const

Convenience method to compute the start (inclusive) and end (exclusive) point of the given contour index.

The contour_index parameter is clamped to contours.size().

Definition at line 21 of file path.cc.

22 {
23 if (contour_index >= contours.size()) {
24 return {points->size(), points->size()};
25 }
26 const size_t start_index = contours.at(contour_index).start_index;
27 const size_t end_index = (contour_index >= contours.size() - 1)
28 ? points->size()
29 : contours.at(contour_index + 1).start_index;
30 return std::make_tuple(start_index, end_index);
31 }

References contours, and points.

## ◆ GetPoint()

Point& impeller::Path::Polyline::GetPoint | ( | size_t | index | ) | const
| inline

Definition at line 127 of file path.h.

127 { return (*points)[index]; }

References points.

## Member Data Documentation

## ◆ contours

std::vector<PolylineContour> impeller::Path::Polyline::contours

Contours are disconnected pieces of a polyline, such as when a MoveTo was issued on a PathBuilder.

Definition at line 131 of file path.h.

Referenced by GetContourPointBounds().

## ◆ points

PointBufferPtr impeller::Path::Polyline::points

Points in the polyline, which may represent multiple contours specified by indices in |contours|.

Definition at line 125 of file path.h.

Referenced by impeller::BM_Polyline(), GetContourPointBounds(), GetPoint(), and Polyline().

The documentation for this struct was generated from the following files:

- impeller/geometry/path.h
- impeller/geometry/path.cc

impeller::Path::Polyline::points
PointBufferPtr points
Definition: path.h:125
impeller::Path::Polyline::contours
std::vector< PolylineContour > contours
Definition: path.h:131