diff options
author | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-03-28 16:20:21 +0000 |
---|---|---|
committer | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-03-28 16:20:21 +0000 |
commit | a5764233aa6b207c4169fff7fccae567a160a0fd (patch) | |
tree | 61f3d9581e178cf6c589711ef5c3b9b140448eaf /experimental/Intersection/EdgeWalkerQuadratics_Test.cpp | |
parent | d3b9fbbc48c13a1b2a664cf7e01374a44c201f51 (diff) |
first support at shape ops support for quads
git-svn-id: http://skia.googlecode.com/svn/trunk@3520 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental/Intersection/EdgeWalkerQuadratics_Test.cpp')
-rw-r--r-- | experimental/Intersection/EdgeWalkerQuadratics_Test.cpp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/experimental/Intersection/EdgeWalkerQuadratics_Test.cpp b/experimental/Intersection/EdgeWalkerQuadratics_Test.cpp new file mode 100644 index 0000000000..ab4e39b637 --- /dev/null +++ b/experimental/Intersection/EdgeWalkerQuadratics_Test.cpp @@ -0,0 +1,64 @@ +#include "EdgeWalker_Test.h" +#include "Intersection_Tests.h" + +static void testSimplifyQuadratic1() { + SkPath path, out; + path.moveTo(0, 0); + path.quadTo(1, 0, 1, 1); + path.close(); + path.moveTo(1, 0); + path.quadTo(0, 0, 0, 1); + path.close(); + testSimplify(path, true, out); +} + +static void testSimplifyQuadratic2() { + SkPath path, out; + path.moveTo(0, 0); + path.quadTo(20, 0, 20, 20); + path.close(); + path.moveTo(20, 0); + path.quadTo(0, 0, 0, 20); + path.close(); + testSimplify(path, true, out); + drawAsciiPaths(path, out, true); +} + +static void testSimplifyQuadratic3() { + SkPath path, out; + path.moveTo(0, 0); + path.quadTo(20, 0, 20, 20); + path.close(); + path.moveTo(0, 20); + path.quadTo(0, 0, 20, 0); + path.close(); + testSimplify(path, true, out); + drawAsciiPaths(path, out, true); +} + +static void (*simplifyTests[])() = { + testSimplifyQuadratic3, + testSimplifyQuadratic2, + testSimplifyQuadratic1, +}; + +static size_t simplifyTestsCount = sizeof(simplifyTests) / sizeof(simplifyTests[0]); + +static void (*firstTest)() = 0; + +void SimplifyQuadraticPaths_Test() { + size_t index = 0; + if (firstTest) { + while (index < simplifyTestsCount && simplifyTests[index] != firstTest) { + ++index; + } + } + bool firstTestComplete = false; + for ( ; index < simplifyTestsCount; ++index) { + (*simplifyTests[index])(); + if (simplifyTests[index] == testSimplifyQuadratic1) { + SkDebugf("%s last fast quad test\n", __FUNCTION__); + } + firstTestComplete = true; + } +} |