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