Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
geometry_benchmarks.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/benchmarking/benchmarking.h"
6
7#include "flutter/impeller/entity/solid_fill.vert.h"
8
14
15namespace impeller {
16
18 public:
19 static std::vector<SolidFillVertexShader::PerVertexData>
22 Scalar miter_limit,
23 Join stroke_join,
24 Cap stroke_cap,
25 Scalar scale) {
26 return StrokePathGeometry::GenerateSolidStrokeVertices(
27 polyline, stroke_width, miter_limit, stroke_join, stroke_cap, scale);
28 }
29};
30
31namespace {
32/// A path with many connected cubic components, including
33/// overlaps/self-intersections/multi-contour.
34Path CreateCubic(bool closed);
35/// Similar to the path above, but with all cubics replaced by quadratics.
36Path CreateQuadratic(bool closed);
37/// Create a rounded rect.
38Path CreateRRect();
39} // namespace
40
42
43template <class... Args>
44static void BM_Polyline(benchmark::State& state, Args&&... args) {
45 auto args_tuple = std::make_tuple(std::move(args)...);
46 auto path = std::get<Path>(args_tuple);
47 bool tessellate = std::get<bool>(args_tuple);
48
49 size_t point_count = 0u;
50 size_t single_point_count = 0u;
51 auto points = std::make_unique<std::vector<Point>>();
52 points->reserve(2048);
53 while (state.KeepRunning()) {
54 if (tessellate) {
55 tess.Tessellate(path, 1.0f,
56 [&point_count, &single_point_count](
57 const float* vertices, size_t vertices_count,
58 const uint16_t* indices, size_t indices_count) {
59 if (indices_count > 0) {
60 single_point_count = indices_count;
61 point_count += indices_count;
62 } else {
63 single_point_count = vertices_count;
64 point_count += vertices_count;
65 }
66 return true;
67 });
68 } else {
69 auto polyline = path.CreatePolyline(
70 // Clang-tidy doesn't know that the points get moved back before
71 // getting moved again in this loop.
72 // NOLINTNEXTLINE(clang-analyzer-cplusplus.Move)
73 1.0f, std::move(points),
75 points = std::move(reclaimed);
76 });
77 single_point_count = polyline.points->size();
78 point_count += single_point_count;
79 }
80 }
81 state.counters["SinglePointCount"] = single_point_count;
82 state.counters["TotalPointCount"] = point_count;
83}
84
85template <class... Args>
86static void BM_StrokePolyline(benchmark::State& state, Args&&... args) {
87 auto args_tuple = std::make_tuple(std::move(args)...);
88 auto path = std::get<Path>(args_tuple);
89 auto cap = std::get<Cap>(args_tuple);
90 auto join = std::get<Join>(args_tuple);
91
92 const Scalar stroke_width = 5.0f;
93 const Scalar miter_limit = 10.0f;
94 const Scalar scale = 1.0f;
95
96 auto points = std::make_unique<std::vector<Point>>();
97 points->reserve(2048);
98 auto polyline =
99 path.CreatePolyline(1.0f, std::move(points),
101 points = std::move(reclaimed);
102 });
103
104 size_t point_count = 0u;
105 size_t single_point_count = 0u;
106 while (state.KeepRunning()) {
108 polyline, stroke_width, miter_limit, join, cap, scale);
109 single_point_count = vertices.size();
110 point_count += single_point_count;
111 }
112 state.counters["SinglePointCount"] = single_point_count;
113 state.counters["TotalPointCount"] = point_count;
114}
115
116template <class... Args>
117static void BM_Convex(benchmark::State& state, Args&&... args) {
118 auto args_tuple = std::make_tuple(std::move(args)...);
119 auto path = std::get<Path>(args_tuple);
120
121 size_t point_count = 0u;
122 size_t single_point_count = 0u;
123 auto points = std::make_unique<std::vector<Point>>();
124 points->reserve(2048);
125 while (state.KeepRunning()) {
126 auto points = tess.TessellateConvex(path, 1.0f);
127 single_point_count = points.size();
128 point_count += points.size();
129 }
130 state.counters["SinglePointCount"] = single_point_count;
131 state.counters["TotalPointCount"] = point_count;
132}
133
134#define MAKE_STROKE_BENCHMARK_CAPTURE(path, cap, join, closed, uvname, uvtype) \
135 BENCHMARK_CAPTURE(BM_StrokePolyline, stroke_##path##_##cap##_##join##uvname, \
136 Create##path(closed), Cap::k##cap, Join::k##join)
137
138#define MAKE_STROKE_BENCHMARK_CAPTURE_CAPS_JOINS(path, uvname, uvtype) \
139 MAKE_STROKE_BENCHMARK_CAPTURE(path, Butt, Bevel, false, uvname, uvtype); \
140 MAKE_STROKE_BENCHMARK_CAPTURE(path, Butt, Miter, false, uvname, uvtype); \
141 MAKE_STROKE_BENCHMARK_CAPTURE(path, Butt, Round, false, uvname, uvtype); \
142 MAKE_STROKE_BENCHMARK_CAPTURE(path, Square, Bevel, false, uvname, uvtype); \
143 MAKE_STROKE_BENCHMARK_CAPTURE(path, Round, Bevel, false, uvname, uvtype)
144
145BENCHMARK_CAPTURE(BM_Polyline, cubic_polyline, CreateCubic(true), false);
146BENCHMARK_CAPTURE(BM_Polyline, cubic_polyline_tess, CreateCubic(true), true);
148 unclosed_cubic_polyline,
149 CreateCubic(false),
150 false);
151
152BENCHMARK_CAPTURE(BM_Polyline, quad_polyline, CreateQuadratic(true), false);
153BENCHMARK_CAPTURE(BM_Polyline, quad_polyline_tess, CreateQuadratic(true), true);
155 unclosed_quad_polyline,
156 CreateQuadratic(false),
157 false);
158
159BENCHMARK_CAPTURE(BM_Convex, rrect_convex, CreateRRect(), true);
160MAKE_STROKE_BENCHMARK_CAPTURE(RRect, Butt, Bevel, , , );
161
162namespace {
163
164Path CreateRRect() {
165 return PathBuilder{}
166 .AddRoundedRect(Rect::MakeLTRB(0, 0, 400, 400), 16)
167 .TakePath();
168}
169
170Path CreateCubic(bool closed) {
171 auto builder = PathBuilder{};
172 builder //
173 .MoveTo({359.934, 96.6335})
174 .CubicCurveTo({358.189, 96.7055}, {356.436, 96.7908}, {354.673, 96.8895})
175 .CubicCurveTo({354.571, 96.8953}, {354.469, 96.9016}, {354.367, 96.9075})
176 .CubicCurveTo({352.672, 97.0038}, {350.969, 97.113}, {349.259, 97.2355})
177 .CubicCurveTo({349.048, 97.2506}, {348.836, 97.2678}, {348.625, 97.2834})
178 .CubicCurveTo({347.019, 97.4014}, {345.407, 97.5299}, {343.789, 97.6722})
179 .CubicCurveTo({343.428, 97.704}, {343.065, 97.7402}, {342.703, 97.7734})
180 .CubicCurveTo({341.221, 97.9086}, {339.736, 98.0505}, {338.246, 98.207})
181 .CubicCurveTo({337.702, 98.2642}, {337.156, 98.3292}, {336.612, 98.3894})
182 .CubicCurveTo({335.284, 98.5356}, {333.956, 98.6837}, {332.623, 98.8476})
183 .CubicCurveTo({332.495, 98.8635}, {332.366, 98.8818}, {332.237, 98.8982})
184 .LineTo({332.237, 102.601})
185 .LineTo({321.778, 102.601})
186 .LineTo({321.778, 100.382})
187 .CubicCurveTo({321.572, 100.413}, {321.367, 100.442}, {321.161, 100.476})
188 .CubicCurveTo({319.22, 100.79}, {317.277, 101.123}, {315.332, 101.479})
189 .CubicCurveTo({315.322, 101.481}, {315.311, 101.482}, {315.301, 101.484})
190 .LineTo({310.017, 105.94})
191 .LineTo({309.779, 105.427})
192 .LineTo({314.403, 101.651})
193 .CubicCurveTo({314.391, 101.653}, {314.379, 101.656}, {314.368, 101.658})
194 .CubicCurveTo({312.528, 102.001}, {310.687, 102.366}, {308.846, 102.748})
195 .CubicCurveTo({307.85, 102.955}, {306.855, 103.182}, {305.859, 103.4})
196 .CubicCurveTo({305.048, 103.579}, {304.236, 103.75}, {303.425, 103.936})
197 .LineTo({299.105, 107.578})
198 .LineTo({298.867, 107.065})
199 .LineTo({302.394, 104.185})
200 .LineTo({302.412, 104.171})
201 .CubicCurveTo({301.388, 104.409}, {300.366, 104.67}, {299.344, 104.921})
202 .CubicCurveTo({298.618, 105.1}, {297.89, 105.269}, {297.165, 105.455})
203 .CubicCurveTo({295.262, 105.94}, {293.36, 106.445}, {291.462, 106.979})
204 .CubicCurveTo({291.132, 107.072}, {290.802, 107.163}, {290.471, 107.257})
205 .CubicCurveTo({289.463, 107.544}, {288.455, 107.839}, {287.449, 108.139})
206 .CubicCurveTo({286.476, 108.431}, {285.506, 108.73}, {284.536, 109.035})
207 .CubicCurveTo({283.674, 109.304}, {282.812, 109.579}, {281.952, 109.859})
208 .CubicCurveTo({281.177, 110.112}, {280.406, 110.377}, {279.633, 110.638})
209 .CubicCurveTo({278.458, 111.037}, {277.256, 111.449}, {276.803, 111.607})
210 .CubicCurveTo({276.76, 111.622}, {276.716, 111.637}, {276.672, 111.653})
211 .CubicCurveTo({275.017, 112.239}, {273.365, 112.836}, {271.721, 113.463})
212 .LineTo({271.717, 113.449})
213 .CubicCurveTo({271.496, 113.496}, {271.238, 113.559}, {270.963, 113.628})
214 .CubicCurveTo({270.893, 113.645}, {270.822, 113.663}, {270.748, 113.682})
215 .CubicCurveTo({270.468, 113.755}, {270.169, 113.834}, {269.839, 113.926})
216 .CubicCurveTo({269.789, 113.94}, {269.732, 113.957}, {269.681, 113.972})
217 .CubicCurveTo({269.391, 114.053}, {269.081, 114.143}, {268.756, 114.239})
218 .CubicCurveTo({268.628, 114.276}, {268.5, 114.314}, {268.367, 114.354})
219 .CubicCurveTo({268.172, 114.412}, {267.959, 114.478}, {267.752, 114.54})
220 .CubicCurveTo({263.349, 115.964}, {258.058, 117.695}, {253.564, 119.252})
221 .CubicCurveTo({253.556, 119.255}, {253.547, 119.258}, {253.538, 119.261})
222 .CubicCurveTo({251.844, 119.849}, {250.056, 120.474}, {248.189, 121.131})
223 .CubicCurveTo({248, 121.197}, {247.812, 121.264}, {247.621, 121.331})
224 .CubicCurveTo({247.079, 121.522}, {246.531, 121.715}, {245.975, 121.912})
225 .CubicCurveTo({245.554, 122.06}, {245.126, 122.212}, {244.698, 122.364})
226 .CubicCurveTo({244.071, 122.586}, {243.437, 122.811}, {242.794, 123.04})
227 .CubicCurveTo({242.189, 123.255}, {241.58, 123.472}, {240.961, 123.693})
228 .CubicCurveTo({240.659, 123.801}, {240.357, 123.909}, {240.052, 124.018})
229 .CubicCurveTo({239.12, 124.351}, {238.18, 124.687}, {237.22, 125.032})
230 .LineTo({237.164, 125.003})
231 .CubicCurveTo({236.709, 125.184}, {236.262, 125.358}, {235.81, 125.538})
232 .CubicCurveTo({235.413, 125.68}, {234.994, 125.832}, {234.592, 125.977})
233 .CubicCurveTo({234.592, 125.977}, {234.591, 125.977}, {234.59, 125.977})
234 .CubicCurveTo({222.206, 130.435}, {207.708, 135.753}, {192.381, 141.429})
235 .CubicCurveTo({162.77, 151.336}, {122.17, 156.894}, {84.1123, 160})
236 .LineTo({360, 160})
237 .LineTo({360, 119.256})
238 .LineTo({360, 106.332})
239 .LineTo({360, 96.6307})
240 .CubicCurveTo({359.978, 96.6317}, {359.956, 96.6326}, {359.934, 96.6335});
241 if (closed) {
242 builder.Close();
243 }
244 builder //
245 .MoveTo({337.336, 124.143})
246 .CubicCurveTo({337.274, 122.359}, {338.903, 121.511}, {338.903, 121.511})
247 .CubicCurveTo({338.903, 121.511}, {338.96, 123.303}, {337.336, 124.143});
248 if (closed) {
249 builder.Close();
250 }
251 builder //
252 .MoveTo({340.082, 121.849})
253 .CubicCurveTo({340.074, 121.917}, {340.062, 121.992}, {340.046, 122.075})
254 .CubicCurveTo({340.039, 122.109}, {340.031, 122.142}, {340.023, 122.177})
255 .CubicCurveTo({340.005, 122.26}, {339.98, 122.346}, {339.952, 122.437})
256 .CubicCurveTo({339.941, 122.473}, {339.931, 122.507}, {339.918, 122.544})
257 .CubicCurveTo({339.873, 122.672}, {339.819, 122.804}, {339.75, 122.938})
258 .CubicCurveTo({339.747, 122.944}, {339.743, 122.949}, {339.74, 122.955})
259 .CubicCurveTo({339.674, 123.08}, {339.593, 123.205}, {339.501, 123.328})
260 .CubicCurveTo({339.473, 123.366}, {339.441, 123.401}, {339.41, 123.438})
261 .CubicCurveTo({339.332, 123.534}, {339.243, 123.625}, {339.145, 123.714})
262 .CubicCurveTo({339.105, 123.75}, {339.068, 123.786}, {339.025, 123.821})
263 .CubicCurveTo({338.881, 123.937}, {338.724, 124.048}, {338.539, 124.143})
264 .CubicCurveTo({338.532, 123.959}, {338.554, 123.79}, {338.58, 123.626})
265 .CubicCurveTo({338.58, 123.625}, {338.58, 123.625}, {338.58, 123.625})
266 .CubicCurveTo({338.607, 123.455}, {338.65, 123.299}, {338.704, 123.151})
267 .CubicCurveTo({338.708, 123.14}, {338.71, 123.127}, {338.714, 123.117})
268 .CubicCurveTo({338.769, 122.971}, {338.833, 122.838}, {338.905, 122.712})
269 .CubicCurveTo({338.911, 122.702}, {338.916, 122.69200000000001},
270 {338.922, 122.682})
271 .CubicCurveTo({338.996, 122.557}, {339.072, 122.444}, {339.155, 122.34})
272 .CubicCurveTo({339.161, 122.333}, {339.166, 122.326}, {339.172, 122.319})
273 .CubicCurveTo({339.256, 122.215}, {339.339, 122.12}, {339.425, 122.037})
274 .CubicCurveTo({339.428, 122.033}, {339.431, 122.03}, {339.435, 122.027})
275 .CubicCurveTo({339.785, 121.687}, {340.106, 121.511}, {340.106, 121.511})
276 .CubicCurveTo({340.106, 121.511}, {340.107, 121.645}, {340.082, 121.849});
277 if (closed) {
278 builder.Close();
279 }
280 builder //
281 .MoveTo({340.678, 113.245})
282 .CubicCurveTo({340.594, 113.488}, {340.356, 113.655}, {340.135, 113.775})
283 .CubicCurveTo({339.817, 113.948}, {339.465, 114.059}, {339.115, 114.151})
284 .CubicCurveTo({338.251, 114.379}, {337.34, 114.516}, {336.448, 114.516})
285 .CubicCurveTo({335.761, 114.516}, {335.072, 114.527}, {334.384, 114.513})
286 .CubicCurveTo({334.125, 114.508}, {333.862, 114.462}, {333.605, 114.424})
287 .CubicCurveTo({332.865, 114.318}, {332.096, 114.184}, {331.41, 113.883})
288 .CubicCurveTo({330.979, 113.695}, {330.442, 113.34}, {330.672, 112.813})
289 .CubicCurveTo({331.135, 111.755}, {333.219, 112.946}, {334.526, 113.833})
290 .CubicCurveTo({334.54, 113.816}, {334.554, 113.8}, {334.569, 113.784})
291 .CubicCurveTo({333.38, 112.708}, {331.749, 110.985}, {332.76, 110.402})
292 .CubicCurveTo({333.769, 109.82}, {334.713, 111.93}, {335.228, 113.395})
293 .CubicCurveTo({334.915, 111.889}, {334.59, 109.636}, {335.661, 109.592})
294 .CubicCurveTo({336.733, 109.636}, {336.408, 111.889}, {336.07, 113.389})
295 .CubicCurveTo({336.609, 111.93}, {337.553, 109.82}, {338.563, 110.402})
296 .CubicCurveTo({339.574, 110.984}, {337.942, 112.708}, {336.753, 113.784})
297 .CubicCurveTo({336.768, 113.8}, {336.782, 113.816}, {336.796, 113.833})
298 .CubicCurveTo({338.104, 112.946}, {340.187, 111.755}, {340.65, 112.813})
299 .CubicCurveTo({340.71, 112.95}, {340.728, 113.102}, {340.678, 113.245});
300 if (closed) {
301 builder.Close();
302 }
303 builder //
304 .MoveTo({346.357, 106.771})
305 .CubicCurveTo({346.295, 104.987}, {347.924, 104.139}, {347.924, 104.139})
306 .CubicCurveTo({347.924, 104.139}, {347.982, 105.931}, {346.357, 106.771});
307 if (closed) {
308 builder.Close();
309 }
310 builder //
311 .MoveTo({347.56, 106.771})
312 .CubicCurveTo({347.498, 104.987}, {349.127, 104.139}, {349.127, 104.139})
313 .CubicCurveTo({349.127, 104.139}, {349.185, 105.931}, {347.56, 106.771});
314 if (closed) {
315 builder.Close();
316 }
317 return builder.TakePath();
318}
319
320Path CreateQuadratic(bool closed) {
321 auto builder = PathBuilder{};
322 builder //
323 .MoveTo({359.934, 96.6335})
324 .QuadraticCurveTo({358.189, 96.7055}, {354.673, 96.8895})
325 .QuadraticCurveTo({354.571, 96.8953}, {354.367, 96.9075})
326 .QuadraticCurveTo({352.672, 97.0038}, {349.259, 97.2355})
327 .QuadraticCurveTo({349.048, 97.2506}, {348.625, 97.2834})
328 .QuadraticCurveTo({347.019, 97.4014}, {343.789, 97.6722})
329 .QuadraticCurveTo({343.428, 97.704}, {342.703, 97.7734})
330 .QuadraticCurveTo({341.221, 97.9086}, {338.246, 98.207})
331 .QuadraticCurveTo({337.702, 98.2642}, {336.612, 98.3894})
332 .QuadraticCurveTo({335.284, 98.5356}, {332.623, 98.8476})
333 .QuadraticCurveTo({332.495, 98.8635}, {332.237, 98.8982})
334 .LineTo({332.237, 102.601})
335 .LineTo({321.778, 102.601})
336 .LineTo({321.778, 100.382})
337 .QuadraticCurveTo({321.572, 100.413}, {321.161, 100.476})
338 .QuadraticCurveTo({319.22, 100.79}, {315.332, 101.479})
339 .QuadraticCurveTo({315.322, 101.481}, {315.301, 101.484})
340 .LineTo({310.017, 105.94})
341 .LineTo({309.779, 105.427})
342 .LineTo({314.403, 101.651})
343 .QuadraticCurveTo({314.391, 101.653}, {314.368, 101.658})
344 .QuadraticCurveTo({312.528, 102.001}, {308.846, 102.748})
345 .QuadraticCurveTo({307.85, 102.955}, {305.859, 103.4})
346 .QuadraticCurveTo({305.048, 103.579}, {303.425, 103.936})
347 .LineTo({299.105, 107.578})
348 .LineTo({298.867, 107.065})
349 .LineTo({302.394, 104.185})
350 .LineTo({302.412, 104.171})
351 .QuadraticCurveTo({301.388, 104.409}, {299.344, 104.921})
352 .QuadraticCurveTo({298.618, 105.1}, {297.165, 105.455})
353 .QuadraticCurveTo({295.262, 105.94}, {291.462, 106.979})
354 .QuadraticCurveTo({291.132, 107.072}, {290.471, 107.257})
355 .QuadraticCurveTo({289.463, 107.544}, {287.449, 108.139})
356 .QuadraticCurveTo({286.476, 108.431}, {284.536, 109.035})
357 .QuadraticCurveTo({283.674, 109.304}, {281.952, 109.859})
358 .QuadraticCurveTo({281.177, 110.112}, {279.633, 110.638})
359 .QuadraticCurveTo({278.458, 111.037}, {276.803, 111.607})
360 .QuadraticCurveTo({276.76, 111.622}, {276.672, 111.653})
361 .QuadraticCurveTo({275.017, 112.239}, {271.721, 113.463})
362 .LineTo({271.717, 113.449})
363 .QuadraticCurveTo({271.496, 113.496}, {270.963, 113.628})
364 .QuadraticCurveTo({270.893, 113.645}, {270.748, 113.682})
365 .QuadraticCurveTo({270.468, 113.755}, {269.839, 113.926})
366 .QuadraticCurveTo({269.789, 113.94}, {269.681, 113.972})
367 .QuadraticCurveTo({269.391, 114.053}, {268.756, 114.239})
368 .QuadraticCurveTo({268.628, 114.276}, {268.367, 114.354})
369 .QuadraticCurveTo({268.172, 114.412}, {267.752, 114.54})
370 .QuadraticCurveTo({263.349, 115.964}, {253.564, 119.252})
371 .QuadraticCurveTo({253.556, 119.255}, {253.538, 119.261})
372 .QuadraticCurveTo({251.844, 119.849}, {248.189, 121.131})
373 .QuadraticCurveTo({248, 121.197}, {247.621, 121.331})
374 .QuadraticCurveTo({247.079, 121.522}, {245.975, 121.912})
375 .QuadraticCurveTo({245.554, 122.06}, {244.698, 122.364})
376 .QuadraticCurveTo({244.071, 122.586}, {242.794, 123.04})
377 .QuadraticCurveTo({242.189, 123.255}, {240.961, 123.693})
378 .QuadraticCurveTo({240.659, 123.801}, {240.052, 124.018})
379 .QuadraticCurveTo({239.12, 124.351}, {237.22, 125.032})
380 .LineTo({237.164, 125.003})
381 .QuadraticCurveTo({236.709, 125.184}, {235.81, 125.538})
382 .QuadraticCurveTo({235.413, 125.68}, {234.592, 125.977})
383 .QuadraticCurveTo({234.592, 125.977}, {234.59, 125.977})
384 .QuadraticCurveTo({222.206, 130.435}, {192.381, 141.429})
385 .QuadraticCurveTo({162.77, 151.336}, {84.1123, 160})
386 .LineTo({360, 160})
387 .LineTo({360, 119.256})
388 .LineTo({360, 106.332})
389 .LineTo({360, 96.6307})
390 .QuadraticCurveTo({359.978, 96.6317}, {359.934, 96.6335});
391 if (closed) {
392 builder.Close();
393 }
394 builder //
395 .MoveTo({337.336, 124.143})
396 .QuadraticCurveTo({337.274, 122.359}, {338.903, 121.511})
397 .QuadraticCurveTo({338.903, 121.511}, {337.336, 124.143});
398 if (closed) {
399 builder.Close();
400 }
401 builder //
402 .MoveTo({340.082, 121.849})
403 .QuadraticCurveTo({340.074, 121.917}, {340.046, 122.075})
404 .QuadraticCurveTo({340.039, 122.109}, {340.023, 122.177})
405 .QuadraticCurveTo({340.005, 122.26}, {339.952, 122.437})
406 .QuadraticCurveTo({339.941, 122.473}, {339.918, 122.544})
407 .QuadraticCurveTo({339.873, 122.672}, {339.75, 122.938})
408 .QuadraticCurveTo({339.747, 122.944}, {339.74, 122.955})
409 .QuadraticCurveTo({339.674, 123.08}, {339.501, 123.328})
410 .QuadraticCurveTo({339.473, 123.366}, {339.41, 123.438})
411 .QuadraticCurveTo({339.332, 123.534}, {339.145, 123.714})
412 .QuadraticCurveTo({339.105, 123.75}, {339.025, 123.821})
413 .QuadraticCurveTo({338.881, 123.937}, {338.539, 124.143})
414 .QuadraticCurveTo({338.532, 123.959}, {338.58, 123.626})
415 .QuadraticCurveTo({338.58, 123.625}, {338.58, 123.625})
416 .QuadraticCurveTo({338.607, 123.455}, {338.704, 123.151})
417 .QuadraticCurveTo({338.708, 123.14}, {338.714, 123.117})
418 .QuadraticCurveTo({338.769, 122.971}, {338.905, 122.712})
419 .QuadraticCurveTo({338.911, 122.702}, {338.922, 122.682})
420 .QuadraticCurveTo({338.996, 122.557}, {339.155, 122.34})
421 .QuadraticCurveTo({339.161, 122.333}, {339.172, 122.319})
422 .QuadraticCurveTo({339.256, 122.215}, {339.425, 122.037})
423 .QuadraticCurveTo({339.428, 122.033}, {339.435, 122.027})
424 .QuadraticCurveTo({339.785, 121.687}, {340.106, 121.511})
425 .QuadraticCurveTo({340.106, 121.511}, {340.082, 121.849});
426 if (closed) {
427 builder.Close();
428 }
429 builder //
430 .MoveTo({340.678, 113.245})
431 .QuadraticCurveTo({340.594, 113.488}, {340.135, 113.775})
432 .QuadraticCurveTo({339.817, 113.948}, {339.115, 114.151})
433 .QuadraticCurveTo({338.251, 114.379}, {336.448, 114.516})
434 .QuadraticCurveTo({335.761, 114.516}, {334.384, 114.513})
435 .QuadraticCurveTo({334.125, 114.508}, {333.605, 114.424})
436 .QuadraticCurveTo({332.865, 114.318}, {331.41, 113.883})
437 .QuadraticCurveTo({330.979, 113.695}, {330.672, 112.813})
438 .QuadraticCurveTo({331.135, 111.755}, {334.526, 113.833})
439 .QuadraticCurveTo({334.54, 113.816}, {334.569, 113.784})
440 .QuadraticCurveTo({333.38, 112.708}, {332.76, 110.402})
441 .QuadraticCurveTo({333.769, 109.82}, {335.228, 113.395})
442 .QuadraticCurveTo({334.915, 111.889}, {335.661, 109.592})
443 .QuadraticCurveTo({336.733, 109.636}, {336.07, 113.389})
444 .QuadraticCurveTo({336.609, 111.93}, {338.563, 110.402})
445 .QuadraticCurveTo({339.574, 110.984}, {336.753, 113.784})
446 .QuadraticCurveTo({336.768, 113.8}, {336.796, 113.833})
447 .QuadraticCurveTo({338.104, 112.946}, {340.65, 112.813})
448 .QuadraticCurveTo({340.71, 112.95}, {340.678, 113.245});
449 if (closed) {
450 builder.Close();
451 }
452 builder //
453 .MoveTo({346.357, 106.771})
454 .QuadraticCurveTo({346.295, 104.987}, {347.924, 104.139})
455 .QuadraticCurveTo({347.924, 104.139}, {346.357, 106.771});
456 if (closed) {
457 builder.Close();
458 }
459 builder //
460 .MoveTo({347.56, 106.771})
461 .QuadraticCurveTo({347.498, 104.987}, {349.127, 104.139})
462 .QuadraticCurveTo({349.127, 104.139}, {347.56, 106.771});
463 if (closed) {
464 builder.Close();
465 }
466 return builder.TakePath();
467}
468
469} // namespace
470} // namespace impeller
static const int points[]
static std::vector< SolidFillVertexShader::PerVertexData > GenerateSolidStrokeVertices(const Path::Polyline &polyline, Scalar stroke_width, Scalar miter_limit, Join stroke_join, Cap stroke_cap, Scalar scale)
Path TakePath(FillType fill=FillType::kNonZero)
PathBuilder & AddRoundedRect(Rect rect, RoundingRadii radii)
Paths are lightweight objects that describe a collection of linear, quadratic, or cubic segments....
Definition path.h:51
An extended tessellator that offers arbitrary/concave tessellation via the libtess2 library.
Tessellator::Result Tessellate(const Path &path, Scalar tolerance, const BuilderCallback &callback)
Generates filled triangles from the path. A callback is invoked once for the entire tessellation.
std::vector< Point > TessellateConvex(const Path &path, Scalar tolerance)
Given a convex path, create a triangle fan structure.
AtkStateType state
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
#define MAKE_STROKE_BENCHMARK_CAPTURE(path, cap, join, closed, uvname, uvtype)
CanvasPath Path
Definition dart_ui.cc:58
float Scalar
Definition scalar.h:18
static TessellatorLibtess tess
static void BM_Convex(benchmark::State &state, Args &&... args)
BENCHMARK_CAPTURE(BM_CanvasRecord, draw_rect, &DrawRect)
void LineTo(PathBuilder *builder, Scalar x, Scalar y)
static void BM_Polyline(benchmark::State &state, Args &&... args)
static void BM_StrokePolyline(benchmark::State &state, Args &&... args)
const Scalar stroke_width
const Scalar scale
const Path::Polyline & polyline
std::unique_ptr< std::vector< Point > > PointBufferPtr
Definition path.h:97
PointBufferPtr points
Definition path.h:109
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
Definition rect.h:129