OLD | NEW |
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 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 path.lineTo(0,1); | 1378 path.lineTo(0,1); |
1379 path.close(); | 1379 path.close(); |
1380 pathB.setFillType(SkPath::kWinding_FillType); | 1380 pathB.setFillType(SkPath::kWinding_FillType); |
1381 pathB.moveTo(0,4); | 1381 pathB.moveTo(0,4); |
1382 pathB.cubicTo(4,6, 1,0, 4,3); | 1382 pathB.cubicTo(4,6, 1,0, 4,3); |
1383 pathB.lineTo(0,4); | 1383 pathB.lineTo(0,4); |
1384 pathB.close(); | 1384 pathB.close(); |
1385 testPathOp(reporter, path, pathB, kDifference_PathOp); | 1385 testPathOp(reporter, path, pathB, kDifference_PathOp); |
1386 } | 1386 } |
1387 | 1387 |
| 1388 static void cubicOp74d(skiatest::Reporter* reporter) { |
| 1389 SkPath path, pathB; |
| 1390 path.setFillType(SkPath::kWinding_FillType); |
| 1391 path.moveTo(0,1); |
| 1392 path.cubicTo(1,5, 5,1, 5,1); |
| 1393 path.lineTo(0,1); |
| 1394 path.close(); |
| 1395 pathB.setFillType(SkPath::kWinding_FillType); |
| 1396 pathB.moveTo(1,5); |
| 1397 pathB.cubicTo(1,5, 1,0, 5,1); |
| 1398 pathB.lineTo(1,5); |
| 1399 pathB.close(); |
| 1400 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 1401 } |
| 1402 |
1388 static void cubicOp75d(skiatest::Reporter* reporter) { | 1403 static void cubicOp75d(skiatest::Reporter* reporter) { |
1389 SkPath path, pathB; | 1404 SkPath path, pathB; |
1390 path.setFillType(SkPath::kWinding_FillType); | 1405 path.setFillType(SkPath::kWinding_FillType); |
1391 path.moveTo(0,1); | 1406 path.moveTo(0,1); |
1392 path.cubicTo(0,4, 5,1, 6,4); | 1407 path.cubicTo(0,4, 5,1, 6,4); |
1393 path.lineTo(0,1); | 1408 path.lineTo(0,1); |
1394 path.close(); | 1409 path.close(); |
1395 pathB.setFillType(SkPath::kWinding_FillType); | 1410 pathB.setFillType(SkPath::kWinding_FillType); |
1396 pathB.moveTo(1,5); | 1411 pathB.moveTo(1,5); |
1397 pathB.cubicTo(4,6, 1,0, 4,0); | 1412 pathB.cubicTo(4,6, 1,0, 4,0); |
1398 pathB.lineTo(1,5); | 1413 pathB.lineTo(1,5); |
1399 pathB.close(); | 1414 pathB.close(); |
1400 testPathOp(reporter, path, pathB, kDifference_PathOp); | 1415 testPathOp(reporter, path, pathB, kDifference_PathOp); |
1401 } | 1416 } |
1402 | 1417 |
| 1418 static void cubicOp76u(skiatest::Reporter* reporter) { |
| 1419 SkPath path, pathB; |
| 1420 path.setFillType(SkPath::kWinding_FillType); |
| 1421 path.moveTo(0,1); |
| 1422 path.cubicTo(0,2, 2,0, 5,3); |
| 1423 path.close(); |
| 1424 pathB.setFillType(SkPath::kWinding_FillType); |
| 1425 pathB.moveTo(0,2); |
| 1426 pathB.cubicTo(3,5, 1,0, 2,0); |
| 1427 pathB.close(); |
| 1428 testPathOp(reporter, path, pathB, kUnion_PathOp); |
| 1429 } |
| 1430 |
1403 static void cubicOp77i(skiatest::Reporter* reporter) { | 1431 static void cubicOp77i(skiatest::Reporter* reporter) { |
1404 SkPath path, pathB; | 1432 SkPath path, pathB; |
1405 path.setFillType(SkPath::kEvenOdd_FillType); | 1433 path.setFillType(SkPath::kEvenOdd_FillType); |
1406 path.moveTo(0,1); | 1434 path.moveTo(0,1); |
1407 path.cubicTo(1,3, 2,0, 3,2); | 1435 path.cubicTo(1,3, 2,0, 3,2); |
1408 path.lineTo(0,1); | 1436 path.lineTo(0,1); |
1409 path.close(); | 1437 path.close(); |
1410 pathB.setFillType(SkPath::kEvenOdd_FillType); | 1438 pathB.setFillType(SkPath::kEvenOdd_FillType); |
1411 pathB.moveTo(0,2); | 1439 pathB.moveTo(0,2); |
1412 pathB.cubicTo(2,3, 1,0, 3,1); | 1440 pathB.cubicTo(2,3, 1,0, 3,1); |
(...skipping 10 matching lines...) Expand all Loading... |
1423 path.lineTo(1,6); | 1451 path.lineTo(1,6); |
1424 path.close(); | 1452 path.close(); |
1425 pathB.setFillType(SkPath::kEvenOdd_FillType); | 1453 pathB.setFillType(SkPath::kEvenOdd_FillType); |
1426 pathB.moveTo(0,5); | 1454 pathB.moveTo(0,5); |
1427 pathB.cubicTo(1,6, 6,1, 6,1); | 1455 pathB.cubicTo(1,6, 6,1, 6,1); |
1428 pathB.lineTo(0,5); | 1456 pathB.lineTo(0,5); |
1429 pathB.close(); | 1457 pathB.close(); |
1430 testPathOp(reporter, path, pathB, kUnion_PathOp); | 1458 testPathOp(reporter, path, pathB, kUnion_PathOp); |
1431 } | 1459 } |
1432 | 1460 |
1433 static void cubicOp79d(skiatest::Reporter* reporter) { | |
1434 SkPath path, pathB; | |
1435 path.setFillType(SkPath::kWinding_FillType); | |
1436 path.moveTo(0,2); | |
1437 path.cubicTo(0,1, 3,-0.1f, 1,0); | |
1438 path.close(); | |
1439 pathB.setFillType(SkPath::kWinding_FillType); | |
1440 pathB.moveTo(0,3); | |
1441 pathB.cubicTo(0,1, 2,0, 1,0); | |
1442 pathB.close(); | |
1443 testPathOp(reporter, path, pathB, kDifference_PathOp); | |
1444 } | |
1445 | |
1446 static void cubicOp79u(skiatest::Reporter* reporter) { | 1461 static void cubicOp79u(skiatest::Reporter* reporter) { |
1447 SkPath path, pathB; | 1462 SkPath path, pathB; |
1448 path.setFillType(SkPath::kWinding_FillType); | 1463 path.setFillType(SkPath::kWinding_FillType); |
1449 path.moveTo(0,1); | 1464 path.moveTo(0,1); |
1450 path.cubicTo(1,3, 1,0, 6,4); | 1465 path.cubicTo(1,3, 1,0, 6,4); |
1451 path.close(); | 1466 path.close(); |
1452 pathB.setFillType(SkPath::kWinding_FillType); | 1467 pathB.setFillType(SkPath::kWinding_FillType); |
1453 pathB.moveTo(0,1); | 1468 pathB.moveTo(0,1); |
1454 pathB.cubicTo(4,6, 1,0, 3,1); | 1469 pathB.cubicTo(4,6, 1,0, 3,1); |
1455 pathB.close(); | 1470 pathB.close(); |
1456 testPathOp(reporter, path, pathB, kIntersect_PathOp); | 1471 testPathOp(reporter, path, pathB, kIntersect_PathOp); |
1457 } | 1472 } |
1458 | 1473 |
1459 static void cubicOp80i(skiatest::Reporter* reporter) { | 1474 static void cubicOp80i(skiatest::Reporter* reporter) { |
1460 SkPath path, pathB; | 1475 SkPath path, pathB; |
1461 path.setFillType(SkPath::kWinding_FillType); | 1476 path.setFillType(SkPath::kWinding_FillType); |
1462 path.moveTo(0,1); | 1477 path.moveTo(0,1); |
1463 path.cubicTo(2,3, 2,1, 4,3); | 1478 path.cubicTo(2,3, 2,1, 4,3); |
1464 path.lineTo(0,1); | 1479 path.lineTo(0,1); |
1465 path.close(); | 1480 path.close(); |
1466 pathB.setFillType(SkPath::kWinding_FillType); | 1481 pathB.setFillType(SkPath::kWinding_FillType); |
1467 pathB.moveTo(1,2); | 1482 pathB.moveTo(1,2); |
1468 pathB.cubicTo(3,4, 1,0, 3,2); | 1483 pathB.cubicTo(3,4, 1,0, 3,2); |
1469 pathB.lineTo(1,2); | 1484 pathB.lineTo(1,2); |
1470 pathB.close(); | 1485 pathB.close(); |
1471 testPathOp(reporter, path, pathB, kIntersect_PathOp); | 1486 testPathOp(reporter, path, pathB, kIntersect_PathOp); |
1472 } | 1487 } |
1473 | 1488 |
| 1489 static void cubicOp81d(skiatest::Reporter* reporter) { |
| 1490 SkPath path, pathB; |
| 1491 path.setFillType(SkPath::kWinding_FillType); |
| 1492 path.moveTo(0,1); |
| 1493 path.cubicTo(4,6, 4,3, 5,4); |
| 1494 path.close(); |
| 1495 pathB.setFillType(SkPath::kWinding_FillType); |
| 1496 pathB.moveTo(3,4); |
| 1497 pathB.cubicTo(4,5, 1,0, 6,4); |
| 1498 pathB.close(); |
| 1499 testPathOp(reporter, path, pathB, kDifference_PathOp); |
| 1500 } |
| 1501 |
1474 static void cubicOp82i(skiatest::Reporter* reporter) { | 1502 static void cubicOp82i(skiatest::Reporter* reporter) { |
1475 SkPath path, pathB; | 1503 SkPath path, pathB; |
1476 path.setFillType(SkPath::kEvenOdd_FillType); | 1504 path.setFillType(SkPath::kEvenOdd_FillType); |
1477 path.moveTo(0,1); | 1505 path.moveTo(0,1); |
1478 path.cubicTo(2,3, 5,2, 3,0); | 1506 path.cubicTo(2,3, 5,2, 3,0); |
1479 path.lineTo(0,1); | 1507 path.lineTo(0,1); |
1480 path.close(); | 1508 path.close(); |
1481 pathB.setFillType(SkPath::kWinding_FillType); | 1509 pathB.setFillType(SkPath::kWinding_FillType); |
1482 pathB.moveTo(2,5); | 1510 pathB.moveTo(2,5); |
1483 pathB.cubicTo(0,3, 1,0, 3,2); | 1511 pathB.cubicTo(0,3, 1,0, 3,2); |
1484 pathB.lineTo(2,5); | 1512 pathB.lineTo(2,5); |
1485 pathB.close(); | 1513 pathB.close(); |
1486 testPathOp(reporter, path, pathB, kIntersect_PathOp); | 1514 testPathOp(reporter, path, pathB, kIntersect_PathOp); |
1487 } | 1515 } |
1488 | 1516 |
1489 static void cubicOp81d(skiatest::Reporter* reporter) { | 1517 static void cubicOp83i(skiatest::Reporter* reporter) { |
1490 SkPath path, pathB; | 1518 SkPath path, pathB; |
1491 path.setFillType(SkPath::kWinding_FillType); | 1519 path.setFillType(SkPath::kWinding_FillType); |
1492 path.moveTo(0,1); | 1520 path.moveTo(0,1); |
1493 path.cubicTo(4,6, 4,3, 5,4); | 1521 path.cubicTo(0,3, 2,1, 4,1); |
| 1522 path.lineTo(0,1); |
1494 path.close(); | 1523 path.close(); |
1495 pathB.setFillType(SkPath::kWinding_FillType); | 1524 pathB.setFillType(SkPath::kWinding_FillType); |
1496 pathB.moveTo(3,4); | 1525 pathB.moveTo(1,2); |
1497 pathB.cubicTo(4,5, 1,0, 6,4); | 1526 pathB.cubicTo(1,4, 1,0, 3,0); |
| 1527 pathB.lineTo(1,2); |
| 1528 pathB.close(); |
| 1529 testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| 1530 } |
| 1531 |
| 1532 static void cubicOp84d(skiatest::Reporter* reporter) { |
| 1533 SkPath path, pathB; |
| 1534 path.setFillType(SkPath::kWinding_FillType); |
| 1535 path.moveTo(0,4); |
| 1536 path.cubicTo(2,3, 6,3, 3,2); |
| 1537 path.close(); |
| 1538 pathB.setFillType(SkPath::kWinding_FillType); |
| 1539 pathB.moveTo(3,6); |
| 1540 pathB.cubicTo(2,3, 4,0, 3,2); |
1498 pathB.close(); | 1541 pathB.close(); |
1499 testPathOp(reporter, path, pathB, kDifference_PathOp); | 1542 testPathOp(reporter, path, pathB, kDifference_PathOp); |
1500 } | 1543 } |
1501 | 1544 |
1502 static void (*firstTest)(skiatest::Reporter* ) = cubicOp81d; | 1545 static void skpClip1(skiatest::Reporter* reporter) { |
| 1546 SkPath path; |
| 1547 path.setFillType(SkPath::kEvenOdd_FillType); |
| 1548 path.moveTo(1126.17114f, 877.171204f); |
| 1549 path.quadTo(1127.34314f, 876.000000f, 1129.00000f, 876.000000f); |
| 1550 path.lineTo(1243.00000f, 876.000000f); |
| 1551 path.quadTo(1244.65686f, 876.000000f, 1245.82886f, 877.171204f); |
| 1552 path.quadTo(1247.00000f, 878.343140f, 1247.00000f, 880.000000f); |
| 1553 path.lineTo(1247.00000f, 907.000000f); |
| 1554 path.lineTo(1246.00000f, 907.000000f); |
| 1555 path.lineTo(1246.00000f, 880.000000f); |
| 1556 path.cubicTo(1246.00000f, 878.343140f, 1244.65686f, 877.000000f, 1243.00000f
, 877.000000f); |
| 1557 path.lineTo(1129.00000f, 877.000000f); |
| 1558 path.cubicTo(1127.34314f, 877.000000f, 1126.00000f, 878.343140f, 1126.00000f
, 880.000000f); |
| 1559 path.lineTo(1126.00000f, 907.000000f); |
| 1560 path.lineTo(1125.00000f, 907.000000f); |
| 1561 path.lineTo(1125.00000f, 880.000000f); |
| 1562 path.quadTo(1125.00000f, 878.343140f, 1126.17114f, 877.171204f); |
| 1563 path.close(); |
| 1564 SkPath pathB; |
| 1565 pathB.setFillType(SkPath::kWinding_FillType); |
| 1566 pathB.moveTo(1247.00000f, 876.000000f); |
| 1567 pathB.lineTo(1231.00000f, 892.000000f); |
| 1568 pathB.lineTo(1246.00000f, 907.000000f); |
| 1569 pathB.lineTo(1247.00000f, 907.000000f); |
| 1570 pathB.lineTo(1247.00000f, 876.000000f); |
| 1571 pathB.close(); |
| 1572 testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| 1573 } |
| 1574 |
| 1575 #if 1 // FIXME: work in progress -- coincident cubic undetected |
| 1576 static void skpClip2(skiatest::Reporter* reporter) { |
| 1577 SkPath path; |
| 1578 path.setFillType(SkPath::kEvenOdd_FillType); |
| 1579 path.moveTo(134.000000f, 11414.0000f); |
| 1580 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); |
| 1582 path.lineTo(806.000000f, 11419.0000f); |
| 1583 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); |
| 1585 path.lineTo(134.000000f, 11414.0000f); |
| 1586 path.close(); |
| 1587 SkPath pathB; |
| 1588 pathB.setFillType(SkPath::kInverseWinding_FillType); |
| 1589 pathB.moveTo(132.000000f, 11415.0000f); |
| 1590 pathB.lineTo(806.000000f, 11415.0000f); |
| 1591 pathB.cubicTo(807.104553f, 11415.0000f, 808.000000f, 11415.4473f, 808.000000
f, 11416.0000f); |
| 1592 pathB.lineTo(808.000000f, 11417.0000f); |
| 1593 pathB.cubicTo(808.000000f, 11418.1045f, 807.104553f, 11419.0000f, 806.000000
f, 11419.0000f); |
| 1594 pathB.lineTo(132.000000f, 11419.0000f); |
| 1595 pathB.cubicTo(130.895432f, 11419.0000f, 130.000000f, 11418.1045f, 130.000000
f, 11417.0000f); |
| 1596 pathB.lineTo(130.000000f, 11416.0000f); |
| 1597 pathB.cubicTo(130.000000f, 11415.4473f, 130.895432f, 11415.0000f, 132.000000
f, 11415.0000f); |
| 1598 pathB.close(); |
| 1599 testPathOp(reporter, path, pathB, kIntersect_PathOp); |
| 1600 } |
| 1601 #endif |
| 1602 |
| 1603 static void (*firstTest)(skiatest::Reporter* ) = 0; |
1503 | 1604 |
1504 static struct TestDesc tests[] = { | 1605 static struct TestDesc tests[] = { |
| 1606 #if 1 // FIXME: work in progress -- coincident cubic undetected |
| 1607 TEST(skpClip2), |
| 1608 #endif |
| 1609 TEST(skpClip1), |
| 1610 TEST(cubicOp84d), |
| 1611 TEST(cubicOp83i), |
1505 TEST(cubicOp82i), | 1612 TEST(cubicOp82i), |
1506 TEST(cubicOp81d), | 1613 TEST(cubicOp81d), |
1507 TEST(cubicOp80i), | 1614 TEST(cubicOp80i), |
1508 TEST(cubicOp79u), | 1615 TEST(cubicOp79u), |
1509 TEST(cubicOp79d), | |
1510 TEST(cubicOp78u), | 1616 TEST(cubicOp78u), |
1511 TEST(cubicOp77i), | 1617 TEST(cubicOp77i), |
| 1618 TEST(cubicOp76u), |
1512 TEST(cubicOp75d), | 1619 TEST(cubicOp75d), |
| 1620 TEST(cubicOp74d), |
1513 TEST(cubicOp73d), | 1621 TEST(cubicOp73d), |
1514 TEST(cubicOp72i), | 1622 TEST(cubicOp72i), |
1515 TEST(cubicOp71d), | 1623 TEST(cubicOp71d), |
1516 TEST(skp5), | 1624 TEST(skp5), |
1517 TEST(skp4), | 1625 TEST(skp4), |
1518 TEST(skp3), | 1626 TEST(skp3), |
1519 TEST(skp2), | 1627 TEST(skp2), |
1520 TEST(skp1), | 1628 TEST(skp1), |
1521 TEST(rRect1), | 1629 TEST(rRect1), |
1522 TEST(cubicOp70d), | 1630 TEST(cubicOp70d), |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1646 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run
Reverse); | 1754 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run
Reverse); |
1647 } | 1755 } |
1648 #ifdef SK_DEBUG | 1756 #ifdef SK_DEBUG |
1649 gDebugMaxWindSum = SK_MaxS32; | 1757 gDebugMaxWindSum = SK_MaxS32; |
1650 gDebugMaxWindValue = SK_MaxS32; | 1758 gDebugMaxWindValue = SK_MaxS32; |
1651 #endif | 1759 #endif |
1652 } | 1760 } |
1653 | 1761 |
1654 #include "TestClassDef.h" | 1762 #include "TestClassDef.h" |
1655 DEFINE_TESTCLASS_SHORT(PathOpsOpTest) | 1763 DEFINE_TESTCLASS_SHORT(PathOpsOpTest) |
OLD | NEW |