OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
10 #include "SkParse.h" | 10 #include "SkParse.h" |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 SkRandom rand; | 780 SkRandom rand; |
781 | 781 |
782 for (size_t i = 0; i < SK_ARRAY_COUNT(pts); ++i) { | 782 for (size_t i = 0; i < SK_ARRAY_COUNT(pts); ++i) { |
783 pts[i].fX = rand.nextSScalar1(); | 783 pts[i].fX = rand.nextSScalar1(); |
784 pts[i].fY = rand.nextSScalar1(); | 784 pts[i].fY = rand.nextSScalar1(); |
785 } | 785 } |
786 | 786 |
787 for (int doClose = 0; doClose <= 1; ++doClose) { | 787 for (int doClose = 0; doClose <= 1; ++doClose) { |
788 for (size_t count = 1; count <= SK_ARRAY_COUNT(pts); ++count) { | 788 for (size_t count = 1; count <= SK_ARRAY_COUNT(pts); ++count) { |
789 SkPath path; | 789 SkPath path; |
790 path.addPoly(pts, count, SkToBool(doClose)); | 790 path.addPoly(pts, SkToInt(count), SkToBool(doClose)); |
791 test_poly(reporter, path, pts, SkToBool(doClose)); | 791 test_poly(reporter, path, pts, SkToBool(doClose)); |
792 } | 792 } |
793 } | 793 } |
794 } | 794 } |
795 | 795 |
796 static void test_strokerec(skiatest::Reporter* reporter) { | 796 static void test_strokerec(skiatest::Reporter* reporter) { |
797 SkStrokeRec rec(SkStrokeRec::kFill_InitStyle); | 797 SkStrokeRec rec(SkStrokeRec::kFill_InitStyle); |
798 REPORTER_ASSERT(reporter, rec.isFillStyle()); | 798 REPORTER_ASSERT(reporter, rec.isFillStyle()); |
799 | 799 |
800 rec.setHairlineStyle(); | 800 rec.setHairlineStyle(); |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 SkPoint c3[] = {{0, 0}, {1, 0}, {1, 2}, {0, 2}, {0, 1}, {0, 0}}; // hit the
start | 1699 SkPoint c3[] = {{0, 0}, {1, 0}, {1, 2}, {0, 2}, {0, 1}, {0, 0}}; // hit the
start |
1700 | 1700 |
1701 // like c2, but we double-back on ourselves | 1701 // like c2, but we double-back on ourselves |
1702 SkPoint d1[] = {{0, 0}, {1, 0}, {1, 2}, {0, 2}, {0, 1}, {0, 2}}; | 1702 SkPoint d1[] = {{0, 0}, {1, 0}, {1, 2}, {0, 2}, {0, 1}, {0, 2}}; |
1703 // like c2, but we overshoot the start point | 1703 // like c2, but we overshoot the start point |
1704 SkPoint d2[] = {{0, 0}, {1, 0}, {1, 2}, {0, 2}, {0, -1}}; | 1704 SkPoint d2[] = {{0, 0}, {1, 0}, {1, 2}, {0, 2}, {0, -1}}; |
1705 SkPoint d3[] = {{0, 0}, {1, 0}, {1, 2}, {0, 2}, {0, -1}, {0, 0}}; | 1705 SkPoint d3[] = {{0, 0}, {1, 0}, {1, 2}, {0, 2}, {0, -1}, {0, 0}}; |
1706 | 1706 |
1707 struct IsRectTest { | 1707 struct IsRectTest { |
1708 SkPoint *fPoints; | 1708 SkPoint *fPoints; |
1709 size_t fPointCount; | 1709 int fPointCount; |
1710 bool fClose; | 1710 bool fClose; |
1711 bool fIsRect; | 1711 bool fIsRect; |
1712 } tests[] = { | 1712 } tests[] = { |
1713 { r1, SK_ARRAY_COUNT(r1), true, true }, | 1713 { r1, SK_ARRAY_COUNT(r1), true, true }, |
1714 { r2, SK_ARRAY_COUNT(r2), true, true }, | 1714 { r2, SK_ARRAY_COUNT(r2), true, true }, |
1715 { r3, SK_ARRAY_COUNT(r3), true, true }, | 1715 { r3, SK_ARRAY_COUNT(r3), true, true }, |
1716 { r4, SK_ARRAY_COUNT(r4), true, true }, | 1716 { r4, SK_ARRAY_COUNT(r4), true, true }, |
1717 { r5, SK_ARRAY_COUNT(r5), true, true }, | 1717 { r5, SK_ARRAY_COUNT(r5), true, true }, |
1718 { r6, SK_ARRAY_COUNT(r6), true, true }, | 1718 { r6, SK_ARRAY_COUNT(r6), true, true }, |
1719 { r7, SK_ARRAY_COUNT(r7), true, true }, | 1719 { r7, SK_ARRAY_COUNT(r7), true, true }, |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1882 SkPoint f6[] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 2}}; // end overshoots | 1882 SkPoint f6[] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}, {0, 2}}; // end overshoots |
1883 SkPoint f7[] = {{0, 0}, {1, 0}, {1, 1}, {0, 2}}; // end overshoots | 1883 SkPoint f7[] = {{0, 0}, {1, 0}, {1, 1}, {0, 2}}; // end overshoots |
1884 SkPoint f8[] = {{0, 0}, {1, 0}, {1, 1}, {1, 0}}; // 'L' | 1884 SkPoint f8[] = {{0, 0}, {1, 0}, {1, 1}, {1, 0}}; // 'L' |
1885 | 1885 |
1886 // failing, no close | 1886 // failing, no close |
1887 SkPoint c1[] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}}; // close doesn't match | 1887 SkPoint c1[] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}}; // close doesn't match |
1888 SkPoint c2[] = {{0, 0}, {1, 0}, {1, 2}, {0, 2}, {0, 1}}; // ditto | 1888 SkPoint c2[] = {{0, 0}, {1, 0}, {1, 2}, {0, 2}, {0, 1}}; // ditto |
1889 | 1889 |
1890 struct IsNestedRectTest { | 1890 struct IsNestedRectTest { |
1891 SkPoint *fPoints; | 1891 SkPoint *fPoints; |
1892 size_t fPointCount; | 1892 int fPointCount; |
1893 SkPath::Direction fDirection; | 1893 SkPath::Direction fDirection; |
1894 bool fClose; | 1894 bool fClose; |
1895 bool fIsNestedRect; // nests with path.addRect(-1, -1, 2, 2); | 1895 bool fIsNestedRect; // nests with path.addRect(-1, -1, 2, 2); |
1896 } tests[] = { | 1896 } tests[] = { |
1897 { r1, SK_ARRAY_COUNT(r1), SkPath::kCW_Direction , true, true }, | 1897 { r1, SK_ARRAY_COUNT(r1), SkPath::kCW_Direction , true, true }, |
1898 { r2, SK_ARRAY_COUNT(r2), SkPath::kCW_Direction , true, true }, | 1898 { r2, SK_ARRAY_COUNT(r2), SkPath::kCW_Direction , true, true }, |
1899 { r3, SK_ARRAY_COUNT(r3), SkPath::kCW_Direction , true, true }, | 1899 { r3, SK_ARRAY_COUNT(r3), SkPath::kCW_Direction , true, true }, |
1900 { r4, SK_ARRAY_COUNT(r4), SkPath::kCW_Direction , true, true }, | 1900 { r4, SK_ARRAY_COUNT(r4), SkPath::kCW_Direction , true, true }, |
1901 { r5, SK_ARRAY_COUNT(r5), SkPath::kCCW_Direction, true, true }, | 1901 { r5, SK_ARRAY_COUNT(r5), SkPath::kCCW_Direction, true, true }, |
1902 { r6, SK_ARRAY_COUNT(r6), SkPath::kCCW_Direction, true, true }, | 1902 { r6, SK_ARRAY_COUNT(r6), SkPath::kCCW_Direction, true, true }, |
(...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3723 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode); | 3723 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode); |
3724 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode); | 3724 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode); |
3725 test_conicTo_special_case(reporter); | 3725 test_conicTo_special_case(reporter); |
3726 test_get_point(reporter); | 3726 test_get_point(reporter); |
3727 test_contains(reporter); | 3727 test_contains(reporter); |
3728 PathTest_Private::TestPathTo(reporter); | 3728 PathTest_Private::TestPathTo(reporter); |
3729 PathRefTest_Private::TestPathRef(reporter); | 3729 PathRefTest_Private::TestPathRef(reporter); |
3730 test_dump(reporter); | 3730 test_dump(reporter); |
3731 test_path_crbugskia2820(reporter); | 3731 test_path_crbugskia2820(reporter); |
3732 } | 3732 } |
OLD | NEW |