Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: tests/PathOpsOpTest.cpp

Issue 18058007: path ops work in progress (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: try try again Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/PathOpsLineIntersectionTest.cpp ('k') | tests/PathOpsSimplifyTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 #include "PathOpsExtendedTest.h" 7 #include "PathOpsExtendedTest.h"
8 8
9 #define TEST(name) { name, #name } 9 #define TEST(name) { name, #name }
10 10
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 SkPath path, pathB; 1137 SkPath path, pathB;
1138 path.moveTo(1,3); 1138 path.moveTo(1,3);
1139 path.cubicTo(0,1, 3,1, 2,0); 1139 path.cubicTo(0,1, 3,1, 2,0);
1140 path.close(); 1140 path.close();
1141 pathB.moveTo(1,3); 1141 pathB.moveTo(1,3);
1142 pathB.cubicTo(0,2, 3,1, 1,0); 1142 pathB.cubicTo(0,2, 3,1, 1,0);
1143 pathB.close(); 1143 pathB.close();
1144 testPathOp(reporter, path, pathB, kDifference_PathOp); 1144 testPathOp(reporter, path, pathB, kDifference_PathOp);
1145 } 1145 }
1146 1146
1147
1148 SkPathOp ops[] = { 1147 SkPathOp ops[] = {
1149 kUnion_PathOp, 1148 kUnion_PathOp,
1150 kXOR_PathOp, 1149 kXOR_PathOp,
1151 kReverseDifference_PathOp, 1150 kReverseDifference_PathOp,
1152 kXOR_PathOp, 1151 kXOR_PathOp,
1153 kReverseDifference_PathOp, 1152 kReverseDifference_PathOp,
1154 }; 1153 };
1155 1154
1156 static void rRect1(skiatest::Reporter* reporter) { 1155 static void rRect1(skiatest::Reporter* reporter) {
1157 SkScalar xA = SkFloatToScalar(0.65f); 1156 SkScalar xA = SkFloatToScalar(0.65f);
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 pathB.setFillType(SkPath::kWinding_FillType); 1564 pathB.setFillType(SkPath::kWinding_FillType);
1566 pathB.moveTo(1247.00000f, 876.000000f); 1565 pathB.moveTo(1247.00000f, 876.000000f);
1567 pathB.lineTo(1231.00000f, 892.000000f); 1566 pathB.lineTo(1231.00000f, 892.000000f);
1568 pathB.lineTo(1246.00000f, 907.000000f); 1567 pathB.lineTo(1246.00000f, 907.000000f);
1569 pathB.lineTo(1247.00000f, 907.000000f); 1568 pathB.lineTo(1247.00000f, 907.000000f);
1570 pathB.lineTo(1247.00000f, 876.000000f); 1569 pathB.lineTo(1247.00000f, 876.000000f);
1571 pathB.close(); 1570 pathB.close();
1572 testPathOp(reporter, path, pathB, kIntersect_PathOp); 1571 testPathOp(reporter, path, pathB, kIntersect_PathOp);
1573 } 1572 }
1574 1573
1575 #if 1 // FIXME: work in progress -- coincident cubic undetected
1576 static void skpClip2(skiatest::Reporter* reporter) { 1574 static void skpClip2(skiatest::Reporter* reporter) {
1577 SkPath path; 1575 SkPath path;
1578 path.setFillType(SkPath::kEvenOdd_FillType); 1576 path.setFillType(SkPath::kEvenOdd_FillType);
1579 path.moveTo(134.000000f, 11414.0000f); 1577 path.moveTo(134.000000f, 11414.0000f);
1580 path.cubicTo(131.990234f, 11414.0000f, 130.326660f, 11415.4824f, 130.042755f , 11417.4131f); 1578 path.cubicTo(131.990234f, 11414.0000f, 130.326660f, 11415.4824f, 130.042755f , 11417.4131f);
1581 path.cubicTo(130.233124f, 11418.3193f, 131.037079f, 11419.0000f, 132.000000f , 11419.0000f); 1579 path.cubicTo(130.233124f, 11418.3193f, 131.037079f, 11419.0000f, 132.000000f , 11419.0000f);
1582 path.lineTo(806.000000f, 11419.0000f); 1580 path.lineTo(806.000000f, 11419.0000f);
1583 path.cubicTo(806.962891f, 11419.0000f, 807.766907f, 11418.3193f, 807.957275f , 11417.4131f); 1581 path.cubicTo(806.962891f, 11419.0000f, 807.766907f, 11418.3193f, 807.957275f , 11417.4131f);
1584 path.cubicTo(807.673401f, 11415.4824f, 806.009766f, 11414.0000f, 804.000000f , 11414.0000f); 1582 path.cubicTo(807.673401f, 11415.4824f, 806.009766f, 11414.0000f, 804.000000f , 11414.0000f);
1585 path.lineTo(134.000000f, 11414.0000f); 1583 path.lineTo(134.000000f, 11414.0000f);
1586 path.close(); 1584 path.close();
1587 SkPath pathB; 1585 SkPath pathB;
1588 pathB.setFillType(SkPath::kInverseWinding_FillType); 1586 pathB.setFillType(SkPath::kInverseWinding_FillType);
1589 pathB.moveTo(132.000000f, 11415.0000f); 1587 pathB.moveTo(132.000000f, 11415.0000f);
1590 pathB.lineTo(806.000000f, 11415.0000f); 1588 pathB.lineTo(806.000000f, 11415.0000f);
1591 pathB.cubicTo(807.104553f, 11415.0000f, 808.000000f, 11415.4473f, 808.000000 f, 11416.0000f); 1589 pathB.cubicTo(807.104553f, 11415.0000f, 808.000000f, 11415.4473f, 808.000000 f, 11416.0000f);
1592 pathB.lineTo(808.000000f, 11417.0000f); 1590 pathB.lineTo(808.000000f, 11417.0000f);
1593 pathB.cubicTo(808.000000f, 11418.1045f, 807.104553f, 11419.0000f, 806.000000 f, 11419.0000f); 1591 pathB.cubicTo(808.000000f, 11418.1045f, 807.104553f, 11419.0000f, 806.000000 f, 11419.0000f);
1594 pathB.lineTo(132.000000f, 11419.0000f); 1592 pathB.lineTo(132.000000f, 11419.0000f);
1595 pathB.cubicTo(130.895432f, 11419.0000f, 130.000000f, 11418.1045f, 130.000000 f, 11417.0000f); 1593 pathB.cubicTo(130.895432f, 11419.0000f, 130.000000f, 11418.1045f, 130.000000 f, 11417.0000f);
1596 pathB.lineTo(130.000000f, 11416.0000f); 1594 pathB.lineTo(130.000000f, 11416.0000f);
1597 pathB.cubicTo(130.000000f, 11415.4473f, 130.895432f, 11415.0000f, 132.000000 f, 11415.0000f); 1595 pathB.cubicTo(130.000000f, 11415.4473f, 130.895432f, 11415.0000f, 132.000000 f, 11415.0000f);
1598 pathB.close(); 1596 pathB.close();
1599 testPathOp(reporter, path, pathB, kIntersect_PathOp); 1597 testPathOp(reporter, path, pathB, kIntersect_PathOp);
1600 } 1598 }
1599
1600 static void skp96prezzi1(skiatest::Reporter* reporter) {
1601 SkPath path;
1602 path.setFillType(SkPath::kEvenOdd_FillType);
1603 path.moveTo(157.464005f, 670.463989f);
1604 path.quadTo(158.928925f, 669.000000f, 161.000000f, 669.000000f);
1605 path.lineTo(248.000000f, 669.000000f);
1606 path.quadTo(250.071075f, 669.000000f, 251.535995f, 670.463989f);
1607 path.quadTo(253.000000f, 671.928955f, 253.000000f, 674.000000f);
1608 path.lineTo(253.000000f, 706.000000f);
1609 path.lineTo(251.000000f, 706.000000f);
1610 path.lineTo(251.000000f, 675.000000f);
1611 path.cubicTo(251.000000f, 672.790833f, 249.209137f, 671.000000f, 247.000000f , 671.000000f);
1612 path.lineTo(162.000000f, 671.000000f);
1613 path.cubicTo(159.790863f, 671.000000f, 158.000000f, 672.790833f, 158.000000f , 675.000000f);
1614 path.lineTo(158.000000f, 706.000000f);
1615 path.lineTo(156.000000f, 706.000000f);
1616 path.lineTo(156.000000f, 674.000000f);
1617 path.quadTo(156.000000f, 671.928955f, 157.464005f, 670.463989f);
1618 path.close();
1619 SkPath pathB;
1620 pathB.setFillType(SkPath::kWinding_FillType);
1621 pathB.moveTo(156.000000f, 669.000000f);
1622 pathB.lineTo(178.500000f, 691.500000f);
1623 pathB.lineTo(230.500000f, 691.500000f);
1624 pathB.lineTo(253.000000f, 669.000000f);
1625 pathB.lineTo(156.000000f, 669.000000f);
1626 pathB.close();
1627 testPathOp(reporter, path, pathB, kIntersect_PathOp);
1628 }
1629
1630 static void skpancestry_com1(skiatest::Reporter* reporter) {
1631 SkPath path;
1632 path.setFillType(SkPath::kEvenOdd_FillType);
1633 path.moveTo(161.000000f, 925.000000f);
1634 path.cubicTo(159.874390f, 925.000000f, 158.835663f, 925.371948f, 158.000000f , 925.999634f);
1635 path.lineTo(158.000000f, 926.000000f);
1636 path.lineTo(1108.00000f, 926.000000f);
1637 path.lineTo(1108.00000f, 925.999634f);
1638 path.cubicTo(1107.16443f, 925.371948f, 1106.12561f, 925.000000f, 1105.00000f , 925.000000f);
1639 path.lineTo(161.000000f, 925.000000f);
1640 path.close();
1641 SkPath pathB;
1642 pathB.setFillType(SkPath::kEvenOdd_FillType);
1643 pathB.moveTo(161.000000f, 926.000000f);
1644 pathB.lineTo(1105.00000f, 926.000000f);
1645 pathB.cubicTo(1107.20911f, 926.000000f, 1109.00000f, 927.790833f, 1109.00000 f, 930.000000f);
1646 pathB.lineTo(1109.00000f, 956.000000f);
1647 pathB.cubicTo(1109.00000f, 958.209167f, 1107.20911f, 960.000000f, 1105.00000 f, 960.000000f);
1648 pathB.lineTo(161.000000f, 960.000000f);
1649 pathB.cubicTo(158.790863f, 960.000000f, 157.000000f, 958.209167f, 157.000000 f, 956.000000f);
1650 pathB.lineTo(157.000000f, 930.000000f);
1651 pathB.cubicTo(157.000000f, 927.790833f, 158.790863f, 926.000000f, 161.000000 f, 926.000000f);
1652 pathB.close();
1653 testPathOp(reporter, path, pathB, kIntersect_PathOp);
1654 }
1655
1656 static void skpeldorado_com_ua1(skiatest::Reporter* reporter) {
1657 SkPath path;
1658 path.setFillType(SkPath::kEvenOdd_FillType);
1659 path.moveTo(286.695129f, 291.000000f);
1660 path.lineTo(229.304855f, 561.000000f);
1661 path.lineTo(979.304871f, 561.000000f);
1662 path.lineTo(1036.69507f, 291.000000f);
1663 path.lineTo(286.695129f, 291.000000f);
1664 path.close();
1665 SkPath pathB;
1666 pathB.setFillType(SkPath::kWinding_FillType);
1667 pathB.moveTo(1006.69513f, 291.000000f);
1668 pathB.cubicTo(1023.26367f, 291.000000f, 1033.84021f, 304.431458f, 1030.31836 f, 321.000000f);
1669 pathB.lineTo(985.681519f, 531.000000f);
1670 pathB.cubicTo(982.159790f, 547.568542f, 965.873413f, 561.000000f, 949.304871 f, 561.000000f);
1671 pathB.lineTo(259.304871f, 561.000000f);
1672 pathB.cubicTo(242.736313f, 561.000000f, 232.159805f, 547.568542f, 235.681549 f, 531.000000f);
1673 pathB.lineTo(280.318420f, 321.000000f);
1674 pathB.cubicTo(283.840179f, 304.431458f, 300.126587f, 291.000000f, 316.695129 f, 291.000000f);
1675 pathB.lineTo(1006.69513f, 291.000000f);
1676 pathB.close();
1677 testPathOp(reporter, path, pathB, kIntersect_PathOp);
1678 }
1679
1680 static void skpbyte_com1(skiatest::Reporter* reporter) {
1681 SkPath path;
1682 path.setFillType(SkPath::kEvenOdd_FillType);
1683 path.moveTo(968.000000f, 14.0000000f);
1684 path.cubicTo(965.238586f, 14.0000000f, 963.000000f, 16.2385769f, 963.000000f , 19.0000000f);
1685 path.lineTo(963.000000f, 32.0000000f);
1686 path.cubicTo(963.000000f, 34.7614250f, 965.238586f, 37.0000000f, 968.000000f , 37.0000000f);
1687 path.lineTo(1034.00000f, 37.0000000f);
1688 path.cubicTo(1036.76147f, 37.0000000f, 1039.00000f, 34.7614250f, 1039.00000f , 32.0000000f);
1689 path.lineTo(1039.00000f, 19.0000000f);
1690 path.cubicTo(1039.00000f, 16.2385769f, 1036.76147f, 14.0000000f, 1034.00000f , 14.0000000f);
1691 path.lineTo(968.000000f, 14.0000000f);
1692 path.close();
1693 SkPath pathB;
1694 pathB.setFillType(SkPath::kInverseWinding_FillType);
1695 pathB.moveTo(968.000000f, 14.0000000f);
1696 pathB.lineTo(1034.00000f, 14.0000000f);
1697 pathB.cubicTo(1036.76147f, 14.0000000f, 1039.00000f, 16.2385750f, 1039.00000 f, 19.0000000f);
1698 pathB.lineTo(1039.00000f, 32.0000000f);
1699 pathB.cubicTo(1039.00000f, 34.2091408f, 1036.76147f, 36.0000000f, 1034.00000 f, 36.0000000f);
1700 pathB.lineTo(968.000000f, 36.0000000f);
1701 pathB.cubicTo(965.238586f, 36.0000000f, 963.000000f, 34.2091408f, 963.000000 f, 32.0000000f);
1702 pathB.lineTo(963.000000f, 19.0000000f);
1703 pathB.cubicTo(963.000000f, 16.2385750f, 965.238586f, 14.0000000f, 968.000000 f, 14.0000000f);
1704 pathB.close();
1705 testPathOp(reporter, path, pathB, kIntersect_PathOp);
1706 }
1707
1708 static void skphealth_com76(skiatest::Reporter* reporter) {
1709 SkPath path;
1710 path.setFillType(SkPath::kEvenOdd_FillType);
1711 path.moveTo(708.099182f, 7.09919119f);
1712 path.lineTo(708.099182f, 7.09920025f);
1713 path.quadTo(704.000000f, 11.2010098f, 704.000000f, 17.0000000f);
1714 path.lineTo(704.000000f, 33.0000000f);
1715 path.lineTo(705.000000f, 33.0000000f);
1716 path.lineTo(705.000000f, 17.0000000f);
1717 path.cubicTo(705.000000f, 13.4101496f, 706.455078f, 10.1601505f, 708.807617f , 7.80761385f);
1718 path.lineTo(708.099182f, 7.09919119f);
1719 path.close();
1720 SkPath pathB;
1721 pathB.setFillType(SkPath::kWinding_FillType);
1722 pathB.moveTo(704.000000f, 3.00000000f);
1723 #if 0
1724 pathB.lineTo(719.500000f, 3.00000000f);
1725 pathB.lineTo(705.000000f, 33.0000000f);
1726 pathB.lineTo(704.000000f, 33.0000000f);
1727 testPathOp(reporter, path, pathB, kIntersect_PathOp);
1728 #else
1729 pathB.lineTo(704.000000f, 33.0000000f);
1730 pathB.lineTo(705.000000f, 33.0000000f);
1731 pathB.lineTo(719.500000f, 3.00000000f);
1732 testPathOp(reporter, path, pathB, kIntersect_PathOp);
1601 #endif 1733 #endif
1734 }
1602 1735
1603 static void (*firstTest)(skiatest::Reporter* ) = 0; 1736 static void (*firstTest)(skiatest::Reporter* ) = 0;
1604 1737
1605 static struct TestDesc tests[] = { 1738 static struct TestDesc tests[] = {
1606 #if 1 // FIXME: work in progress -- coincident cubic undetected 1739 TEST(skphealth_com76),
1740 TEST(skpancestry_com1),
1741 TEST(skpbyte_com1),
1742 TEST(skpeldorado_com_ua1),
1743 TEST(skp96prezzi1),
1607 TEST(skpClip2), 1744 TEST(skpClip2),
1608 #endif
1609 TEST(skpClip1), 1745 TEST(skpClip1),
1610 TEST(cubicOp84d), 1746 TEST(cubicOp84d),
1611 TEST(cubicOp83i), 1747 TEST(cubicOp83i),
1612 TEST(cubicOp82i), 1748 TEST(cubicOp82i),
1613 TEST(cubicOp81d), 1749 TEST(cubicOp81d),
1614 TEST(cubicOp80i), 1750 TEST(cubicOp80i),
1615 TEST(cubicOp79u), 1751 TEST(cubicOp79u),
1616 TEST(cubicOp78u), 1752 TEST(cubicOp78u),
1617 TEST(cubicOp77i), 1753 TEST(cubicOp77i),
1618 TEST(cubicOp76u), 1754 TEST(cubicOp76u),
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1739 1875
1740 static bool runSubTestsFirst = false; 1876 static bool runSubTestsFirst = false;
1741 static bool runReverse = false; 1877 static bool runReverse = false;
1742 static void (*stopTest)(skiatest::Reporter* ) = 0; 1878 static void (*stopTest)(skiatest::Reporter* ) = 0;
1743 1879
1744 static void PathOpsOpTest(skiatest::Reporter* reporter) { 1880 static void PathOpsOpTest(skiatest::Reporter* reporter) {
1745 #ifdef SK_DEBUG 1881 #ifdef SK_DEBUG
1746 gDebugMaxWindSum = 4; 1882 gDebugMaxWindSum = 4;
1747 gDebugMaxWindValue = 4; 1883 gDebugMaxWindValue = 4;
1748 #endif 1884 #endif
1885 #if DEBUG_SHOW_TEST_NAME
1886 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
1887 #endif
1749 if (runSubTestsFirst) { 1888 if (runSubTestsFirst) {
1750 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run Reverse); 1889 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run Reverse);
1751 } 1890 }
1752 RunTestSet(reporter, tests, testCount, firstTest, stopTest, runReverse); 1891 RunTestSet(reporter, tests, testCount, firstTest, stopTest, runReverse);
1753 if (!runSubTestsFirst) { 1892 if (!runSubTestsFirst) {
1754 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run Reverse); 1893 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run Reverse);
1755 } 1894 }
1756 #ifdef SK_DEBUG 1895 #ifdef SK_DEBUG
1757 gDebugMaxWindSum = SK_MaxS32; 1896 gDebugMaxWindSum = SK_MaxS32;
1758 gDebugMaxWindValue = SK_MaxS32; 1897 gDebugMaxWindValue = SK_MaxS32;
1759 #endif 1898 #endif
1760 } 1899 }
1761 1900
1762 #include "TestClassDef.h" 1901 #include "TestClassDef.h"
1763 DEFINE_TESTCLASS_SHORT(PathOpsOpTest) 1902 DEFINE_TESTCLASS_SHORT(PathOpsOpTest)
OLDNEW
« no previous file with comments | « tests/PathOpsLineIntersectionTest.cpp ('k') | tests/PathOpsSimplifyTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698