Lines Matching full:path
37 SkPath path;
39 path.addRRect(rrect);
40 REPORTER_ASSERT(reporter, bounds == path.getBounds());
44 SkPath path;
45 path.moveTo(20, 20);
46 path.quadTo(20, 50, 80, 50);
47 path.quadTo(20, 50, 20, 80);
48 REPORTER_ASSERT(reporter, !path.isConvex());
69 static void make_path_crbug364224(SkPath* path) {
70 path->reset();
71 path->moveTo(3.747501373f, 2.724499941f);
72 path->lineTo(3.747501373f, 3.75f);
73 path->cubicTo(3.747501373f, 3.88774991f, 3.635501385f, 4.0f, 3.497501373f, 4.0f);
74 path->lineTo(0.7475013733f, 4.0f);
75 path->cubicTo(0.6095013618f, 4.0f, 0.4975013733f, 3.88774991f, 0.4975013733f, 3.75f);
76 path->lineTo(0.4975013733f, 1.0f);
77 path->cubicTo(0.4975013733f, 0.8622499704f, 0.6095013618f, 0.75f, 0.7475013733f,0.75f);
78 path->lineTo(3.497501373f, 0.75f);
79 path->cubicTo(3.50275135f, 0.75f, 3.5070014f, 0.7527500391f, 3.513001442f, 0.753000021f);
80 path->lineTo(3.715001345f, 0.5512499809f);
81 path->cubicTo(3.648251295f, 0.5194999576f, 3.575501442f, 0.4999999702f, 3.497501373f, 0.4999999702f);
82 path->lineTo(0.7475013733f, 0.4999999702f);
83 path->cubicTo(0.4715013802f, 0.4999999702f, 0.2475013733f, 0.7239999771f, 0.2475013733f, 1.0f);
84 path->lineTo(0.2475013733f, 3.75f);
85 path->cubicTo(0.2475013733f, 4.026000023f, 0.4715013504f, 4.25f, 0.7475013733f, 4.25f);
86 path->lineTo(3.497501373f, 4.25f);
87 path->cubicTo(3.773501396f, 4.25f, 3.997501373f, 4.026000023f, 3.997501373f, 3.75f);
88 path->lineTo(3.997501373f, 2.474750042f);
89 path->lineTo(3.747501373f, 2.724499941f);
90 path->close();
93 static void make_path_crbug364224_simplified(SkPath* path) {
94 path->moveTo(3.747501373f, 2.724499941f);
95 path->cubicTo(3.648251295f, 0.5194999576f, 3.575501442f, 0.4999999702f, 3.497501373f, 0.4999999702f);
96 path->close();
100 SkPath path;
105 make_path_crbug364224_simplified(&path);
106 canvas->drawPath(path, paint);
108 make_path_crbug364224(&path);
109 canvas->drawPath(path, paint);
113 * In debug mode, this path was causing an assertion to fail in
116 static void make_path_crbugskia2820(SkPath* path, skiatest::Reporter* reporter) {
123 path->reset();
124 path->moveTo(orig);
125 path->cubicTo(p1, p2, p3);
126 path->close();
130 SkPath path;
131 make_path_crbugskia2820(&path, reporter);
135 stroke.applyToPath(&path, path);
138 static void make_path0(SkPath* path) {
141 path->moveTo(146.939f, 1012.84f);
142 path->lineTo(181.747f, 1009.18f);
143 path->lineTo(182.165f, 1013.16f);
144 path->lineTo(147.357f, 1016.82f);
145 path->lineTo(146.939f, 1012.84f);
146 path->close();
149 static void make_path1(SkPath* path) {
150 path->addRect(SkRect::MakeXYWH(10, 10, 10, 1));
157 * construction of the region when the path was INVERSE. That is now fixed,
172 SkPath path;
173 procs[i](&path);
176 rgn.setPath(path, clip);
177 path.toggleInverseFillType();
178 rgn.setPath(path, clip);
191 SkPath path;
195 path.rLineTo(0, 100);
196 path.rLineTo(100, 0);
197 path.close(); // Returns us back to 0,0.
198 path.rLineTo(50, 50); // This should go to 50,50.
200 path.getLastPt(&last);
205 path.rewind();
206 path.rLineTo(0, 100);
207 path.rLineTo(100, 0);
208 path.close();
209 path.rQuadTo(50, 50, 75, 75);
211 path.getLastPt(&last);
216 path.rewind();
217 path.rLineTo(0, 100);
218 path.rLineTo(100, 0);
219 path.close();
220 path.rConicTo(50, 50, 85, 85, 2);
222 path.getLastPt(&last);
227 path.rewind();
228 path.rLineTo(0, 100);
229 path.rLineTo(100, 0);
230 path.close();
231 path.rCubicTo(50, 50, 85, 85, 95, 95);
233 path.getLastPt(&last);
288 SkPath path;
289 path.moveTo(13.8509f, 3.16858f);
290 path.cubicTo(-2.35893e+08f, -4.21044e+08f,
297 surface->getCanvas()->drawPath(path, paint);
308 SkPath path;
309 path.moveTo(pts[0]);
310 path.cubicTo(pts[1], pts[2], pts[3]);
319 paint.getFillPath(path, &dst, nullptr);
322 static void build_path_170666(SkPath& path) {
323 path.moveTo(17.9459f, 21.6344f);
324 path.lineTo(139.545f, -47.8105f);
325 path.lineTo(139.545f, -47.8105f);
326 path.lineTo(131.07f, -47.3888f);
327 path.lineTo(131.07f, -47.3888f);
328 path.lineTo(122.586f, -46.9532f);
329 path.lineTo(122.586f, -46.9532f);
330 path.lineTo(18076.6f, 31390.9f);
331 path.lineTo(18076.6f, 31390.9f);
332 path.lineTo(18085.1f, 31390.5f);
333 path.lineTo(18085.1f, 31390.5f);
334 path.lineTo(18076.6f, 31390.9f);
335 path.lineTo(18076.6f, 31390.9f);
336 path.lineTo(17955, 31460.3f);
337 path.lineTo(17955, 31460.3f);
338 path.lineTo(17963.5f, 31459.9f);
339 path.lineTo(17963.5f, 31459.9f);
340 path.lineTo(17971.9f, 31459.5f);
341 path.lineTo(17971.9f, 31459.5f);
342 path.lineTo(17.9551f, 21.6205f);
343 path.lineTo(17.9551f, 21.6205f);
344 path.lineTo(9.47091f, 22.0561f);
345 path.lineTo(9.47091f, 22.0561f);
346 path.lineTo(17.9459f, 21.6344f);
347 path.lineTo(17.9459f, 21.6344f);
348 path.close();path.moveTo(0.995934f, 22.4779f);
349 path.lineTo(0.986725f, 22.4918f);
350 path.lineTo(0.986725f, 22.4918f);
351 path.lineTo(17955, 31460.4f);
352 path.lineTo(17955, 31460.4f);
353 path.lineTo(17971.9f, 31459.5f);
354 path.lineTo(17971.9f, 31459.5f);
355 path.lineTo(18093.6f, 31390.1f);
356 path.lineTo(18093.6f, 31390.1f);
357 path.lineTo(18093.6f, 31390);
358 path.lineTo(18093.6f, 31390);
359 path.lineTo(139.555f, -47.8244f);
360 path.lineTo(139.555f, -47.8244f);
361 path.lineTo(122.595f, -46.9671f);
362 path.lineTo(122.595f, -46.9671f);
363 path.lineTo(0.995934f, 22.4779f);
364 path.lineTo(0.995934f, 22.4779f);
365 path.close();
366 path.moveTo(5.43941f, 25.5223f);
367 path.lineTo(798267, -28871.1f);
368 path.lineTo(798267, -28871.1f);
369 path.lineTo(3.12512e+06f, -113102);
370 path.lineTo(3.12512e+06f, -113102);
371 path.cubicTo(5.16324e+06f, -186882, 8.15247e+06f, -295092, 1.1957e+07f, -432813);
372 path.cubicTo(1.95659e+07f, -708257, 3.04359e+07f, -1.10175e+06f, 4.34798e+07f, -1.57394e+06f);
373 path.cubicTo(6.95677e+07f, -2.51831e+06f, 1.04352e+08f, -3.77748e+06f, 1.39135e+08f, -5.03666e+06f);
374 path.cubicTo(1.73919e+08f, -6.29583e+06f, 2.08703e+08f, -7.555e+06f, 2.34791e+08f, -8.49938e+06f);
375 path.cubicTo(2.47835e+08f, -8.97157e+06f, 2.58705e+08f, -9.36506e+06f, 2.66314e+08f, -9.6405e+06f);
376 path.cubicTo(2.70118e+08f, -9.77823e+06f, 2.73108e+08f, -9.88644e+06f, 2.75146e+08f, -9.96022e+06f);
377 path.cubicTo(2.76165e+08f, -9.99711e+06f, 2.76946e+08f, -1.00254e+07f, 2.77473e+08f, -1.00444e+07f);
378 path.lineTo(2.78271e+08f, -1.00733e+07f);
379 path.lineTo(2.78271e+08f, -1.00733e+07f);
380 path.cubicTo(2.78271e+08f, -1.00733e+07f, 2.08703e+08f, -7.555e+06f, 135.238f, 23.3517f);
381 path.cubicTo(131.191f, 23.4981f, 125.995f, 23.7976f, 123.631f, 24.0206f);
382 path.cubicTo(121.267f, 24.2436f, 122.631f, 24.3056f, 126.677f, 24.1591f);
383 path.cubicTo(2.08703e+08f, -7.555e+06f, 2.78271e+08f, -1.00733e+07f, 2.78271e+08f, -1.00733e+07f);
384 path.lineTo(2.77473e+08f, -1.00444e+07f);
385 path.lineTo(2.77473e+08f, -1.00444e+07f);
386 path.cubicTo(2.76946e+08f, -1.00254e+07f, 2.76165e+08f, -9.99711e+06f, 2.75146e+08f, -9.96022e+06f);
387 path.cubicTo(2.73108e+08f, -9.88644e+06f, 2.70118e+08f, -9.77823e+06f, 2.66314e+08f, -9.6405e+06f);
388 path.cubicTo(2.58705e+08f, -9.36506e+06f, 2.47835e+08f, -8.97157e+06f, 2.34791e+08f, -8.49938e+06f);
389 path.cubicTo(2.08703e+08f, -7.555e+06f, 1.73919e+08f, -6.29583e+06f, 1.39135e+08f, -5.03666e+06f);
390 path.cubicTo(1.04352e+08f, -3.77749e+06f, 6.95677e+07f, -2.51831e+06f, 4.34798e+07f, -1.57394e+06f);
391 path.cubicTo(3.04359e+07f, -1.10175e+06f, 1.95659e+07f, -708258, 1.1957e+07f, -432814);
392 path.cubicTo(8.15248e+06f, -295092, 5.16324e+06f, -186883, 3.12513e+06f, -113103);
393 path.lineTo(798284, -28872);
394 path.lineTo(798284, -28872);
395 path.lineTo(22.4044f, 24.6677f);
396 path.lineTo(22.4044f, 24.6677f);
397 path.cubicTo(22.5186f, 24.5432f, 18.8134f, 24.6337f, 14.1287f, 24.8697f);
398 path.cubicTo(9.4439f, 25.1057f, 5.55359f, 25.3978f, 5.43941f, 25.5223f);
399 path.close();
402 static void build_path_simple_170666(SkPath& path) {
403 path.moveTo(126.677f, 24.1591f);
404 path.cubicTo(2.08703e+08f, -7.555e+06f, 2.78271e+08f, -1.00733e+07f, 2.78271e+08f, -1.00733e+07f);
411 SkPath path;
417 build_path_simple_170666(path);
418 surface->getCanvas()->drawPath(path, paint);
420 build_path_170666(path);
421 surface->getCanvas()->drawPath(path, paint);
487 SkPath path;
488 path.lineTo(0, 0);
489 path.addRect(SkRect::MakeWH(50, 100));
490 REPORTER_ASSERT(reporter, path.isRect(nullptr));
492 path.reset();
493 path.lineTo(FLT_EPSILON, FLT_EPSILON);
494 path.addRect(SkRect::MakeWH(50, 100));
495 REPORTER_ASSERT(reporter, !path.isRect(nullptr));
497 path.reset();
498 path.quadTo(0, 0, 0, 0);
499 path.addRect(SkRect::MakeWH(50, 100));
500 REPORTER_ASSERT(reporter, !path.isRect(nullptr));
502 path.reset();
503 path.conicTo(0, 0, 0, 0, 0.5f);
504 path.addRect(SkRect::MakeWH(50, 100));
505 REPORTER_ASSERT(reporter, !path.isRect(nullptr));
507 path.reset();
508 path.cubicTo(0, 0, 0, 0, 0, 0);
509 path.addRect(SkRect::MakeWH(50, 100));
510 REPORTER_ASSERT(reporter, !path.isRect(nullptr));
515 SkPath path;
517 path.addRect(SkRect::MakeWH(50, 100));
518 REPORTER_ASSERT(reporter, path.isFinite());
520 path.moveTo(0, 0);
521 path.lineTo(SK_ScalarInfinity, 42);
522 REPORTER_ASSERT(reporter, !path.isFinite());
524 path.addRect(SkRect::MakeWH(50, 100));
525 REPORTER_ASSERT(reporter, !path.isFinite());
527 path.reset();
528 REPORTER_ASSERT(reporter, path.isFinite());
530 path.addRect(SkRect::MakeWH(50, 100));
531 REPORTER_ASSERT(reporter, path.isFinite());
534 static void build_big_path(SkPath* path, bool reducedCase) {
536 path->moveTo(577330, 1971.72f);
537 path->cubicTo(10.7082f, -116.596f, 262.057f, 45.6468f, 294.694f, 1.96237f);
539 path->moveTo(60.1631f, 7.70567f);
540 path->quadTo(60.1631f, 7.70567f, 0.99474f, 0.901199f);
541 path->lineTo(577379, 1977.77f);
542 path->quadTo(577364, 1979.57f, 577325, 1980.26f);
543 path->quadTo(577286, 1980.95f, 577245, 1980.13f);
544 path->quadTo(577205, 1979.3f, 577187, 1977.45f);
545 path->quadTo(577168, 1975.6f, 577183, 1973.8f);
546 path->quadTo(577198, 1972, 577238, 1971.31f);
547 path->quadTo(577277, 1970.62f, 577317, 1971.45f);
548 path->quadTo(577330, 1971.72f, 577341, 1972.11f);
549 path->cubicTo(10.7082f, -116.596f, 262.057f, 45.6468f, 294.694f, 1.96237f);
550 path->moveTo(306.718f, -32.912f);
551 path->cubicTo(30.531f, 10.0005f, 1502.47f, 13.2804f, 84.3088f, 9.99601f);
558 // This path used to assert, because our cubic-chopping code incorrectly
561 SkPath path;
563 build_big_path(&path, SkToBool(doReducedCase));
568 surface->getCanvas()->drawPath(path, paint);
575 ERRORF(reporter, "path.getBounds() returned [%g %g %g %g], but expected [%g %g %g %g]",
582 SkPath path;
586 REPORTER_ASSERT(reporter, SkRect::MakeLTRB(0, 0, 0, 0) == path.getBounds());
588 path.moveTo(-5, -8);
589 REPORTER_ASSERT(reporter, SkRect::MakeLTRB(-5, -8, -5, -8) == path.getBounds());
591 path.addRect(SkRect::MakeLTRB(1, 2, 3, 4));
592 REPORTER_ASSERT(reporter, SkRect::MakeLTRB(-5, -8, 3, 4) == path.getBounds());
594 path.moveTo(1, 2);
595 REPORTER_ASSERT(reporter, SkRect::MakeLTRB(-5, -8, 3, 4) == path.getBounds());
597 dump_if_ne(reporter, SkRect::MakeLTRB(0, 0, 0, 0), path.getBounds());
599 path.moveTo(-5, -8); // should set the bounds
600 dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, -5, -8), path.getBounds());
602 path.addRect(SkRect::MakeLTRB(1, 2, 3, 4)); // should extend the bounds
603 dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, 3, 4), path.getBounds());
605 path.moveTo(1, 2); // don't expect this to have changed the bounds
606 dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, 3, 4), path.getBounds());
622 SkPath path;
623 path.moveTo(pts[0]);
624 path.cubicTo(pts[1], pts[2], pts[3]);
630 surface->getCanvas()->drawPath(path, paint);
637 SkPath path;
638 path.quadTo(157, 366, 286, 208);
639 path.arcTo(37, 442, 315, 163, 957494590897113.0f);
644 // Be sure that path::transform correctly updates isFinite and the bounds
648 while (path.isFinite()) {
649 REPORTER_ASSERT(reporter, path.getBounds().isFinite());
650 REPORTER_ASSERT(reporter, !path.getBounds().isEmpty());
651 path.transform(matrix);
653 REPORTER_ASSERT(reporter, path.getBounds().isEmpty());
656 path.transform(matrix);
658 REPORTER_ASSERT(reporter, !path.isFinite());
659 REPORTER_ASSERT(reporter, path.getBounds().isEmpty());
662 static void add_corner_arc(SkPath* path, const SkRect& rect,
689 path->arcTo(arcRect, SkIntToScalar(startAngle), SkIntToScalar(90), false);
692 static void make_arb_round_rect(SkPath* path, const SkRect& r,
695 add_corner_arc(path, r, xCorner, yCorner, 270);
696 add_corner_arc(path, r, xCorner, yCorner, 0);
697 add_corner_arc(path, r, xCorner, yCorner, 90);
698 add_corner_arc(path, r, xCorner, yCorner, 180);
699 path->close();
730 // quads prevent the path from being converted to a rect
797 SkPath path;
798 REPORTER_ASSERT(reporter, path.isFinite());
800 path.reset();
801 REPORTER_ASSERT(reporter, path.isFinite());
803 path.reset();
804 path.moveTo(SK_Scalar1, 0);
805 REPORTER_ASSERT(reporter, path.isFinite());
807 path.reset();
808 path.moveTo(inf, negInf);
809 REPORTER_ASSERT(reporter, !path.isFinite());
811 path.reset();
812 path.moveTo(nan, 0);
813 REPORTER_ASSERT(reporter, !path.isFinite());
822 SkPath path;
823 REPORTER_ASSERT(reporter, !path.isLastContourClosed());
824 path.moveTo(0, 0);
825 REPORTER_ASSERT(reporter, !path.isLastContourClosed());
826 path.close();
827 REPORTER_ASSERT(reporter, path.isLastContourClosed());
828 path.lineTo(100, 100);
829 REPORTER_ASSERT(reporter, !path.isLastContourClosed());
830 path.moveTo(200, 200);
831 REPORTER_ASSERT(reporter, !path.isLastContourClosed());
832 path.close();
833 REPORTER_ASSERT(reporter, path.isLastContourClosed());
834 path.moveTo(0, 0);
835 REPORTER_ASSERT(reporter, !path.isLastContourClosed());
845 static void test_poly(skiatest::Reporter* reporter, const SkPath& path,
847 SkPath::RawIter iter(path);
899 SkPath path;
900 path.addPoly(pts, SkToInt(count), SkToBool(doClose));
901 test_poly(reporter, path, pts, SkToBool(doClose));
930 static void check_direction(skiatest::Reporter* reporter, const SkPath& path,
935 SkPath copy(path); // we make a copy so that we don't cache the result on the passed in path.
947 SkPath path;
948 REPORTER_ASSERT(reporter, !SkPathPriv::CheapComputeFirstDirection(path, nullptr));
949 REPORTER_ASSERT(reporter, !SkPathPriv::CheapIsFirstDirection(path, SkPathPriv::kCW_FirstDirection));
950 REPORTER_ASSERT(reporter, !SkPathPriv::CheapIsFirstDirection(path, SkPathPriv::kCCW_FirstDirection));
951 REPORTER_ASSERT(reporter, SkPathPriv::CheapIsFirstDirection(path, SkPathPriv::kUnknown_FirstDirection));
962 path.reset();
963 bool valid = SkParsePath::FromSVGString(gDegen[i], &path);
965 REPORTER_ASSERT(reporter, !SkPathPriv::CheapComputeFirstDirection(path, nullptr));
978 path.reset();
979 bool valid = SkParsePath::FromSVGString(gCW[i], &path);
981 check_direction(reporter, path, SkPathPriv::kCW_FirstDirection);
994 path.reset();
995 bool valid = SkParsePath::FromSVGString(gCCW[i], &path);
997 check_direction(reporter, path, SkPathPriv::kCCW_FirstDirection);
1002 path.reset();
1003 path.addCircle(0, 0, SkIntToScalar(2), SkPath::kCW_Direction);
1004 path.addCircle(0, 0, SkIntToScalar(1), SkPath::kCCW_Direction);
1005 check_direction(reporter, path, SkPathPriv::kCW_FirstDirection);
1007 path.reset();
1008 path.addCircle(0, 0, SkIntToScalar(1), SkPath::kCW_Direction);
1009 path.addCircle(0, 0, SkIntToScalar(2), SkPath::kCCW_Direction);
1010 check_direction(reporter, path, SkPathPriv::kCCW_FirstDirection);
1013 path.reset();
1015 path.moveTo(SkBits2Float(0x501c7652), SkBits2Float(0x501c7652));
1016 path.lineTo(110 * SK_Scalar1, -10 * SK_Scalar1);
1017 path.lineTo(-10 * SK_Scalar1, 60 * SK_Scalar1);
1018 check_direction(reporter, path, SkPathPriv::kCCW_FirstDirection);
1020 path.reset();
1021 path.conicTo(20, 0, 20, 20, 0.5f);
1022 path.close();
1023 check_direction(reporter, path, SkPathPriv::kCW_FirstDirection);
1025 path.reset();
1026 path.lineTo(1, 1e7f);
1027 path.lineTo(1e7f, 2e7f);
1028 path.close();
1029 REPORTER_ASSERT(reporter, SkPath::kConvex_Convexity == path.getConvexity());
1030 check_direction(reporter, path, SkPathPriv::kCCW_FirstDirection);
1033 static void add_rect(SkPath* path, const SkRect& r) {
1034 path->moveTo(r.fLeft, r.fTop);
1035 path->lineTo(r.fRight, r.fTop);
1036 path->lineTo(r.fRight, r.fBottom);
1037 path->lineTo(r.fLeft, r.fBottom);
1038 path->close();
1059 SkPath path;
1060 path.moveTo(pts[0]);
1061 path.cubicTo(pts[1], pts[2], pts[3]);
1068 paint.getFillPath(path, &fill);
1094 static void check_close(skiatest::Reporter* reporter, const SkPath& path) {
1096 SkPath::Iter iter(path, SkToBool(i));
1190 static void check_convexity(skiatest::Reporter* reporter, const SkPath& path,
1192 SkPath copy(path); // we make a copy so that we don't cache the result on the passed in path.
1378 static void setFromString(SkPath* path, const char str[]) {
1389 path->moveTo(x, y);
1392 path->lineTo(x, y);
1398 SkPath path;
1400 check_convexity(reporter, path, SkPath::kConvex_Convexity);
1401 path.addCircle(0, 0, SkIntToScalar(10));
1402 check_convexity(reporter, path, SkPath::kConvex_Convexity);
1403 path.addCircle(0, 0, SkIntToScalar(10)); // 2nd circle
1404 check_convexity(reporter, path, SkPath::kConcave_Convexity);
1406 path.reset();
1407 path.addRect(0, 0, SkIntToScalar(10), SkIntToScalar(10), SkPath::kCCW_Direction);
1408 check_convexity(reporter, path, SkPath::kConvex_Convexity);
1409 REPORTER_ASSERT(reporter, SkPathPriv::CheapIsFirstDirection(path, SkPathPriv::kCCW_FirstDirection));
1411 path.reset();
1412 path.addRect(0, 0, SkIntToScalar(10), SkIntToScalar(10), SkPath::kCW_Direction);
1413 check_convexity(reporter, path, SkPath::kConvex_Convexity);
1414 REPORTER_ASSERT(reporter, SkPathPriv::CheapIsFirstDirection(path, SkPathPriv::kCW_FirstDirection));
1432 SkPath path;
1433 setFromString(&path, gRec[i].fPathStr);
1434 check_convexity(reporter, path, gRec[i].fExpectedConvexity);
1435 check_direction(reporter, path, gRec[i].fExpectedDirection);
1438 SkPath copy(path);
1446 REPORTER_ASSERT(reporter, gRec[i].fExpectedConvexity == path.getConvexity());
1447 check_direction(reporter, path, gRec[i].fExpectedDirection);
1481 path.reset();
1483 case 0: path.lineTo(nonFinitePts[i]); break;
1484 case 1: path.quadTo(nonFinitePts[i], nonFinitePts[i]); break;
1485 case 2: path.quadTo(nonFinitePts[i], finitePts[f]); break;
1486 case 3: path.quadTo(finitePts[f], nonFinitePts[i]); break;
1487 case 4: path.cubicTo(nonFinitePts[i], finitePts[f], finitePts[f]); break;
1488 case 5: path.cubicTo(finitePts[f], nonFinitePts[i], finitePts[f]); break;
1489 case 6: path.cubicTo(finitePts[f], finitePts[f], nonFinitePts[i]); break;
1490 case 7: path.cubicTo(nonFinitePts[i], nonFinitePts[i], finitePts[f]); break;
1491 case 8: path.cubicTo(nonFinitePts[i], finitePts[f], nonFinitePts[i]); break;
1492 case 9: path.cubicTo(finitePts[f], nonFinitePts[i], nonFinitePts[i]); break;
1493 case 10: path.cubicTo(nonFinitePts[i], nonFinitePts[i], nonFinitePts[i]); break;
1494 case 11: path.cubicTo(nonFinitePts[i], finitePts[f], finitePts[g]); break;
1495 case 12: path.moveTo(nonFinitePts[i]); break;
1497 check_convexity(reporter, path, SkPath::kUnknown_Convexity);
1503 path.reset();
1506 case 0: path.moveTo(finitePts[f]); break;
1507 case 1: path.lineTo(finitePts[f]); break;
1508 case 2: path.quadTo(finitePts[f], finitePts[f]); break;
1509 case 3: path.quadTo(finitePts[f], finitePts[g]); break;
1510 case 4: path.quadTo(finitePts[g], finitePts[f]); break;
1511 case 5: path.cubicTo(finitePts[f], finitePts[f], finitePts[f]); break;
1512 case 6: path.cubicTo(finitePts[f], finitePts[f], finitePts[g]); break;
1513 case 7: path.cubicTo(finitePts[f], finitePts[g], finitePts[f]); break;
1514 case 8: path.cubicTo(finitePts[f], finitePts[g], finitePts[g]); break;
1515 case 9: path.cubicTo(finitePts[g], finitePts[f], finitePts[f]); break;
1516 case 10: path.cubicTo(finitePts[g], finitePts[f], finitePts[g]); break;
1518 check_convexity(reporter, path, curveSelect == 0 ? SkPath::kConvex_Convexity
1525 SkPath path;
1529 REPORTER_ASSERT(reporter, !path.isLine(nullptr));
1534 REPORTER_ASSERT(reporter, !path.isLine(pts));
1543 path.moveTo(moveX, moveY);
1544 REPORTER_ASSERT(reporter, !path.isLine(nullptr));
1545 REPORTER_ASSERT(reporter, !path.isLine(pts));
1554 path.lineTo(lineX, lineY);
1555 REPORTER_ASSERT(reporter, path.isLine(nullptr));
1559 REPORTER_ASSERT(reporter, path.isLine(pts));
1563 path.lineTo(0, 0); // too many points/verbs
1564 REPORTER_ASSERT(reporter, !path.isLine(nullptr));
1565 REPORTER_ASSERT(reporter, !path.isLine(pts));
1569 path.reset();
1570 path.quadTo(1, 1, 2, 2);
1571 REPORTER_ASSERT(reporter, !path.isLine(nullptr));
1575 SkPath path;
1675 path.reset();
1676 path.addRect(kBaseRect, dir);
1678 path.conservativelyContainsRect(qRect));
1680 path.reset();
1681 path.addCircle(kCircleC.fX, kCircleC.fY, circleR, dir);
1683 path.conservativelyContainsRect(qRect));
1685 path.reset();
1686 path.addRoundRect(kBaseRect, kRRRadii[0], kRRRadii[1], dir);
1688 path.conservativelyContainsRect(qRect));
1690 path.reset();
1691 path.moveTo(kBaseRect.fLeft + kRRRadii[0], kBaseRect.fTop);
1692 path.cubicTo(kBaseRect.fLeft + kRRRadii[0] / 2, kBaseRect.fTop,
1695 path.lineTo(kBaseRect.fLeft, kBaseRect.fBottom);
1696 path.lineTo(kBaseRect.fRight, kBaseRect.fBottom);
1697 path.lineTo(kBaseRect.fRight, kBaseRect.fTop);
1698 path.close();
1700 path.conservativelyContainsRect(qRect));
1704 path.reset();
1705 path.moveTo(0, 0);
1706 path.lineTo(SkIntToScalar(50), 0.05f);
1707 path.lineTo(SkIntToScalar(100), 0);
1708 path.lineTo(SkIntToScalar(100), SkIntToScalar(100));
1709 path.lineTo(0, SkIntToScalar(100));
1710 path.close();
1711 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(qRect));
1716 path.reset();
1717 path
1718 path.lineTo(SkIntToScalar(100), 0);
1719 path.lineTo(0, SkIntToScalar(100));
1722 REPORTER_ASSERT(reporter, path.conservativelyContainsRect(SkRect::MakeXYWH(SkIntToScalar(50), 0,
1726 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(
1732 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeXYWH(SkIntToScalar(-10),
1738 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeXYWH(SkIntToScalar(10),
1748 path.moveTo(SkIntToScalar(100), SkIntToScalar(100));
1750 REPORTER_ASSERT(reporter, path.conservativelyContainsRect(SkRect::MakeXYWH(SkIntToScalar(50), 0,
1755 // Same as above path and first test but with an extra moveTo.
1756 path.reset();
1757 path.moveTo(100, 100);
1758 path.moveTo(0, 0);
1759 path.lineTo(SkIntToScalar(100), 0);
1760 path.lineTo(0, SkIntToScalar(100));
1762 REPORTER_ASSERT(reporter, path.conservativelyContainsRect(SkRect::MakeXYWH(SkIntToScalar(50), 0,
1768 path.reset();
1769 path.moveTo(0, 0);
1770 path.lineTo(SkIntToScalar(100), 0);
1771 path.lineTo(0, SkIntToScalar(100));
1772 path.moveTo(0, SkIntToScalar(200));
1773 path.lineTo(SkIntToScalar(100), SkIntToScalar(200));
1774 path.lineTo(0, SkIntToScalar(300));
1776 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(
1781 path.reset();
1782 path.lineTo(100, 100);
1783 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeXYWH(0, 0, 1, 1)));
1787 SkPath path;
1790 path.moveTo(0, 0); path.lineTo(1, 0); path.lineTo(1, 1); path.lineTo(0, 1);
1791 path.close();
1793 REPORTER_ASSERT(reporter, path.isRect(nullptr, &isClosed, nullptr));
1889 SkPath path;
1890 path.moveTo(tests[testIndex].fPoints[0].fX, tests[testIndex].fPoints[0].fY);
1892 path.lineTo(tests[testIndex].fPoints[index].fX, tests[testIndex].fPoints[index].fY);
1895 path.close();
1897 REPORTER_ASSERT(reporter, tests[testIndex].fIsRect == path.isRect(nullptr));
1905 REPORTER_ASSERT(reporter, SkPathPriv::CheapComputeFirstDirection(path, &cheapDirection));
1906 REPORTER_ASSERT(reporter, path.isRect(&computed, &isClosed, &direction));
1915 REPORTER_ASSERT(reporter, !path.isRect(&computed, &isClosed, &direction));
2015 bool fIsNestedRect; // nests with path.addRect(-1, -1, 2, 2);
2049 SkPath path;
2051 path.addRect(-1, -1, 2, 2, SkPath::kCW_Direction);
2053 path.moveTo(tests[testIndex].fPoints[0].fX, tests[testIndex].fPoints[0].fY);
2055 path.lineTo(tests[testIndex].fPoints[index].fX, tests[testIndex].fPoints[index].fY);
2058 path.close();
2061 path.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction);
2064 tests[testIndex].fIsNestedRect == path.isNestedFillRects(nullptr));
2079 REPORTER_ASSERT(reporter, path.isNestedFillRects(computed, computedDirs));
2180 SkPath path;
2181 path.moveTo(0, 0);
2182 path.lineTo(10, 0);
2183 path.lineTo(10, 10);
2184 path.lineTo(0, 10);
2185 path.lineTo(0, 0);
2186 path.moveTo(1, 1);
2187 path.lineTo(9, 1);
2188 path.lineTo(9, 9);
2189 path.lineTo(1, 9);
2190 path.lineTo(1, 1);
2191 REPORTER_ASSERT(reporter, path.isNestedFillRects(nullptr));
2244 // create a buffer that should be much larger than the path so we don't
2315 SkPath p1; // Leave p1 non-unique (i.e., the empty path)
2365 p1.moveTo(SkPoint::Make(0, 0)); // Make p1 unique (i.e., not empty path)
2375 p1.moveTo(SkPoint::Make(0, 0)); // Make p1 unique (i.e., not empty path)
2489 // Test an iterator with no path
2493 // Test that setting an empty path works
2497 // Test that close path makes no difference for an empty path
2501 // Test an iterator with an initial empty path
2505 // Test that close path makes no difference
2669 // Test an iterator with no path
2672 // Test that setting an empty path works
2676 // Test an iterator with an initial empty path
2680 // Test that a move-only path returns the move.
2890 const SkPath& path,
2894 REPORTER_ASSERT(reporter, path.isOval(&rect) == expectedCircle);
2895 REPORTER_ASSERT(reporter, SkPathPriv::CheapIsFirstDirection(path, expectedDir));
2903 const SkPath& path,
2909 path.transform(m, &tmp);
2921 const SkPath& path,
2928 path.transform(m, &tmp);
2936 path.transform(m, &tmp);
2941 const SkPath& path,
2947 path.transform(m, &tmp);
2961 const SkPath& path,
2967 path.transform(m, &tmp);
2980 const SkPath& path,
2986 path.transform(m, &tmp);
2999 const SkPath& path,
3006 path.transform(m, &tmp);
3014 SkPath path;
3017 path.addCircle(0, 0, SkIntToScalar(20), inDir);
3019 check_for_circle(reporter, path, true, dir);
3020 test_circle_rotate(reporter, path, dir);
3021 test_circle_translate(reporter, path, dir);
3022 test_circle_skew(reporter, path, dir);
3025 path.reset();
3026 path.addCircle(SkIntToScalar(10), SkIntToScalar(10),
3029 check_for_circle(reporter, path, true, dir);
3030 test_circle_rotate(reporter, path, dir);
3031 test_circle_translate(reporter, path, dir);
3032 test_circle_skew(reporter, path, dir);
3033 test_circle_mirror_x(reporter, path, dir);
3034 test_circle_mirror_y(reporter, path, dir);
3035 test_circle_mirror_xy(reporter, path, dir);
3039 SkPath path;
3054 // Although all the path concatenation related operations leave
3055 // the path a circle, most mark it as a non-circle for simplicity
3058 path = empty;
3059 path.addPath(circle, translate);
3060 check_for_circle(reporter, path, false, SkPathPriv::AsFirstDirection(kCircleDir));
3063 path = circle;
3064 path.addPath(empty, translate);
3065 check_for_circle(reporter, path, true, SkPathPriv::AsFirstDirection(kCircleDir));
3068 path = circle;
3069 path.reverseAddPath(rect);
3070 check_for_circle(reporter, path, false, SkPathPriv::AsFirstDirection(kCircleDirOpposite));
3078 SkPath path;
3079 path.addCircle(0, 0, SkIntToScalar(10), SkPath::kCW_Direction);
3080 path.addCircle(0, 0, SkIntToScalar(20), SkPath::kCW_Direction);
3081 check_for_circle(reporter, path, false, SkPathPriv::kCW_FirstDirection);
3084 path.reset();
3085 path.addCircle(0, 0, SkIntToScalar(10), SkPath::kCW_Direction);
3086 path.lineTo(0, 0);
3087 check_for_circle(reporter, path, false, SkPathPriv::kCW_FirstDirection);
3090 path.reset();
3091 path.addCircle(0, 0, SkIntToScalar(10), SkPath::kCW_Direction);
3092 path.setLastPt(SkIntToScalar(5), SkIntToScalar(5));
3093 check_for_circle(reporter, path, false, SkPathPriv::kCW_FirstDirection);
3098 path.reset();
3099 path.addCircle(0, 0, -1, SkPath::kCW_Direction);
3100 REPORTER_ASSERT(reporter, path.isEmpty());
3106 SkPath path;
3109 path.addOval(rect);
3111 REPORTER_ASSERT(reporter, path.isOval(nullptr));
3115 path.transform(m, &tmp);
3122 path.transform(m, &tmp);
3126 // since empty path being transformed.
3127 path.reset();
3130 path.transform(m, &tmp);
3133 // empty path is not an oval
3145 path.reset();
3146 path.moveTo(0, 0);
3147 path.addOval(rect);
3148 REPORTER_ASSERT(reporter, path.isOval(nullptr));
3150 // copy path
3151 path.reset();
3154 path = tmp;
3155 REPORTER_ASSERT(reporter, path.isOval(nullptr));
3172 static void test_rrect_is_convex(skiatest::Reporter* reporter, SkPath* path,
3174 REPORTER_ASSERT(reporter, path->isConvex());
3175 REPORTER_ASSERT(reporter, SkPathPriv::CheapIsFirstDirection(*path, SkPathPriv::AsFirstDirection(dir)));
3176 path->setConvexity(SkPath::kUnknown_Convexity);
3177 REPORTER_ASSERT(reporter, path->isConvex());
3178 path->reset();
3181 static void test_rrect_convexity_is_unknown(skiatest::Reporter* reporter, SkPath* path,
3183 REPORTER_ASSERT(reporter, path->isConvex());
3184 REPORTER_ASSERT(reporter, SkPathPriv::CheapIsFirstDirection(*path, SkPathPriv::AsFirstDirection(dir)));
3185 path->setConvexity(SkPath::kUnknown_Convexity);
3186 REPORTER_ASSERT(reporter, path->getConvexity() == SkPath::kUnknown_Convexity);
3187 path->reset();
3774 static void compare_dump(skiatest::Reporter* reporter, const SkPath& path, bool force,
3777 path.dump(&wStream, force, dumpAsHex);
3793 compare_dump(reporter, p, false, false, "path.moveTo(1, 2);\n"
3794 "path.lineTo(3, 4);\n");
3795 compare_dump(reporter, p, true, false, "path.moveTo(1, 2);\n"
3796 "path.lineTo(3, 4);\n"
3797 "path.lineTo(1, 2);\n"
3798 "path.close();\n");
3802 compare_dump(reporter, p, false, false, "path.moveTo(1, 2);\n"
3803 "path.quadTo(3, 4, 5, 6);\n");
3807 compare_dump(reporter, p, false, false, "path.moveTo(1, 2);\n"
3808 "path.conicTo(3, 4, 5, 6, 0.5f);\n");
3812 compare_dump(reporter, p, false, false, "path.moveTo(1, 2);\n"
3813 "path.cubicTo(3, 4, 5, 6, 7, 8);\n");
3818 "path.moveTo(SkBits2Float(0x3f800000), SkBits2Float(0x40000000)); // 1, 2\n"
3819 "path.lineTo(SkBits2Float(0x40400000), SkBits2Float(0x40800000)); // 3, 4\n");
3823 compare_dump(reporter, p, false, false, "path.moveTo(1, 2);\n"
3824 "path.lineTo(3, 4);\n");
3965 // this triggers a code path in SkPath::operator= which is otherwise unexercised
3969 // this triggers a code path in SkPath::swap which is otherwise unexercised
4033 // path has a trailing moveTo. Please see crbug.com\445368)