146 {
147 if (fVertices) {
148 fVertices->fBounds.
setBounds(fVertices->fPositions, fVertices->fVertexCount);
150 if (fIntermediateFanIndices) {
152 auto tempIndices = this->
indices();
153 for (int t = 0; t < fVertices->fIndexCount - 2; ++t) {
154 fVertices->fIndices[3 * t + 0] = tempIndices[0];
155 fVertices->fIndices[3 * t + 1] = tempIndices[t + 1];
156 fVertices->fIndices[3 * t + 2] = tempIndices[t + 2];
157 }
158 fVertices->fIndexCount = 3 * (fVertices->fIndexCount - 2);
159 } else {
161 for (int t = 0; t < fVertices->fVertexCount - 2; ++t) {
162 fVertices->fIndices[3 * t + 0] = 0;
163 fVertices->fIndices[3 * t + 1] =
SkToU16(t + 1);
164 fVertices->fIndices[3 * t + 2] =
SkToU16(t + 2);
165 }
166 fVertices->fIndexCount = 3 * (fVertices->fVertexCount - 2);
167 }
169 }
170 fVertices->fUniqueID =
next_id();
171 return std::move(fVertices);
172 }
173 return nullptr;
174}
constexpr uint16_t SkToU16(S x)
static uint32_t next_id()
@ kTriangleFan_VertexMode
void setBounds(const SkPoint pts[], int count)