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