diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-04-14 17:08:59 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-04-14 17:08:59 +0000 |
commit | 4431e7757cfcb8cfa99535eed0e9f156dabf95c2 (patch) | |
tree | f5939d4bb12b64c6953c8bae3ea684791565ca7f /tests/PathOpsCubicIntersectionTest.cpp | |
parent | 95f79261addecd8c3b4e64f2f1469f9e1aa0acb2 (diff) |
Mike R: please sanity check SkPostConfig.h
Mike K: please sanity check Test.cpp and skia_test.cpp
Feel free to look at the rest, but I don't expect any in depth review of path ops innards.
Path Ops first iteration used QuickSort to order segments radiating from an intersection to compute the winding rule.
This revision uses a circular sort instead. Breaking out the circular sort into its own long-lived structure (SkOpAngle) allows doing less work and provides a home for caching additional sorting data.
The circle sort is more stable than the former sort, has a robust ordering and fewer exceptions. It finds unsortable ordering less often. It is less reliant on the initial curve tangent, using convex hulls instead whenever it can.
Additional debug validation makes sure that the computed structures are self-consistent. A new visualization tool helps verify that the angle ordering is correct.
The 70+M tests pass with this change on Windows, Mac, Linux 32 and Linux 64 in debug and release.
R=mtklein@google.com, reed@google.com
Author: caryclark@google.com
Review URL: https://codereview.chromium.org/131103009
git-svn-id: http://skia.googlecode.com/svn/trunk@14183 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/PathOpsCubicIntersectionTest.cpp')
-rw-r--r-- | tests/PathOpsCubicIntersectionTest.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/tests/PathOpsCubicIntersectionTest.cpp b/tests/PathOpsCubicIntersectionTest.cpp index 9c82c27c91..17b3f07d3a 100644 --- a/tests/PathOpsCubicIntersectionTest.cpp +++ b/tests/PathOpsCubicIntersectionTest.cpp @@ -159,7 +159,7 @@ static const SkDCubic testSet[] = { {56.4860195, 60.529264}}}, }; -const size_t testSetCount = SK_ARRAY_COUNT(testSet); +const int testSetCount = (int) SK_ARRAY_COUNT(testSet); static const SkDCubic newTestSet[] = { {{{275,532}, {277.209137,532}, {279,530.209106}, {279,528}}}, @@ -302,7 +302,7 @@ static const SkDCubic newTestSet[] = { {{{0, 3}, {0, 1}, {2, 0}, {1, 0}}}, }; -const size_t newTestSetCount = SK_ARRAY_COUNT(newTestSet); +const int newTestSetCount = (int) SK_ARRAY_COUNT(newTestSet); static void oneOff(skiatest::Reporter* reporter, const SkDCubic& cubic1, const SkDCubic& cubic2, bool coin) { @@ -373,13 +373,13 @@ static void newOneOff(skiatest::Reporter* reporter, int outer, int inner) { } static void oneOffTests(skiatest::Reporter* reporter) { - for (size_t outer = 0; outer < testSetCount - 1; ++outer) { - for (size_t inner = outer + 1; inner < testSetCount; ++inner) { + for (int outer = 0; outer < testSetCount - 1; ++outer) { + for (int inner = outer + 1; inner < testSetCount; ++inner) { oneOff(reporter, outer, inner); } } - for (size_t outer = 0; outer < newTestSetCount - 1; ++outer) { - for (size_t inner = outer + 1; inner < newTestSetCount; ++inner) { + for (int outer = 0; outer < newTestSetCount - 1; ++outer) { + for (int inner = outer + 1; inner < newTestSetCount; ++inner) { newOneOff(reporter, outer, inner); } } @@ -550,7 +550,8 @@ static const SkDCubic selfSet[] = { {{{6.71, 3.14}, {7.99, 2.75}, {8.27, 1.96}, {6.35, 3.57}}}, {{{12.81, 7.27}, {7.22, 6.98}, {12.49, 8.97}, {11.42, 6.18}}}, }; -size_t selfSetCount = SK_ARRAY_COUNT(selfSet); + +int selfSetCount = (int) SK_ARRAY_COUNT(selfSet); static void selfOneOff(skiatest::Reporter* reporter, int index) { const SkDCubic& cubic = selfSet[index]; @@ -588,8 +589,8 @@ static void selfOneOff(skiatest::Reporter* reporter, int index) { } static void cubicIntersectionSelfTest(skiatest::Reporter* reporter) { - size_t firstFail = 0; - for (size_t index = firstFail; index < selfSetCount; ++index) { + int firstFail = 0; + for (int index = firstFail; index < selfSetCount; ++index) { selfOneOff(reporter, index); } } @@ -603,7 +604,7 @@ static const SkDCubic coinSet[] = { {{{2, 3}, {0, 4}, {3, 2}, {5, 3}}}, }; -size_t coinSetCount = SK_ARRAY_COUNT(coinSet); +static int coinSetCount = (int) SK_ARRAY_COUNT(coinSet); static void coinOneOff(skiatest::Reporter* reporter, int index) { const SkDCubic& cubic1 = coinSet[index]; @@ -612,8 +613,8 @@ static void coinOneOff(skiatest::Reporter* reporter, int index) { } static void cubicIntersectionCoinTest(skiatest::Reporter* reporter) { - size_t firstFail = 0; - for (size_t index = firstFail; index < coinSetCount; index += 2) { + int firstFail = 0; + for (int index = firstFail; index < coinSetCount; index += 2) { coinOneOff(reporter, index); } } |