Index: tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp |
diff --git a/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp b/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp |
index f2c1dfc990ffee746827250ad8304d1029863430..1ea55e24c0e9ba71e88191a3f7601617958f7098 100644 |
--- a/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp |
+++ b/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp |
@@ -6,16 +6,15 @@ |
*/ |
#include "PathOpsExtendedTest.h" |
#include "PathOpsThreadedCommon.h" |
+#include "SkString.h" |
+ |
+static int loopNo = 1; |
scroggo
2016/10/06 14:42:00
nit: gLoopNo
|
static void testSimplifyQuadralateralsMain(PathOpsThreadState* data) |
{ |
SkASSERT(data); |
PathOpsThreadState& state = *data; |
- char pathStr[1024]; |
- bool progress = state.fReporter->verbose(); // FIXME: break out into its own parameter? |
- if (progress) { |
- sk_bzero(pathStr, sizeof(pathStr)); |
- } |
+ SkString pathStr; |
int ax = state.fA & 0x03; |
int ay = state.fA >> 2; |
int bx = state.fB & 0x03; |
@@ -48,27 +47,30 @@ static void testSimplifyQuadralateralsMain(PathOpsThreadState* data) |
path.lineTo(SkIntToScalar(gx), SkIntToScalar(gy)); |
path.lineTo(SkIntToScalar(hx), SkIntToScalar(hy)); |
path.close(); |
- if (progress) { |
- // gdb: set print elements 400 |
- char* str = pathStr; |
- str += sprintf(str, " path.moveTo(%d, %d);\n", ax, ay); |
- str += sprintf(str, " path.lineTo(%d, %d);\n", bx, by); |
- str += sprintf(str, " path.lineTo(%d, %d);\n", cx, cy); |
- str += sprintf(str, " path.lineTo(%d, %d);\n", dx, dy); |
- str += sprintf(str, " path.close();\n"); |
- str += sprintf(str, " path.moveTo(%d, %d);\n", ex, ey); |
- str += sprintf(str, " path.lineTo(%d, %d);\n", fx, fy); |
- str += sprintf(str, " path.lineTo(%d, %d);\n", gx, gy); |
- str += sprintf(str, " path.lineTo(%d, %d);\n", hx, hy); |
- str += sprintf(str, " path.close();\n"); |
- outputProgress(state.fPathStr, pathStr, SkPath::kWinding_FillType); |
+ if (state.fReporter->verbose()) { |
+ pathStr.printf("static void quadralateralSimplify%d(skiatest::Reporter*" |
+ "reporter, const char* filename) {\n", loopNo); |
+ pathStr.appendf(" SkPath path;\n"); |
+ pathStr.appendf(" path.moveTo(%d, %d);\n", ax, ay); |
+ pathStr.appendf(" path.lineTo(%d, %d);\n", bx, by); |
+ pathStr.appendf(" path.lineTo(%d, %d);\n", cx, cy); |
+ pathStr.appendf(" path.lineTo(%d, %d);\n", dx, dy); |
+ pathStr.appendf(" path.close();\n"); |
+ pathStr.appendf(" path.moveTo(%d, %d);\n", ex, ey); |
+ pathStr.appendf(" path.lineTo(%d, %d);\n", fx, fy); |
+ pathStr.appendf(" path.lineTo(%d, %d);\n", gx, gy); |
+ pathStr.appendf(" path.lineTo(%d, %d);\n", hx, hy); |
+ pathStr.appendf(" path.close();\n"); |
+ pathStr.appendf(" testPathSimplify(reporter, path, filename);\n"); |
+ pathStr.appendf("}\n"); |
+ outputProgress(state.fPathStr, pathStr.c_str(), SkPath::kWinding_FillType); |
} |
- testSimplify(path, false, out, state, pathStr); |
+ testSimplify(path, false, out, state, pathStr.c_str()); |
path.setFillType(SkPath::kEvenOdd_FillType); |
- if (progress) { |
- outputProgress(state.fPathStr, pathStr, SkPath::kEvenOdd_FillType); |
+ if (state.fReporter->verbose()) { |
+ outputProgress(state.fPathStr, pathStr.c_str(), SkPath::kEvenOdd_FillType); |
} |
- testSimplify(path, true, out, state, pathStr); |
+ testSimplify(path, true, out, state, pathStr.c_str()); |
} |
} |
} |