Index: tests/PathOpsSimplifyTrianglesThreadedTest.cpp |
diff --git a/tests/PathOpsSimplifyTrianglesThreadedTest.cpp b/tests/PathOpsSimplifyTrianglesThreadedTest.cpp |
index 8d8feee143e1d0c8f8a0e5d67f0e6e23424bc302..671616c2b9810e535e1d2543b735ea3994cf1555 100644 |
--- a/tests/PathOpsSimplifyTrianglesThreadedTest.cpp |
+++ b/tests/PathOpsSimplifyTrianglesThreadedTest.cpp |
@@ -6,15 +6,11 @@ |
*/ |
#include "PathOpsExtendedTest.h" |
#include "PathOpsThreadedCommon.h" |
+#include "SkString.h" |
static void testSimplifyTrianglesMain(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)); |
- } |
state.fKey = "?"; |
int ax = state.fA & 0x03; |
int ay = state.fA >> 2; |
@@ -37,6 +33,7 @@ static void testSimplifyTrianglesMain(PathOpsThreadState* data) { |
if ((ex - dx) * (fy - dy) == (ey - dy) * (fx - dx)) { |
continue; |
} |
+ SkString pathStr; |
SkPath path, out; |
path.setFillType(SkPath::kWinding_FillType); |
path.moveTo(SkIntToScalar(ax), SkIntToScalar(ay)); |
@@ -47,26 +44,25 @@ static void testSimplifyTrianglesMain(PathOpsThreadState* data) { |
path.lineTo(SkIntToScalar(ex), SkIntToScalar(ey)); |
path.lineTo(SkIntToScalar(fx), SkIntToScalar(fy)); |
path.close(); |
- if (progress) { |
- 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.close();\n"); |
- str += sprintf(str, " path.moveTo(%d, %d);\n", dx, dy); |
- str += sprintf(str, " path.lineTo(%d, %d);\n", ex, ey); |
- str += sprintf(str, " path.lineTo(%d, %d);\n", fx, fy); |
- str += sprintf(str, " path.close();\n"); |
- outputProgress(state.fPathStr, pathStr, SkPath::kWinding_FillType); |
+ if (state.fReporter->verbose()) { |
+ 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.close();\n"); |
+ pathStr.appendf(" path.moveTo(%d, %d);\n", dx, dy); |
+ pathStr.appendf(" path.lineTo(%d, %d);\n", ex, ey); |
+ pathStr.appendf(" path.lineTo(%d, %d);\n", fx, fy); |
+ pathStr.appendf(" path.close();\n"); |
+ outputProgress(state.fPathStr, pathStr.c_str(), SkPath::kWinding_FillType); |
} |
ShowTestName(&state, d, e, f, 0); |
- 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); |
} |
ShowTestName(&state, d, e, f, 1); |
- testSimplify(path, true, out, state, pathStr); |
+ testSimplify(path, true, out, state, pathStr.c_str()); |
} |
} |
} |