@@ -300,20 +300,21 @@ TEST_P(EntityTest, TriangleInsideASquare) {
300
300
auto callback = [&](ContentContext& context, RenderPass& pass) {
301
301
Point offset (100 , 100 );
302
302
303
- Point a =
304
- IMPELLER_PLAYGROUND_POINT (Point (10 , 10 ) + offset, 20 , Color::White ());
305
- Point b =
306
- IMPELLER_PLAYGROUND_POINT (Point (210 , 10 ) + offset, 20 , Color::White ());
307
- Point c =
308
- IMPELLER_PLAYGROUND_POINT (Point (210 , 210 ) + offset, 20 , Color::White ());
309
- Point d =
310
- IMPELLER_PLAYGROUND_POINT (Point (10 , 210 ) + offset, 20 , Color::White ());
311
- Point e =
312
- IMPELLER_PLAYGROUND_POINT (Point (50 , 50 ) + offset, 20 , Color::White ());
313
- Point f =
314
- IMPELLER_PLAYGROUND_POINT (Point (100 , 50 ) + offset, 20 , Color::White ());
315
- Point g =
316
- IMPELLER_PLAYGROUND_POINT (Point (50 , 150 ) + offset, 20 , Color::White ());
303
+ static PlaygroundPoint point_a (Point (10 , 10 ) + offset, 20 , Color::White ());
304
+ Point a = DrawPlaygroundPoint (point_a);
305
+ static PlaygroundPoint point_b (Point (210 , 10 ) + offset, 20 , Color::White ());
306
+ Point b = DrawPlaygroundPoint (point_b);
307
+ static PlaygroundPoint point_c (Point (210 , 210 ) + offset, 20 ,
308
+ Color::White ());
309
+ Point c = DrawPlaygroundPoint (point_c);
310
+ static PlaygroundPoint point_d (Point (10 , 210 ) + offset, 20 , Color::White ());
311
+ Point d = DrawPlaygroundPoint (point_d);
312
+ static PlaygroundPoint point_e (Point (50 , 50 ) + offset, 20 , Color::White ());
313
+ Point e = DrawPlaygroundPoint (point_e);
314
+ static PlaygroundPoint point_f (Point (100 , 50 ) + offset, 20 , Color::White ());
315
+ Point f = DrawPlaygroundPoint (point_f);
316
+ static PlaygroundPoint point_g (Point (50 , 150 ) + offset, 20 , Color::White ());
317
+ Point g = DrawPlaygroundPoint (point_g);
317
318
Path path = PathBuilder{}
318
319
.MoveTo (a)
319
320
.LineTo (b)
@@ -392,42 +393,54 @@ TEST_P(EntityTest, StrokeCapAndJoinTest) {
392
393
// Cap::kButt demo.
393
394
{
394
395
Point off = Point (0 , 0 ) * padding + margin;
395
- auto [a, b] = IMPELLER_PLAYGROUND_LINE (off + a_def, off + b_def, r,
396
- Color::Black (), Color::White ());
397
- auto [c, d] = IMPELLER_PLAYGROUND_LINE (off + c_def, off + d_def, r,
398
- Color::Black (), Color::White ());
396
+ static PlaygroundPoint point_a (off + a_def, r, Color::Black ());
397
+ static PlaygroundPoint point_b (off + b_def, r, Color::White ());
398
+ auto [a, b] = DrawPlaygroundLine (point_a, point_b);
399
+ static PlaygroundPoint point_c (off + c_def, r, Color::Black ());
400
+ static PlaygroundPoint point_d (off + d_def, r, Color::White ());
401
+ auto [c, d] = DrawPlaygroundLine (point_c, point_d);
399
402
render_path (PathBuilder{}.AddCubicCurve (a, b, d, c).TakePath (),
400
403
Cap::kButt , Join::kBevel );
401
404
}
402
405
403
406
// Cap::kSquare demo.
404
407
{
405
408
Point off = Point (1 , 0 ) * padding + margin;
406
- auto [a, b] = IMPELLER_PLAYGROUND_LINE (off + a_def, off + b_def, r,
407
- Color::Black (), Color::White ());
408
- auto [c, d] = IMPELLER_PLAYGROUND_LINE (off + c_def, off + d_def, r,
409
- Color::Black (), Color::White ());
409
+ static PlaygroundPoint point_a (off + a_def, r, Color::Black ());
410
+ static PlaygroundPoint point_b (off + b_def, r, Color::White ());
411
+ auto [a, b] = DrawPlaygroundLine (point_a, point_b);
412
+ static PlaygroundPoint point_c (off + c_def, r, Color::Black ());
413
+ static PlaygroundPoint point_d (off + d_def, r, Color::White ());
414
+ auto [c, d] = DrawPlaygroundLine (point_c, point_d);
410
415
render_path (PathBuilder{}.AddCubicCurve (a, b, d, c).TakePath (),
411
416
Cap::kSquare , Join::kBevel );
412
417
}
413
418
414
419
// Cap::kRound demo.
415
420
{
416
421
Point off = Point (2 , 0 ) * padding + margin;
417
- auto [a, b] = IMPELLER_PLAYGROUND_LINE (off + a_def, off + b_def, r,
418
- Color::Black (), Color::White ());
419
- auto [c, d] = IMPELLER_PLAYGROUND_LINE (off + c_def, off + d_def, r,
420
- Color::Black (), Color::White ());
422
+ static PlaygroundPoint point_a (off + a_def, r, Color::Black ());
423
+ static PlaygroundPoint point_b (off + b_def, r, Color::White ());
424
+ auto [a, b] = DrawPlaygroundLine (point_a, point_b);
425
+ static PlaygroundPoint point_c (off + c_def, r, Color::Black ());
426
+ static PlaygroundPoint point_d (off + d_def, r, Color::White ());
427
+ auto [c, d] = DrawPlaygroundLine (point_c, point_d);
421
428
render_path (PathBuilder{}.AddCubicCurve (a, b, d, c).TakePath (),
422
429
Cap::kRound , Join::kBevel );
423
430
}
424
431
425
432
// Join::kBevel demo.
426
433
{
427
434
Point off = Point (0 , 1 ) * padding + margin;
428
- Point a = IMPELLER_PLAYGROUND_POINT (off + a_def, r, Color::White ());
429
- Point b = IMPELLER_PLAYGROUND_POINT (off + e_def, r, Color::White ());
430
- Point c = IMPELLER_PLAYGROUND_POINT (off + c_def, r, Color::White ());
435
+ static PlaygroundPoint point_a =
436
+ PlaygroundPoint (off + a_def, r, Color::White ());
437
+ static PlaygroundPoint point_b =
438
+ PlaygroundPoint (off + e_def, r, Color::White ());
439
+ static PlaygroundPoint point_c =
440
+ PlaygroundPoint (off + c_def, r, Color::White ());
441
+ Point a = DrawPlaygroundPoint (point_a);
442
+ Point b = DrawPlaygroundPoint (point_b);
443
+ Point c = DrawPlaygroundPoint (point_c);
431
444
render_path (
432
445
PathBuilder{}.MoveTo (a).LineTo (b).LineTo (c).Close ().TakePath (),
433
446
Cap::kButt , Join::kBevel );
@@ -436,9 +449,12 @@ TEST_P(EntityTest, StrokeCapAndJoinTest) {
436
449
// Join::kMiter demo.
437
450
{
438
451
Point off = Point (1 , 1 ) * padding + margin;
439
- Point a = IMPELLER_PLAYGROUND_POINT (off + a_def, r, Color::White ());
440
- Point b = IMPELLER_PLAYGROUND_POINT (off + e_def, r, Color::White ());
441
- Point c = IMPELLER_PLAYGROUND_POINT (off + c_def, r, Color::White ());
452
+ static PlaygroundPoint point_a (off + a_def, r, Color::White ());
453
+ static PlaygroundPoint point_b (off + e_def, r, Color::White ());
454
+ static PlaygroundPoint point_c (off + c_def, r, Color::White ());
455
+ Point a = DrawPlaygroundPoint (point_a);
456
+ Point b = DrawPlaygroundPoint (point_b);
457
+ Point c = DrawPlaygroundPoint (point_c);
442
458
render_path (
443
459
PathBuilder{}.MoveTo (a).LineTo (b).LineTo (c).Close ().TakePath (),
444
460
Cap::kButt , Join::kMiter );
@@ -447,9 +463,12 @@ TEST_P(EntityTest, StrokeCapAndJoinTest) {
447
463
// Join::kRound demo.
448
464
{
449
465
Point off = Point (2 , 1 ) * padding + margin;
450
- Point a = IMPELLER_PLAYGROUND_POINT (off + a_def, r, Color::White ());
451
- Point b = IMPELLER_PLAYGROUND_POINT (off + e_def, r, Color::White ());
452
- Point c = IMPELLER_PLAYGROUND_POINT (off + c_def, r, Color::White ());
466
+ static PlaygroundPoint point_a (off + a_def, r, Color::White ());
467
+ static PlaygroundPoint point_b (off + e_def, r, Color::White ());
468
+ static PlaygroundPoint point_c (off + c_def, r, Color::White ());
469
+ Point a = DrawPlaygroundPoint (point_a);
470
+ Point b = DrawPlaygroundPoint (point_b);
471
+ Point c = DrawPlaygroundPoint (point_c);
453
472
render_path (
454
473
PathBuilder{}.MoveTo (a).LineTo (b).LineTo (c).Close ().TakePath (),
455
474
Cap::kButt , Join::kRound );
@@ -905,10 +924,12 @@ TEST_P(EntityTest, BlendingModeOptions) {
905
924
BlendMode selected_mode = blend_mode_values[current_blend_index];
906
925
907
926
Point a, b, c, d;
908
- std::tie (a, b) = IMPELLER_PLAYGROUND_LINE (
909
- Point (400 , 100 ), Point (200 , 300 ), 20 , Color::White (), Color::White ());
910
- std::tie (c, d) = IMPELLER_PLAYGROUND_LINE (
911
- Point (470 , 190 ), Point (270 , 390 ), 20 , Color::White (), Color::White ());
927
+ static PlaygroundPoint point_a (Point (400 , 100 ), 20 , Color::White ());
928
+ static PlaygroundPoint point_b (Point (200 , 300 ), 20 , Color::White ());
929
+ std::tie (a, b) = DrawPlaygroundLine (point_a, point_b);
930
+ static PlaygroundPoint point_c (Point (470 , 190 ), 20 , Color::White ());
931
+ static PlaygroundPoint point_d (Point (270 , 390 ), 20 , Color::White ());
932
+ std::tie (c, d) = DrawPlaygroundLine (point_c, point_d);
912
933
913
934
bool result = true ;
914
935
result = result &&
@@ -1739,8 +1760,11 @@ TEST_P(EntityTest, RRectShadowTest) {
1739
1760
}
1740
1761
ImGui::End ();
1741
1762
1742
- auto [top_left, bottom_right] = IMPELLER_PLAYGROUND_LINE (
1743
- Point (200 , 200 ), Point (600 , 400 ), 30 , Color::White (), Color::White ());
1763
+ static PlaygroundPoint top_left_point (Point (200 , 200 ), 30 , Color::White ());
1764
+ static PlaygroundPoint bottom_right_point (Point (600 , 400 ), 30 ,
1765
+ Color::White ());
1766
+ auto [top_left, bottom_right] =
1767
+ DrawPlaygroundLine (top_left_point, bottom_right_point);
1744
1768
auto rect =
1745
1769
Rect::MakeLTRB (top_left.x , top_left.y , bottom_right.x , bottom_right.y );
1746
1770
0 commit comments