| Flutter Impeller |

Public Member Functions | List of all members
impeller::GLESVertexWriter Class Reference

A vertex writer that has no hardware requirements. More...

`#include <path_component.h>`

Inheritance diagram for impeller::GLESVertexWriter:

## Public Member Functions
| GLESVertexWriter (std::vector< Point > &points, std::vector< uint16_t > &indices)
| ~GLESVertexWriter ()=default
void | EndContour () override
void | Write (Point point) override

## Detailed Description

A vertex writer that has no hardware requirements.

Definition at line 93 of file path_component.h.

## Constructor & Destructor Documentation

## ◆ GLESVertexWriter()

impeller::GLESVertexWriter::GLESVertexWriter | ( | std::vector< Point > & | points,
|  | std::vector< uint16_t > & | indices
| ) |  |
| explicit

Definition at line 107 of file path_component.cc.

109 : points_(points), indices_(indices) {}

## ◆ ~GLESVertexWriter()

impeller::GLESVertexWriter::~GLESVertexWriter | ( |  | ) |
| default

## Member Function Documentation

## ◆ EndContour()

void impeller::GLESVertexWriter::EndContour | ( |  | ) |
| override virtual

Implements impeller::VertexWriter.

Definition at line 111 of file path_component.cc.

111 {
112 if (points_.size() == 0u || contour_start_ == points_.size() - 1) {
113 // Empty or first contour.
114 return;
115 }
116
117 auto start = contour_start_;
118 auto end = points_.size() - 1;
119 // All filled paths are drawn as if they are closed, but if
120 // there is an explicit close then a lineTo to the origin
121 // is inserted. This point isn't strictly necesary to
122 // correctly render the shape and can be dropped.
123 if (points_[end] == points_[start]) {
124 end--;
125 }
126
127 // Triangle strip break for subsequent contours
128 if (contour_start_ != 0) {
129 auto back = indices_.back();
130 indices_.push_back(back);
131 indices_.push_back(start);
132 indices_.push_back(start);
133
134 // If the contour has an odd number of points, insert an extra point when
135 // bridging to the next contour to preserve the correct triangle winding
136 // order.
137 if (previous_contour_odd_points_) {
138 indices_.push_back(start);
139 }
140 } else {
141 indices_.push_back(start);
142 }
143
144 size_t a = start + 1;
145 size_t b = end;
146 while (a < b) {
147 indices_.push_back(a);
148 indices_.push_back(b);
149 a++;
150 b--;
151 }
152 if (a == b) {
153 indices_.push_back(a);
154 previous_contour_odd_points_ = false;
155 } else {
156 previous_contour_odd_points_ = true;
157 }
158 contour_start_ = points_.size();
159 }
impeller::saturated::b
SI b
Definition: saturated_math.h:87

References impeller::saturated::b.

## ◆ Write()

void impeller::GLESVertexWriter::Write | ( | Point | point | ) |
| override virtual

Implements impeller::VertexWriter.

Definition at line 161 of file path_component.cc.

161 {
162 points_.push_back(point);
163 }

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

- impeller/geometry/path_component.h
- impeller/geometry/path_component.cc