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 21 matching lines...) Expand all Loading... |
1741 { c1, SK_ARRAY_COUNT(c1), false, true }, | 1741 { c1, SK_ARRAY_COUNT(c1), false, true }, |
1742 { c2, SK_ARRAY_COUNT(c2), false, true }, | 1742 { c2, SK_ARRAY_COUNT(c2), false, true }, |
1743 { c3, SK_ARRAY_COUNT(c3), false, true }, | 1743 { c3, SK_ARRAY_COUNT(c3), false, true }, |
1744 | 1744 |
1745 { d1, SK_ARRAY_COUNT(d1), false, false }, | 1745 { d1, SK_ARRAY_COUNT(d1), false, false }, |
1746 { d2, SK_ARRAY_COUNT(d2), false, false }, | 1746 { d2, SK_ARRAY_COUNT(d2), false, false }, |
1747 { d3, SK_ARRAY_COUNT(d3), false, false }, | 1747 { d3, SK_ARRAY_COUNT(d3), false, false }, |
1748 }; | 1748 }; |
1749 | 1749 |
1750 const size_t testCount = SK_ARRAY_COUNT(tests); | 1750 const size_t testCount = SK_ARRAY_COUNT(tests); |
1751 size_t index; | 1751 int index; |
1752 for (size_t testIndex = 0; testIndex < testCount; ++testIndex) { | 1752 for (size_t testIndex = 0; testIndex < testCount; ++testIndex) { |
1753 SkPath path; | 1753 SkPath path; |
1754 path.moveTo(tests[testIndex].fPoints[0].fX, tests[testIndex].fPoints[0].
fY); | 1754 path.moveTo(tests[testIndex].fPoints[0].fX, tests[testIndex].fPoints[0].
fY); |
1755 for (index = 1; index < tests[testIndex].fPointCount; ++index) { | 1755 for (index = 1; index < tests[testIndex].fPointCount; ++index) { |
1756 path.lineTo(tests[testIndex].fPoints[index].fX, tests[testIndex].fPo
ints[index].fY); | 1756 path.lineTo(tests[testIndex].fPoints[index].fX, tests[testIndex].fPo
ints[index].fY); |
1757 } | 1757 } |
1758 if (tests[testIndex].fClose) { | 1758 if (tests[testIndex].fClose) { |
1759 path.close(); | 1759 path.close(); |
1760 } | 1760 } |
1761 REPORTER_ASSERT(reporter, tests[testIndex].fIsRect == path.isRect(NULL))
; | 1761 REPORTER_ASSERT(reporter, tests[testIndex].fIsRect == path.isRect(NULL))
; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 REPORTER_ASSERT(reporter, direction == (SkPath::Direction) -1); | 1796 REPORTER_ASSERT(reporter, direction == (SkPath::Direction) -1); |
1797 REPORTER_ASSERT(reporter, SkPath::kNone_PathAsRect == path.asRect())
; | 1797 REPORTER_ASSERT(reporter, SkPath::kNone_PathAsRect == path.asRect())
; |
1798 REPORTER_ASSERT(reporter, SkPath::kNone_PathAsRect == path.asRect(&d
irection)); | 1798 REPORTER_ASSERT(reporter, SkPath::kNone_PathAsRect == path.asRect(&d
irection)); |
1799 REPORTER_ASSERT(reporter, direction == (SkPath::Direction) -1); | 1799 REPORTER_ASSERT(reporter, direction == (SkPath::Direction) -1); |
1800 } | 1800 } |
1801 } | 1801 } |
1802 | 1802 |
1803 // fail, close then line | 1803 // fail, close then line |
1804 SkPath path1; | 1804 SkPath path1; |
1805 path1.moveTo(r1[0].fX, r1[0].fY); | 1805 path1.moveTo(r1[0].fX, r1[0].fY); |
1806 for (index = 1; index < SK_ARRAY_COUNT(r1); ++index) { | 1806 for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) { |
1807 path1.lineTo(r1[index].fX, r1[index].fY); | 1807 path1.lineTo(r1[index].fX, r1[index].fY); |
1808 } | 1808 } |
1809 path1.close(); | 1809 path1.close(); |
1810 path1.lineTo(1, 0); | 1810 path1.lineTo(1, 0); |
1811 REPORTER_ASSERT(reporter, !path1.isRect(NULL)); | 1811 REPORTER_ASSERT(reporter, !path1.isRect(NULL)); |
1812 | 1812 |
1813 // fail, move in the middle | 1813 // fail, move in the middle |
1814 path1.reset(); | 1814 path1.reset(); |
1815 path1.moveTo(r1[0].fX, r1[0].fY); | 1815 path1.moveTo(r1[0].fX, r1[0].fY); |
1816 for (index = 1; index < SK_ARRAY_COUNT(r1); ++index) { | 1816 for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) { |
1817 if (index == 2) { | 1817 if (index == 2) { |
1818 path1.moveTo(1, .5f); | 1818 path1.moveTo(1, .5f); |
1819 } | 1819 } |
1820 path1.lineTo(r1[index].fX, r1[index].fY); | 1820 path1.lineTo(r1[index].fX, r1[index].fY); |
1821 } | 1821 } |
1822 path1.close(); | 1822 path1.close(); |
1823 REPORTER_ASSERT(reporter, !path1.isRect(NULL)); | 1823 REPORTER_ASSERT(reporter, !path1.isRect(NULL)); |
1824 | 1824 |
1825 // fail, move on the edge | 1825 // fail, move on the edge |
1826 path1.reset(); | 1826 path1.reset(); |
1827 for (index = 1; index < SK_ARRAY_COUNT(r1); ++index) { | 1827 for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) { |
1828 path1.moveTo(r1[index - 1].fX, r1[index - 1].fY); | 1828 path1.moveTo(r1[index - 1].fX, r1[index - 1].fY); |
1829 path1.lineTo(r1[index].fX, r1[index].fY); | 1829 path1.lineTo(r1[index].fX, r1[index].fY); |
1830 } | 1830 } |
1831 path1.close(); | 1831 path1.close(); |
1832 REPORTER_ASSERT(reporter, !path1.isRect(NULL)); | 1832 REPORTER_ASSERT(reporter, !path1.isRect(NULL)); |
1833 | 1833 |
1834 // fail, quad | 1834 // fail, quad |
1835 path1.reset(); | 1835 path1.reset(); |
1836 path1.moveTo(r1[0].fX, r1[0].fY); | 1836 path1.moveTo(r1[0].fX, r1[0].fY); |
1837 for (index = 1; index < SK_ARRAY_COUNT(r1); ++index) { | 1837 for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) { |
1838 if (index == 2) { | 1838 if (index == 2) { |
1839 path1.quadTo(1, .5f, 1, .5f); | 1839 path1.quadTo(1, .5f, 1, .5f); |
1840 } | 1840 } |
1841 path1.lineTo(r1[index].fX, r1[index].fY); | 1841 path1.lineTo(r1[index].fX, r1[index].fY); |
1842 } | 1842 } |
1843 path1.close(); | 1843 path1.close(); |
1844 REPORTER_ASSERT(reporter, !path1.isRect(NULL)); | 1844 REPORTER_ASSERT(reporter, !path1.isRect(NULL)); |
1845 | 1845 |
1846 // fail, cubic | 1846 // fail, cubic |
1847 path1.reset(); | 1847 path1.reset(); |
1848 path1.moveTo(r1[0].fX, r1[0].fY); | 1848 path1.moveTo(r1[0].fX, r1[0].fY); |
1849 for (index = 1; index < SK_ARRAY_COUNT(r1); ++index) { | 1849 for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) { |
1850 if (index == 2) { | 1850 if (index == 2) { |
1851 path1.cubicTo(1, .5f, 1, .5f, 1, .5f); | 1851 path1.cubicTo(1, .5f, 1, .5f, 1, .5f); |
1852 } | 1852 } |
1853 path1.lineTo(r1[index].fX, r1[index].fY); | 1853 path1.lineTo(r1[index].fX, r1[index].fY); |
1854 } | 1854 } |
1855 path1.close(); | 1855 path1.close(); |
1856 REPORTER_ASSERT(reporter, !path1.isRect(NULL)); | 1856 REPORTER_ASSERT(reporter, !path1.isRect(NULL)); |
1857 } | 1857 } |
1858 | 1858 |
1859 static void test_isNestedRects(skiatest::Reporter* reporter) { | 1859 static void test_isNestedRects(skiatest::Reporter* reporter) { |
(...skipping 22 matching lines...) Expand all 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 13 matching lines...) Expand all Loading... |
1916 { f5, SK_ARRAY_COUNT(f5), SkPath::kUnknown_Direction, true, false }, | 1916 { f5, SK_ARRAY_COUNT(f5), SkPath::kUnknown_Direction, true, false }, |
1917 { f6, SK_ARRAY_COUNT(f6), SkPath::kUnknown_Direction, true, false }, | 1917 { f6, SK_ARRAY_COUNT(f6), SkPath::kUnknown_Direction, true, false }, |
1918 { f7, SK_ARRAY_COUNT(f7), SkPath::kUnknown_Direction, true, false }, | 1918 { f7, SK_ARRAY_COUNT(f7), SkPath::kUnknown_Direction, true, false }, |
1919 { f8, SK_ARRAY_COUNT(f8), SkPath::kUnknown_Direction, true, false }, | 1919 { f8, SK_ARRAY_COUNT(f8), SkPath::kUnknown_Direction, true, false }, |
1920 | 1920 |
1921 { c1, SK_ARRAY_COUNT(c1), SkPath::kUnknown_Direction, false, false }, | 1921 { c1, SK_ARRAY_COUNT(c1), SkPath::kUnknown_Direction, false, false }, |
1922 { c2, SK_ARRAY_COUNT(c2), SkPath::kUnknown_Direction, false, false }, | 1922 { c2, SK_ARRAY_COUNT(c2), SkPath::kUnknown_Direction, false, false }, |
1923 }; | 1923 }; |
1924 | 1924 |
1925 const size_t testCount = SK_ARRAY_COUNT(tests); | 1925 const size_t testCount = SK_ARRAY_COUNT(tests); |
1926 size_t index; | 1926 int index; |
1927 for (int rectFirst = 0; rectFirst <= 1; ++rectFirst) { | 1927 for (int rectFirst = 0; rectFirst <= 1; ++rectFirst) { |
1928 for (size_t testIndex = 0; testIndex < testCount; ++testIndex) { | 1928 for (size_t testIndex = 0; testIndex < testCount; ++testIndex) { |
1929 SkPath path; | 1929 SkPath path; |
1930 if (rectFirst) { | 1930 if (rectFirst) { |
1931 path.addRect(-1, -1, 2, 2, SkPath::kCW_Direction); | 1931 path.addRect(-1, -1, 2, 2, SkPath::kCW_Direction); |
1932 } | 1932 } |
1933 path.moveTo(tests[testIndex].fPoints[0].fX, tests[testIndex].fPoints
[0].fY); | 1933 path.moveTo(tests[testIndex].fPoints[0].fX, tests[testIndex].fPoints
[0].fY); |
1934 for (index = 1; index < tests[testIndex].fPointCount; ++index) { | 1934 for (index = 1; index < tests[testIndex].fPointCount; ++index) { |
1935 path.lineTo(tests[testIndex].fPoints[index].fX, tests[testIndex]
.fPoints[index].fY); | 1935 path.lineTo(tests[testIndex].fPoints[index].fX, tests[testIndex]
.fPoints[index].fY); |
1936 } | 1936 } |
(...skipping 24 matching lines...) Expand all Loading... |
1961 REPORTER_ASSERT(reporter, expectedDirs[1] == computedDirs[1]); | 1961 REPORTER_ASSERT(reporter, expectedDirs[1] == computedDirs[1]); |
1962 } | 1962 } |
1963 } | 1963 } |
1964 | 1964 |
1965 // fail, close then line | 1965 // fail, close then line |
1966 SkPath path1; | 1966 SkPath path1; |
1967 if (rectFirst) { | 1967 if (rectFirst) { |
1968 path1.addRect(-1, -1, 2, 2, SkPath::kCW_Direction); | 1968 path1.addRect(-1, -1, 2, 2, SkPath::kCW_Direction); |
1969 } | 1969 } |
1970 path1.moveTo(r1[0].fX, r1[0].fY); | 1970 path1.moveTo(r1[0].fX, r1[0].fY); |
1971 for (index = 1; index < SK_ARRAY_COUNT(r1); ++index) { | 1971 for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) { |
1972 path1.lineTo(r1[index].fX, r1[index].fY); | 1972 path1.lineTo(r1[index].fX, r1[index].fY); |
1973 } | 1973 } |
1974 path1.close(); | 1974 path1.close(); |
1975 path1.lineTo(1, 0); | 1975 path1.lineTo(1, 0); |
1976 if (!rectFirst) { | 1976 if (!rectFirst) { |
1977 path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); | 1977 path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); |
1978 } | 1978 } |
1979 REPORTER_ASSERT(reporter, !path1.isNestedRects(NULL)); | 1979 REPORTER_ASSERT(reporter, !path1.isNestedRects(NULL)); |
1980 | 1980 |
1981 // fail, move in the middle | 1981 // fail, move in the middle |
1982 path1.reset(); | 1982 path1.reset(); |
1983 if (rectFirst) { | 1983 if (rectFirst) { |
1984 path1.addRect(-1, -1, 2, 2, SkPath::kCW_Direction); | 1984 path1.addRect(-1, -1, 2, 2, SkPath::kCW_Direction); |
1985 } | 1985 } |
1986 path1.moveTo(r1[0].fX, r1[0].fY); | 1986 path1.moveTo(r1[0].fX, r1[0].fY); |
1987 for (index = 1; index < SK_ARRAY_COUNT(r1); ++index) { | 1987 for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) { |
1988 if (index == 2) { | 1988 if (index == 2) { |
1989 path1.moveTo(1, .5f); | 1989 path1.moveTo(1, .5f); |
1990 } | 1990 } |
1991 path1.lineTo(r1[index].fX, r1[index].fY); | 1991 path1.lineTo(r1[index].fX, r1[index].fY); |
1992 } | 1992 } |
1993 path1.close(); | 1993 path1.close(); |
1994 if (!rectFirst) { | 1994 if (!rectFirst) { |
1995 path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); | 1995 path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); |
1996 } | 1996 } |
1997 REPORTER_ASSERT(reporter, !path1.isNestedRects(NULL)); | 1997 REPORTER_ASSERT(reporter, !path1.isNestedRects(NULL)); |
1998 | 1998 |
1999 // fail, move on the edge | 1999 // fail, move on the edge |
2000 path1.reset(); | 2000 path1.reset(); |
2001 if (rectFirst) { | 2001 if (rectFirst) { |
2002 path1.addRect(-1, -1, 2, 2, SkPath::kCW_Direction); | 2002 path1.addRect(-1, -1, 2, 2, SkPath::kCW_Direction); |
2003 } | 2003 } |
2004 for (index = 1; index < SK_ARRAY_COUNT(r1); ++index) { | 2004 for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) { |
2005 path1.moveTo(r1[index - 1].fX, r1[index - 1].fY); | 2005 path1.moveTo(r1[index - 1].fX, r1[index - 1].fY); |
2006 path1.lineTo(r1[index].fX, r1[index].fY); | 2006 path1.lineTo(r1[index].fX, r1[index].fY); |
2007 } | 2007 } |
2008 path1.close(); | 2008 path1.close(); |
2009 if (!rectFirst) { | 2009 if (!rectFirst) { |
2010 path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); | 2010 path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); |
2011 } | 2011 } |
2012 REPORTER_ASSERT(reporter, !path1.isNestedRects(NULL)); | 2012 REPORTER_ASSERT(reporter, !path1.isNestedRects(NULL)); |
2013 | 2013 |
2014 // fail, quad | 2014 // fail, quad |
2015 path1.reset(); | 2015 path1.reset(); |
2016 if (rectFirst) { | 2016 if (rectFirst) { |
2017 path1.addRect(-1, -1, 2, 2, SkPath::kCW_Direction); | 2017 path1.addRect(-1, -1, 2, 2, SkPath::kCW_Direction); |
2018 } | 2018 } |
2019 path1.moveTo(r1[0].fX, r1[0].fY); | 2019 path1.moveTo(r1[0].fX, r1[0].fY); |
2020 for (index = 1; index < SK_ARRAY_COUNT(r1); ++index) { | 2020 for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) { |
2021 if (index == 2) { | 2021 if (index == 2) { |
2022 path1.quadTo(1, .5f, 1, .5f); | 2022 path1.quadTo(1, .5f, 1, .5f); |
2023 } | 2023 } |
2024 path1.lineTo(r1[index].fX, r1[index].fY); | 2024 path1.lineTo(r1[index].fX, r1[index].fY); |
2025 } | 2025 } |
2026 path1.close(); | 2026 path1.close(); |
2027 if (!rectFirst) { | 2027 if (!rectFirst) { |
2028 path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); | 2028 path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); |
2029 } | 2029 } |
2030 REPORTER_ASSERT(reporter, !path1.isNestedRects(NULL)); | 2030 REPORTER_ASSERT(reporter, !path1.isNestedRects(NULL)); |
2031 | 2031 |
2032 // fail, cubic | 2032 // fail, cubic |
2033 path1.reset(); | 2033 path1.reset(); |
2034 if (rectFirst) { | 2034 if (rectFirst) { |
2035 path1.addRect(-1, -1, 2, 2, SkPath::kCW_Direction); | 2035 path1.addRect(-1, -1, 2, 2, SkPath::kCW_Direction); |
2036 } | 2036 } |
2037 path1.moveTo(r1[0].fX, r1[0].fY); | 2037 path1.moveTo(r1[0].fX, r1[0].fY); |
2038 for (index = 1; index < SK_ARRAY_COUNT(r1); ++index) { | 2038 for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) { |
2039 if (index == 2) { | 2039 if (index == 2) { |
2040 path1.cubicTo(1, .5f, 1, .5f, 1, .5f); | 2040 path1.cubicTo(1, .5f, 1, .5f, 1, .5f); |
2041 } | 2041 } |
2042 path1.lineTo(r1[index].fX, r1[index].fY); | 2042 path1.lineTo(r1[index].fX, r1[index].fY); |
2043 } | 2043 } |
2044 path1.close(); | 2044 path1.close(); |
2045 if (!rectFirst) { | 2045 if (!rectFirst) { |
2046 path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); | 2046 path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); |
2047 } | 2047 } |
2048 REPORTER_ASSERT(reporter, !path1.isNestedRects(NULL)); | 2048 REPORTER_ASSERT(reporter, !path1.isNestedRects(NULL)); |
(...skipping 1674 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 |