@@ -59,39 +59,22 @@ template <class... Args>
5959static void BM_Polyline (benchmark::State& state, Args&&... args) {
6060 auto args_tuple = std::make_tuple (std::move (args)...);
6161 auto path = std::get<Path>(args_tuple);
62- bool tessellate = std::get<bool >(args_tuple);
6362
6463 size_t point_count = 0u ;
6564 size_t single_point_count = 0u ;
6665 auto points = std::make_unique<std::vector<Point>>();
6766 points->reserve (2048 );
6867 while (state.KeepRunning ()) {
69- if (tessellate) {
70- tess.Tessellate (path, 1 .0f ,
71- [&point_count, &single_point_count](
72- const float * vertices, size_t vertices_count,
73- const uint16_t * indices, size_t indices_count) {
74- if (indices_count > 0 ) {
75- single_point_count = indices_count;
76- point_count += indices_count;
77- } else {
78- single_point_count = vertices_count;
79- point_count += vertices_count;
80- }
81- return true ;
82- });
83- } else {
84- auto polyline = path.CreatePolyline (
85- // Clang-tidy doesn't know that the points get moved back before
86- // getting moved again in this loop.
87- // NOLINTNEXTLINE(clang-analyzer-cplusplus.Move)
88- 1 .0f , std::move (points),
89- [&points](Path::Polyline::PointBufferPtr reclaimed) {
90- points = std::move (reclaimed);
91- });
92- single_point_count = polyline.points ->size ();
93- point_count += single_point_count;
94- }
68+ auto polyline = path.CreatePolyline (
69+ // Clang-tidy doesn't know that the points get moved back before
70+ // getting moved again in this loop.
71+ // NOLINTNEXTLINE(clang-analyzer-cplusplus.Move)
72+ 1 .0f , std::move (points),
73+ [&points](Path::Polyline::PointBufferPtr reclaimed) {
74+ points = std::move (reclaimed);
75+ });
76+ single_point_count = polyline.points ->size ();
77+ point_count += single_point_count;
9578 }
9679 state.counters [" SinglePointCount" ] = single_point_count;
9780 state.counters [" TotalPointCount" ] = point_count;
@@ -155,11 +138,13 @@ static void BM_Convex(benchmark::State& state, Args&&... args) {
155138 size_t point_count = 0u ;
156139 size_t single_point_count = 0u ;
157140 auto points = std::make_unique<std::vector<Point>>();
141+ auto indices = std::make_unique<std::vector<uint16_t >>();
158142 points->reserve (2048 );
143+ indices->reserve (2048 );
159144 while (state.KeepRunning ()) {
160- auto points = tess.TessellateConvex (path, 1 .0f );
161- single_point_count = points. size ();
162- point_count += points. size ();
145+ tess.TessellateConvexInternal (path, *points, *indices , 1 .0f );
146+ single_point_count = indices-> size ();
147+ point_count += indices-> size ();
163148 }
164149 state.counters [" SinglePointCount" ] = single_point_count;
165150 state.counters [" TotalPointCount" ] = point_count;
@@ -182,27 +167,17 @@ static void BM_Convex(benchmark::State& state, Args&&... args) {
182167 MAKE_STROKE_BENCHMARK_CAPTURE_CAPS_JOINS (path, _uvNoTx, UVMode::kUVRect )
183168
184169BENCHMARK_CAPTURE (BM_Polyline, cubic_polyline, CreateCubic(true ), false );
185- BENCHMARK_CAPTURE (BM_Polyline, cubic_polyline_tess, CreateCubic(true ), true );
186170BENCHMARK_CAPTURE (BM_Polyline,
187171 unclosed_cubic_polyline,
188172 CreateCubic (false ),
189173 false);
190- BENCHMARK_CAPTURE (BM_Polyline,
191- unclosed_cubic_polyline_tess,
192- CreateCubic (false ),
193- true);
194174MAKE_STROKE_BENCHMARK_CAPTURE_UVS (Cubic);
195175
196176BENCHMARK_CAPTURE (BM_Polyline, quad_polyline, CreateQuadratic(true ), false);
197- BENCHMARK_CAPTURE (BM_Polyline, quad_polyline_tess, CreateQuadratic(true ), true);
198177BENCHMARK_CAPTURE (BM_Polyline,
199178 unclosed_quad_polyline,
200179 CreateQuadratic (false ),
201180 false);
202- BENCHMARK_CAPTURE (BM_Polyline,
203- unclosed_quad_polyline_tess,
204- CreateQuadratic (false ),
205- true);
206181MAKE_STROKE_BENCHMARK_CAPTURE_UVS (Quadratic);
207182
208183BENCHMARK_CAPTURE (BM_Convex, rrect_convex, CreateRRect(), true);
0 commit comments