diff options
author | caryclark <caryclark@google.com> | 2015-04-23 09:13:37 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-23 09:13:37 -0700 |
commit | 03b03cad01628146bbb8d4f33c073bd0c77ee558 (patch) | |
tree | 3daa35fc7a85abd54f6d48e23d3f8f665b677dc5 /tests/PathOpsOpCubicThreadedTest.cpp | |
parent | 4b17fa353e777de309ca8b0706f1d3e326b59822 (diff) |
working on initial winding for cubics
Path ops works well for all tests except for cubics.
Isolate failures caused by cubics, and do a better job of computing
the initial winding for cubics.
TBR=reed@google.com
BUG=skia:3588
Review URL: https://codereview.chromium.org/1096923003
Diffstat (limited to 'tests/PathOpsOpCubicThreadedTest.cpp')
-rw-r--r-- | tests/PathOpsOpCubicThreadedTest.cpp | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/tests/PathOpsOpCubicThreadedTest.cpp b/tests/PathOpsOpCubicThreadedTest.cpp index 2289ca6090..0d905c6e23 100644 --- a/tests/PathOpsOpCubicThreadedTest.cpp +++ b/tests/PathOpsOpCubicThreadedTest.cpp @@ -7,6 +7,8 @@ #include "PathOpsExtendedTest.h" #include "PathOpsThreadedCommon.h" +static int loopNo = 132; + static void testOpCubicsMain(PathOpsThreadState* data) { #if DEBUG_SHOW_TEST_NAME strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); @@ -25,30 +27,6 @@ static void testOpCubicsMain(PathOpsThreadState* data) { for (int e = SkPath::kWinding_FillType ; e <= SkPath::kEvenOdd_FillType; ++e) { for (int f = SkPath::kWinding_FillType ; f <= SkPath::kEvenOdd_FillType; ++f) { SkPath pathA, pathB; - if (progress) { - char* str = pathStr; - const int loopNo = 133; - 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"); - str += sprintf(str, " path.moveTo(%d,%d);\n", state.fA, state.fB); - str += sprintf(str, " path.cubicTo(%d,%d, %d,%d, %d,%d);\n", state.fC, state.fD, - b, a, d, c); - str += sprintf(str, " path.close();\n"); - str += sprintf(str, " pathB.setFillType(SkPath::k%s_FillType);\n", - f == SkPath::kWinding_FillType ? "Winding" : f == SkPath::kEvenOdd_FillType - ? "EvenOdd" : "?UNDEFINED"); - str += sprintf(str, " pathB.moveTo(%d,%d);\n", a, b); - 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)); pathA.cubicTo(SkIntToScalar(state.fC), SkIntToScalar(state.fD), SkIntToScalar(b), @@ -63,10 +41,39 @@ static void testOpCubicsMain(PathOpsThreadState* data) { if (progress) { outputProgress(state.fPathStr, pathStr, (SkPathOp) op); } - testThreadedPathOp(state.fReporter, pathA, pathB, (SkPathOp) op, "cubics"); + if (progress) { + char* str = pathStr; + 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"); + str += sprintf(str, " path.moveTo(%d,%d);\n", state.fA, state.fB); + str += sprintf(str, " path.cubicTo(%d,%d, %d,%d, %d,%d);\n", state.fC, state.fD, + b, a, d, c); + str += sprintf(str, " path.close();\n"); + str += sprintf(str, " pathB.setFillType(SkPath::k%s_FillType);\n", + f == SkPath::kWinding_FillType ? "Winding" : f == SkPath::kEvenOdd_FillType + ? "EvenOdd" : "?UNDEFINED"); + str += sprintf(str, " pathB.moveTo(%d,%d);\n", a, b); + 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, %s, filename);\n", + SkPathOpsDebug::OpStr((SkPathOp) op)); + str += sprintf(str, "}\n"); + } + if (!testThreadedPathOp(state.fReporter, pathA, pathB, (SkPathOp) op, "cubics")) { + if (progress) { + ++loopNo; + goto skipToNext; + } + } } } } +skipToNext: ; } } } |