Flutter Engine
 
Loading...
Searching...
No Matches
dl_path_builder_unittests.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
7#include "gtest/gtest.h"
8
10
11namespace {
12using ::testing::Return;
13} // namespace
14
15namespace flutter {
16namespace testing {
17
18TEST(DisplayListPathBuilder, DefaultConstructor) {
19 DlPathBuilder builder;
20 DlPath path = builder.TakePath();
21
22 EXPECT_TRUE(path.IsEmpty());
23 EXPECT_TRUE(path.GetBounds().IsEmpty());
24 EXPECT_EQ(path, DlPath());
25 EXPECT_EQ(path.GetFillType(), DlPathFillType::kNonZero);
26}
27
28TEST(DisplayListPathBuilder, SetFillType) {
29 DlPathBuilder builder;
30 builder.SetFillType(DlPathFillType::kOdd);
31 DlPath path = builder.TakePath();
32
33 EXPECT_EQ(path.GetFillType(), DlPathFillType::kOdd);
34}
35
36TEST(DisplayListPathBuilder, CopyPathDoesNotResetPath) {
37 DlPathBuilder builder;
38 builder.SetFillType(DlPathFillType::kOdd);
39 builder.MoveTo(DlPoint(10, 10));
40 builder.LineTo(DlPoint(20, 10));
41 builder.QuadraticCurveTo(DlPoint(20, 20), DlPoint(10, 20));
42 DlPath before_path = builder.CopyPath();
43
44 EXPECT_FALSE(before_path.IsEmpty());
45 EXPECT_EQ(before_path.GetBounds(), DlRect::MakeLTRB(10, 10, 20, 20));
46 EXPECT_NE(before_path, DlPath());
47 EXPECT_EQ(before_path.GetFillType(), DlPathFillType::kOdd);
48
49 DlPath after_path = builder.TakePath();
50
51 EXPECT_FALSE(after_path.IsEmpty());
52 EXPECT_EQ(after_path.GetBounds(), DlRect::MakeLTRB(10, 10, 20, 20));
53 EXPECT_NE(after_path, DlPath());
54 EXPECT_EQ(after_path, before_path);
55 EXPECT_EQ(after_path.GetFillType(), DlPathFillType::kOdd);
56}
57
58TEST(DisplayListPathBuilder, TakePathResetsPath) {
59 DlPathBuilder builder;
60 builder.SetFillType(DlPathFillType::kOdd);
61 builder.MoveTo(DlPoint(10, 10));
62 builder.LineTo(DlPoint(20, 10));
63 builder.QuadraticCurveTo(DlPoint(20, 20), DlPoint(10, 20));
64 DlPath before_path = builder.TakePath();
65
66 EXPECT_FALSE(before_path.IsEmpty());
67 EXPECT_EQ(before_path.GetBounds(), DlRect::MakeLTRB(10, 10, 20, 20));
68 EXPECT_NE(before_path, DlPath());
69 EXPECT_EQ(before_path.GetFillType(), DlPathFillType::kOdd);
70
71 DlPath after_path = builder.TakePath();
72
73 EXPECT_TRUE(after_path.IsEmpty());
74 EXPECT_TRUE(after_path.GetBounds().IsEmpty());
75 EXPECT_EQ(after_path, DlPath());
76 EXPECT_EQ(after_path.GetFillType(), DlPathFillType::kNonZero);
77}
78
79TEST(DisplayListPathBuilder, LineToInsertsMoveTo) {
80 DlPathBuilder builder;
81 builder.LineTo(DlPoint(10, 10));
82 DlPath path = builder.TakePath();
83
84 ::testing::StrictMock<DlPathReceiverMock> mock_receiver;
85
86 {
87 ::testing::InSequence sequence;
88
89 EXPECT_CALL(mock_receiver, MoveTo(DlPoint(0, 0), false));
90 EXPECT_CALL(mock_receiver, LineTo(DlPoint(10, 10)));
91 }
92
93 path.Dispatch(mock_receiver);
94}
95
96TEST(DisplayListPathBuilder, QuadToInsertsMoveTo) {
97 DlPathBuilder builder;
98 builder.QuadraticCurveTo(DlPoint(10, 10), DlPoint(10, 0));
99 DlPath path = builder.TakePath();
100
101 ::testing::StrictMock<DlPathReceiverMock> mock_receiver;
102
103 {
104 ::testing::InSequence sequence;
105
106 EXPECT_CALL(mock_receiver, MoveTo(DlPoint(0, 0), false));
107 EXPECT_CALL(mock_receiver, QuadTo(DlPoint(10, 10), DlPoint(10, 0)));
108 }
109
110 path.Dispatch(mock_receiver);
111}
112
113TEST(DisplayListPathBuilder, ConicToInsertsMoveTo) {
114 DlPathBuilder builder;
115 builder.ConicCurveTo(DlPoint(10, 10), DlPoint(10, 0), 0.5f);
116 DlPath path = builder.TakePath();
117
118 ::testing::StrictMock<DlPathReceiverMock> mock_receiver;
119
120 {
121 ::testing::InSequence sequence;
122
123 EXPECT_CALL(mock_receiver, MoveTo(DlPoint(0, 0), false));
124 EXPECT_CALL(mock_receiver, ConicTo(DlPoint(10, 10), DlPoint(10, 0), 0.5f))
125 .WillOnce(Return(true));
126 }
127
128 path.Dispatch(mock_receiver);
129}
130
131TEST(DisplayListPathBuilder, CubicToInsertsMoveTo) {
132 DlPathBuilder builder;
133 builder.CubicCurveTo(DlPoint(10, 10), DlPoint(10, 0), DlPoint(0, 10));
134 DlPath path = builder.TakePath();
135
136 ::testing::StrictMock<DlPathReceiverMock> mock_receiver;
137
138 {
139 ::testing::InSequence sequence;
140
141 EXPECT_CALL(mock_receiver, MoveTo(DlPoint(0, 0), false));
142 EXPECT_CALL(mock_receiver,
143 CubicTo(DlPoint(10, 10), DlPoint(10, 0), DlPoint(0, 10)));
144 }
145
146 path.Dispatch(mock_receiver);
147}
148
149TEST(DisplayListPathBuilder, ConicWithNonPositiveWeightsInsertLineTo) {
150 DlPathBuilder builder;
151 builder.MoveTo(DlPoint(10, 10));
152 builder.ConicCurveTo(DlPoint(20, 10), DlPoint(10, 20), -1.0f);
153 builder.ConicCurveTo(DlPoint(20, 20), DlPoint(10, 30), 0.0f);
154 builder.ConicCurveTo(DlPoint(20, 30), DlPoint(10, 40),
155 std::numeric_limits<DlScalar>::quiet_NaN());
156 DlPath path = builder.TakePath();
157
158 ::testing::StrictMock<DlPathReceiverMock> mock_receiver;
159
160 {
161 ::testing::InSequence sequence;
162
163 EXPECT_CALL(mock_receiver, MoveTo(DlPoint(10, 10), false));
164 EXPECT_CALL(mock_receiver, LineTo(DlPoint(10, 20)));
165 EXPECT_CALL(mock_receiver, LineTo(DlPoint(10, 30)));
166 EXPECT_CALL(mock_receiver, LineTo(DlPoint(10, 40)));
167 }
168
169 path.Dispatch(mock_receiver);
170}
171
172TEST(DisplayListPathBuilder, ConicWithWeight1InsertsQuadTo) {
173 DlPathBuilder builder;
174 builder.MoveTo(DlPoint(10, 10));
175 builder.ConicCurveTo(DlPoint(20, 10), DlPoint(10, 20), 1.0f);
176 DlPath path = builder.TakePath();
177
178 ::testing::StrictMock<DlPathReceiverMock> mock_receiver;
179
180 {
181 ::testing::InSequence sequence;
182
183 EXPECT_CALL(mock_receiver, MoveTo(DlPoint(10, 10), false));
184 EXPECT_CALL(mock_receiver, QuadTo(DlPoint(20, 10), DlPoint(10, 20)));
185 }
186
187 path.Dispatch(mock_receiver);
188}
189
190TEST(DisplayListPathBuilder, AddRect) {
191 auto path = DlPathBuilder{} //
192 .AddRect(DlRect::MakeLTRB(10, 10, 20, 20))
193 .TakePath();
194
195 ::testing::StrictMock<DlPathReceiverMock> mock_receiver;
196
197 {
198 ::testing::InSequence sequence;
199
200 EXPECT_CALL(mock_receiver, MoveTo(DlPoint(10, 10), true));
201 EXPECT_CALL(mock_receiver, LineTo(DlPoint(20, 10)));
202 EXPECT_CALL(mock_receiver, LineTo(DlPoint(20, 20)));
203 EXPECT_CALL(mock_receiver, LineTo(DlPoint(10, 20)));
204 EXPECT_CALL(mock_receiver, LineTo(DlPoint(10, 10)));
205 EXPECT_CALL(mock_receiver, Close());
206 }
207
208 path.Dispatch(mock_receiver);
209}
210
211TEST(DisplayListPathBuilder, AddOval) {
212 auto path = DlPathBuilder{} //
213 .AddOval(DlRect::MakeLTRB(10, 10, 30, 20))
214 .TakePath();
215
216 ::testing::StrictMock<DlPathReceiverMock> mock_receiver;
217
218 {
219 ::testing::InSequence sequence;
220
221 auto wt = impeller::kSqrt2Over2;
222 EXPECT_CALL(mock_receiver, MoveTo(DlPoint(30, 15), true));
223 EXPECT_CALL(mock_receiver, ConicTo(DlPoint(30, 20), DlPoint(20, 20), wt))
224 .WillOnce(Return(true));
225 EXPECT_CALL(mock_receiver, ConicTo(DlPoint(10, 20), DlPoint(10, 15), wt))
226 .WillOnce(Return(true));
227 EXPECT_CALL(mock_receiver, ConicTo(DlPoint(10, 10), DlPoint(20, 10), wt))
228 .WillOnce(Return(true));
229 EXPECT_CALL(mock_receiver, ConicTo(DlPoint(30, 10), DlPoint(30, 15), wt))
230 .WillOnce(Return(true));
231 EXPECT_CALL(mock_receiver, Close());
232 }
233
234 path.Dispatch(mock_receiver);
235}
236
237TEST(DisplayListPathBuilder, AddCircle) {
238 auto path = DlPathBuilder{} //
239 .AddCircle(DlPoint(15, 15), 5)
240 .TakePath();
241
242 ::testing::StrictMock<DlPathReceiverMock> mock_receiver;
243
244 {
245 ::testing::InSequence sequence;
246
247 auto wt = impeller::kSqrt2Over2;
248 EXPECT_CALL(mock_receiver, MoveTo(DlPoint(20, 15), true));
249 EXPECT_CALL(mock_receiver, ConicTo(DlPoint(20, 20), DlPoint(15, 20), wt))
250 .WillOnce(Return(true));
251 EXPECT_CALL(mock_receiver, ConicTo(DlPoint(10, 20), DlPoint(10, 15), wt))
252 .WillOnce(Return(true));
253 EXPECT_CALL(mock_receiver, ConicTo(DlPoint(10, 10), DlPoint(15, 10), wt))
254 .WillOnce(Return(true));
255 EXPECT_CALL(mock_receiver, ConicTo(DlPoint(20, 10), DlPoint(20, 15), wt))
256 .WillOnce(Return(true));
257 EXPECT_CALL(mock_receiver, Close());
258 }
259
260 path.Dispatch(mock_receiver);
261}
262
263TEST(DisplayListPathBuilder, AddRoundRect) {
264 auto bounds = DlRect::MakeLTRB(10, 10, 100, 100);
265 auto radii = DlRoundingRadii{
266 .top_left = DlSize(2, 12),
267 .top_right = DlSize(3, 13),
268 .bottom_left = DlSize(4, 14),
269 .bottom_right = DlSize(5, 15),
270 };
271 auto path = DlPathBuilder{} //
273 .TakePath();
274
275 ::testing::StrictMock<DlPathReceiverMock> mock_receiver;
276
277 {
278 ::testing::InSequence sequence;
279
280 auto wt = impeller::kSqrt2Over2;
281 EXPECT_CALL(mock_receiver, MoveTo(DlPoint(10, 86), true));
282 EXPECT_CALL(mock_receiver, LineTo(DlPoint(10, 22)));
283 EXPECT_CALL(mock_receiver, ConicTo(DlPoint(10, 10), DlPoint(12, 10), wt))
284 .WillOnce(Return(true));
285 EXPECT_CALL(mock_receiver, LineTo(DlPoint(97, 10)));
286 EXPECT_CALL(mock_receiver, ConicTo(DlPoint(100, 10), DlPoint(100, 23), wt))
287 .WillOnce(Return(true));
288 EXPECT_CALL(mock_receiver, LineTo(DlPoint(100, 85)));
289 EXPECT_CALL(mock_receiver, ConicTo(DlPoint(100, 100), DlPoint(95, 100), wt))
290 .WillOnce(Return(true));
291 EXPECT_CALL(mock_receiver, LineTo(DlPoint(14, 100)));
292 EXPECT_CALL(mock_receiver, ConicTo(DlPoint(10, 100), DlPoint(10, 86), wt))
293 .WillOnce(Return(true));
294 EXPECT_CALL(mock_receiver, Close());
295 }
296
297 path.Dispatch(mock_receiver);
298}
299
300TEST(DisplayListPathBuilder, AddRoundSuperellipse) {
301 auto bounds = DlRect::MakeLTRB(10, 10, 100, 100);
302 auto radii = DlRoundingRadii{
303 .top_left = DlSize(2, 12),
304 .top_right = DlSize(3, 13),
305 .bottom_left = DlSize(4, 14),
306 .bottom_right = DlSize(5, 15),
307 };
308 auto path = DlPathBuilder{} //
311 .TakePath();
312
313 ::testing::StrictMock<DlPathReceiverMock> mock_receiver;
314
315 {
316 ::testing::InSequence sequence;
317
318 EXPECT_CALL(mock_receiver, MoveTo(DlPoint(46, 10), true));
319 EXPECT_CALL(mock_receiver, CubicTo(PointEq(DlPoint(97.3149f, 9.99998f)),
320 PointEq(DlPoint(95.8867f, 9.99486f)),
321 PointEq(DlPoint(97.1856f, 10.2338f))));
322 EXPECT_CALL(mock_receiver, CubicTo(PointEq(DlPoint(97.9096f, 10.367f)),
323 PointEq(DlPoint(98.5976f, 11.6373f)),
324 PointEq(DlPoint(99.1213f, 13.8076f))));
325 EXPECT_CALL(mock_receiver, CubicTo(PointEq(DlPoint(99.5784f, 15.7987f)),
326 PointEq(DlPoint(99.8618f, 18.4156f)),
327 PointEq(DlPoint(99.9232f, 21.2114f))));
328 EXPECT_CALL(mock_receiver, CubicTo(PointEq(DlPoint(100.011f, 25.1954f)),
329 PointEq(DlPoint(100.0f, 29.7897f)),
330 PointEq(DlPoint(100.0f, 51.7857f))));
331 EXPECT_CALL(mock_receiver, CubicTo(PointEq(DlPoint(100.0f, 77.1657f)),
332 PointEq(DlPoint(100.018f, 82.4668f)),
333 PointEq(DlPoint(99.872f, 87.0638f))));
334 EXPECT_CALL(mock_receiver, CubicTo(PointEq(DlPoint(99.7697f, 90.2897f)),
335 PointEq(DlPoint(99.2973f, 93.3092f)),
336 PointEq(DlPoint(98.5355f, 95.6066f))));
337 EXPECT_CALL(mock_receiver, CubicTo(PointEq(DlPoint(97.6834f, 98.0734f)),
338 PointEq(DlPoint(96.5625f, 99.532f)),
339 PointEq(DlPoint(95.3799f, 99.7131f))));
340 EXPECT_CALL(mock_receiver, CubicTo(PointEq(DlPoint(93.4105f, 100.015f)),
341 PointEq(DlPoint(93.4217f, 100.0f)),
342 PointEq(DlPoint(50.0f, 100.0f))));
343 EXPECT_CALL(mock_receiver, CubicTo(PointEq(DlPoint(15.2626f, 100.0f)),
344 PointEq(DlPoint(15.2716f, 100.014f)),
345 PointEq(DlPoint(13.6961f, 99.7323f))));
346 EXPECT_CALL(mock_receiver, CubicTo(PointEq(DlPoint(12.75f, 99.5632f)),
347 PointEq(DlPoint(11.8533f, 98.2018f)),
348 PointEq(DlPoint(11.1716f, 95.8995f))));
349 EXPECT_CALL(mock_receiver, CubicTo(PointEq(DlPoint(10.5569f, 93.7323f)),
350 PointEq(DlPoint(10.1777f, 90.8822f)),
351 PointEq(DlPoint(10.0993f, 87.8409f))));
352 EXPECT_CALL(mock_receiver, CubicTo(PointEq(DlPoint(9.98623f, 83.4541f)),
353 PointEq(DlPoint(10.0f, 78.5304f)),
354 PointEq(DlPoint(10.0f, 51.5385f))));
355 EXPECT_CALL(mock_receiver, CubicTo(PointEq(DlPoint(10.0f, 28.4025f)),
356 PointEq(DlPoint(9.99311f, 24.1822f)),
357 PointEq(DlPoint(10.0496f, 20.4221f))));
358 EXPECT_CALL(mock_receiver, CubicTo(PointEq(DlPoint(10.0888f, 17.8153f)),
359 PointEq(DlPoint(10.2785f, 15.3723f)),
360 PointEq(DlPoint(10.5858f, 13.5147f))));
361 EXPECT_CALL(mock_receiver, CubicTo(PointEq(DlPoint(10.9349f, 11.5114f)),
362 PointEq(DlPoint(11.3936f, 10.3388f)),
363 PointEq(DlPoint(11.8762f, 10.2158f))));
364 EXPECT_CALL(mock_receiver, CubicTo(PointEq(DlPoint(12.7422f, 9.99527f)),
365 PointEq(DlPoint(11.79f, 10.0f)),
366 PointEq(DlPoint(46.0f, 10.0f))));
367 EXPECT_CALL(mock_receiver, LineTo(DlPoint(46, 10)));
368 EXPECT_CALL(mock_receiver, Close());
369 }
370
371 path.Dispatch(mock_receiver);
372}
373
374TEST(DisplayListPathBuilder, AddArcNoCenter) {
375 auto path = DlPathBuilder{}
376 .AddArc(DlRect::MakeLTRB(10, 10, 30, 20), //
377 DlDegrees(90), DlDegrees(90), false)
378 .TakePath();
379
380 ::testing::StrictMock<DlPathReceiverMock> mock_receiver;
381
382 {
383 ::testing::InSequence sequence;
384
385 auto wt = impeller::kSqrt2Over2;
386 EXPECT_CALL(mock_receiver, MoveTo(DlPoint(20, 20), false));
387 EXPECT_CALL(mock_receiver, ConicTo(DlPoint(10, 20), DlPoint(10, 15), wt))
388 .WillOnce(Return(true));
389 }
390
391 path.Dispatch(mock_receiver);
392}
393
394TEST(DisplayListPathBuilder, AddArcWithCenter) {
395 auto path = DlPathBuilder{}
396 .AddArc(DlRect::MakeLTRB(10, 10, 30, 20), //
397 DlDegrees(90), DlDegrees(90), true)
398 .TakePath();
399
400 ::testing::StrictMock<DlPathReceiverMock> mock_receiver;
401
402 {
403 ::testing::InSequence sequence;
404
405 auto wt = impeller::kSqrt2Over2;
406 EXPECT_CALL(mock_receiver, MoveTo(DlPoint(20, 15), true));
407 EXPECT_CALL(mock_receiver, LineTo(DlPoint(20, 20)));
408 EXPECT_CALL(mock_receiver, ConicTo(DlPoint(10, 20), DlPoint(10, 15), wt))
409 .WillOnce(Return(true));
410 EXPECT_CALL(mock_receiver, LineTo(DlPoint(20, 15)));
411 EXPECT_CALL(mock_receiver, Close());
412 }
413
414 path.Dispatch(mock_receiver);
415}
416
417TEST(DisplayListPathBuilder, SimpleUnclosedPath) {
418 auto path = DlPathBuilder{}
419 .MoveTo({0, 0})
420 .LineTo({100, 100})
421 .QuadraticCurveTo({200, 200}, {300, 300})
422 .ConicCurveTo({200, 200}, {100, 100}, 0.75f)
423 .CubicCurveTo({300, 300}, {400, 400}, {500, 500})
424 .TakePath();
425
426 ::testing::StrictMock<DlPathReceiverMock> mock_receiver;
427
428 {
429 ::testing::InSequence sequence;
430
431 EXPECT_CALL(mock_receiver, MoveTo(DlPoint(0, 0), false));
432 EXPECT_CALL(mock_receiver, LineTo(DlPoint(100, 100)));
433 EXPECT_CALL(mock_receiver, QuadTo(DlPoint(200, 200), DlPoint(300, 300)));
434 EXPECT_CALL(mock_receiver,
435 ConicTo(DlPoint(200, 200), DlPoint(100, 100), 0.75f))
436 .WillOnce(Return(true));
437 EXPECT_CALL(mock_receiver, CubicTo(DlPoint(300, 300), DlPoint(400, 400),
438 DlPoint(500, 500)));
439 }
440
441 path.Dispatch(mock_receiver);
442}
443
444TEST(DisplayListPathBuilder, SimpleClosedPath) {
445 auto path = DlPathBuilder{}
446 .MoveTo({0, 0})
447 .LineTo({100, 100})
448 .QuadraticCurveTo({200, 200}, {300, 300})
449 .ConicCurveTo({200, 200}, {100, 100}, 0.75f)
450 .CubicCurveTo({300, 300}, {400, 400}, {500, 500})
451 .Close()
452 .TakePath();
453
454 ::testing::StrictMock<DlPathReceiverMock> mock_receiver;
455
456 {
457 ::testing::InSequence sequence;
458
459 EXPECT_CALL(mock_receiver, MoveTo(DlPoint(0, 0), true));
460 EXPECT_CALL(mock_receiver, LineTo(DlPoint(100, 100)));
461 EXPECT_CALL(mock_receiver, QuadTo(DlPoint(200, 200), DlPoint(300, 300)));
462 EXPECT_CALL(mock_receiver,
463 ConicTo(DlPoint(200, 200), DlPoint(100, 100), 0.75f))
464 .WillOnce(Return(true));
465 EXPECT_CALL(mock_receiver, CubicTo(DlPoint(300, 300), DlPoint(400, 400),
466 DlPoint(500, 500)));
467 EXPECT_CALL(mock_receiver, LineTo(DlPoint(0, 0)));
468 EXPECT_CALL(mock_receiver, Close());
469 }
470
471 path.Dispatch(mock_receiver);
472}
473
474TEST(DisplayListPathBuilder, EvenOddAppendNonZeroStaysEvenOdd) {
475 auto even_odd_path_builder = DlPathBuilder{}
476 .SetFillType(DlPathFillType::kOdd)
477 .MoveTo({0, 0})
478 .LineTo({100, 0})
479 .LineTo({0, 100})
480 .Close();
481 auto non_zero_path_builder = DlPathBuilder{}
482 .SetFillType(DlPathFillType::kNonZero)
483 .MoveTo({200, 200})
484 .LineTo({300, 200})
485 .LineTo({200, 300})
486 .Close();
487
488 even_odd_path_builder.AddPath(non_zero_path_builder.TakePath());
489 auto path = even_odd_path_builder.TakePath();
490
491 EXPECT_EQ(path.GetFillType(), DlPathFillType::kOdd);
492}
493
494TEST(DisplayListPathBuilder, NonZeroAppendEvenOddAppendStaysNonZero) {
495 auto even_odd_path_builder = DlPathBuilder{}
496 .SetFillType(DlPathFillType::kOdd)
497 .MoveTo({0, 0})
498 .LineTo({100, 0})
499 .LineTo({0, 100})
500 .Close();
501 auto non_zero_path_builder = DlPathBuilder{}
502 .SetFillType(DlPathFillType::kNonZero)
503 .MoveTo({200, 200})
504 .LineTo({300, 200})
505 .LineTo({200, 300})
506 .Close();
507
508 non_zero_path_builder.AddPath(even_odd_path_builder.TakePath());
509 auto path = non_zero_path_builder.TakePath();
510
511 EXPECT_EQ(path.GetFillType(), DlPathFillType::kNonZero);
512}
513
514} // namespace testing
515} // namespace flutter
DlPathBuilder & AddRoundSuperellipse(const DlRoundSuperellipse &rse)
Append a closed rounded super-ellipse contour to the path.
DlPathBuilder & LineTo(DlPoint p2)
Draw a line from the current point to the indicated point p2.
DlPathBuilder & AddPath(const DlPath &path)
Append the provided path to this path as if the commands used to construct it were repeated on this p...
DlPathBuilder & MoveTo(DlPoint p2)
Start a new contour that will originate at the indicated point p2.
const DlPath CopyPath()
Returns the path constructed by this path builder so far and retains all current geometry to continue...
DlPathBuilder & SetFillType(DlPathFillType fill_type)
Set the fill type that should be used to determine the interior of this path to the indicated |fill_t...
const DlPath TakePath()
Returns the path constructed by this path builder and resets its internal state to the default state ...
DlPathBuilder & ConicCurveTo(DlPoint cp, DlPoint p2, DlScalar weight)
Draw a conic curve (a rational quadratic bezier curve) from the current point to the indicated point ...
DlPathBuilder & AddCircle(DlPoint center, DlScalar radius)
Append a closed circular contour to the path centered on the provided point at the provided radius.
DlPathBuilder & AddRect(const DlRect &rect)
Append a closed rectangular contour to the path.
DlPathBuilder & AddRoundRect(const DlRoundRect &round_rect)
Append a closed rounded rect contour to the path.
DlPathBuilder & QuadraticCurveTo(DlPoint cp, DlPoint p2)
Draw a quadratic bezier curve from the current point to the indicated point p2, using the indicated p...
DlPathBuilder & AddArc(const DlRect &bounds, DlDegrees start, DlDegrees sweep, bool use_center=false)
Append an arc contour to the path which:
DlPathBuilder & AddOval(const DlRect &bounds)
Append a closed elliptical contour to the path inscribed in the provided bounds.
DlPathBuilder & CubicCurveTo(DlPoint cp1, DlPoint cp2, DlPoint p2)
Draw a cubic bezier curve from the current point to the indicated point p2, using the indicated point...
bool IsEmpty() const
Definition dl_path.cc:204
DlRect GetBounds() const override
Definition dl_path.cc:243
DlPathFillType GetFillType() const override
Definition dl_path.cc:239
TEST(NativeAssetsManagerTest, NoAvailableAssets)
impeller::Degrees DlDegrees
impeller::Size DlSize
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switch_defs.h:52
impeller::Point DlPoint
constexpr float kSqrt2Over2
Definition constants.h:51
void MoveTo(PathBuilder *builder, Scalar x, Scalar y)
void LineTo(PathBuilder *builder, Scalar x, Scalar y)
void CubicTo(PathBuilder *builder, Scalar x1, Scalar y1, Scalar x2, Scalar y2, Scalar x3, Scalar y3)
void Close(PathBuilder *builder)
static RoundRect MakeRectRadii(const Rect &rect, const RoundingRadii &radii)
Definition round_rect.cc:9
static RoundSuperellipse MakeRectRadii(const Rect &rect, const RoundingRadii &radii)
constexpr bool IsEmpty() const
Returns true if either of the width or height are 0, negative, or NaN.
Definition rect.h:297
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)
Definition rect.h:129