From 54359294a7c9dc54802d512a5d891a35c1663392 Mon Sep 17 00:00:00 2001 From: caryclark Date: Thu, 26 Mar 2015 07:52:43 -0700 Subject: cumulative pathops patch Replace the implicit curve intersection with a geometric curve intersection. The implicit intersection proved mathematically unstable and took a long time to zero in on an answer. Use pointers instead of indices to refer to parts of curves. Indices required awkward renumbering. Unify t and point values so that small intervals can be eliminated in one pass. Break cubics up front to eliminate loops and cusps. Make the Simplify and Op code more regular and eliminate arbitrary differences. Add a builder that takes an array of paths and operators. Delete unused code. BUG=skia:3588 R=reed@google.com Review URL: https://codereview.chromium.org/1037573004 --- tests/PathOpsOpCubicThreadedTest.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests/PathOpsOpCubicThreadedTest.cpp') diff --git a/tests/PathOpsOpCubicThreadedTest.cpp b/tests/PathOpsOpCubicThreadedTest.cpp index 751ccc5f1b..6f62170495 100644 --- a/tests/PathOpsOpCubicThreadedTest.cpp +++ b/tests/PathOpsOpCubicThreadedTest.cpp @@ -27,6 +27,10 @@ static void testOpCubicsMain(PathOpsThreadState* data) { SkPath pathA, pathB; if (progress) { char* str = pathStr; + const int loopNo = 129; + str += sprintf(str, "static void cubicOp%d(skiatest::Reporter* reporter," + " const char* filename) {\n", loopNo); + str += sprintf(str, " SkPath path, pathB;\n"); str += sprintf(str, " path.setFillType(SkPath::k%s_FillType);\n", e == SkPath::kWinding_FillType ? "Winding" : e == SkPath::kEvenOdd_FillType ? "EvenOdd" : "?UNDEFINED"); @@ -41,6 +45,9 @@ static void testOpCubicsMain(PathOpsThreadState* data) { str += sprintf(str, " pathB.cubicTo(%d,%d, %d,%d, %d,%d);\n", c, d, state.fB, state.fA, state.fD, state.fC); str += sprintf(str, " pathB.close();\n"); + str += sprintf(str, " testPathOp(reporter, path, pathB, kDifference_SkPathOp," + " filename);\n"); + str += sprintf(str, "}\n"); } pathA.setFillType((SkPath::FillType) e); pathA.moveTo(SkIntToScalar(state.fA), SkIntToScalar(state.fB)); @@ -52,7 +59,7 @@ static void testOpCubicsMain(PathOpsThreadState* data) { pathB.cubicTo(SkIntToScalar(c), SkIntToScalar(d), SkIntToScalar(state.fB), SkIntToScalar(state.fA), SkIntToScalar(state.fD), SkIntToScalar(state.fC)); pathB.close(); - for (int op = 0 ; op <= kXOR_PathOp; ++op) { + for (int op = 0 ; op <= kXOR_SkPathOp; ++op) { if (progress) { outputProgress(state.fPathStr, pathStr, (SkPathOp) op); } -- cgit v1.2.3