dump pathops tests as hex json
Dump as hex instead of SVG to more accurately
capture pathops tests.
Use SkBits2Float to reconstruct SkScalar data.
Exclude tests with conics since, for the moment,
pathkit maps conics to quads.
R=kjlubick@google.com
Bug: skia:
Change-Id: Iba2836bde8f737f42c8da31cc26e83ce55de924a
Reviewed-on: https://skia-review.googlesource.com/146165
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Auto-Submit: Cary Clark <caryclark@skia.org>
diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp
index 39c434f..58bf508 100644
--- a/tests/PathOpsExtendedTest.cpp
+++ b/tests/PathOpsExtendedTest.cpp
@@ -495,9 +495,43 @@
"InverseWinding",
"InverseEvenOdd",
};
- SkString svg;
- SkParsePath::ToSVGString(path, &svg);
- fprintf(PathOpsDebug::gOut, " \"%s\": \"%s\",\n", pathName, svg.c_str());
+ if (PathOpsDebug::gOutputSVG) {
+ SkString svg;
+ SkParsePath::ToSVGString(path, &svg);
+ fprintf(PathOpsDebug::gOut, " \"%s\": \"%s\",\n", pathName, svg.c_str());
+ } else {
+ SkPath::RawIter iter(path);
+ SkPath::Verb verb;
+ // MOVE, LINE, QUAD, CONIC, CUBIC, CLOSE
+ const int verbConst[] = { 0, 1, 2, 3, 4, 5 };
+ const int pointIndex[] = { 0, 1, 1, 1, 1, 0 };
+ const int pointCount[] = { 1, 2, 3, 3, 4, 0 };
+ fprintf(PathOpsDebug::gOut, " \"%s\": [", pathName);
+ bool first = true;
+ do {
+ SkPoint points[4];
+ verb = iter.next(points);
+ if (SkPath::kDone_Verb == verb) {
+ break;
+ }
+ if (first) {
+ first = false;
+ } else {
+ fprintf(PathOpsDebug::gOut, ",\n ");
+ }
+ int verbIndex = (int) verb;
+ fprintf(PathOpsDebug::gOut, "[%d", verbConst[verbIndex]);
+ for (int i = pointIndex[verbIndex]; i < pointCount[verbIndex]; ++i) {
+ fprintf(PathOpsDebug::gOut, ", \"0x%08x\", \"0x%08x\"",
+ SkFloat2Bits(points[i].fX), SkFloat2Bits(points[i].fY));
+ }
+ if (SkPath::kConic_Verb == verb) {
+ fprintf(PathOpsDebug::gOut, ", \"0x%08x\"", SkFloat2Bits(iter.conicWeight()));
+ }
+ fprintf(PathOpsDebug::gOut, "]");
+ } while (SkPath::kDone_Verb != verb);
+ fprintf(PathOpsDebug::gOut, "],\n");
+ }
fprintf(PathOpsDebug::gOut, " \"fillType%s\": \"k%s_FillType\"%s", fillTypeName,
gFillTypeStrs[(int) path.getFillType()], lastField ? "\n}" : ",\n");
}
@@ -514,12 +548,28 @@
return false;
}
+static bool check_for_conics(const SkPath& path) {
+ SkPath::RawIter iter(path);
+ SkPath::Verb verb;
+ do {
+ SkPoint pts[4];
+ verb = iter.next(pts);
+ if (SkPath::kConic_Verb == verb) {
+ return true;
+ }
+ } while (SkPath::kDone_Verb != verb);
+ return false;
+}
+
static bool inner_simplify(skiatest::Reporter* reporter, const SkPath& path, const char* filename,
ExpectSuccess expectSuccess, SkipAssert skipAssert, ExpectMatch expectMatch) {
#if 0 && DEBUG_SHOW_TEST_NAME
showPathData(path);
#endif
if (PathOpsDebug::gJson) {
+ if (check_for_conics(path)) {
+ return true;
+ }
if (check_for_duplicate_names(filename)) {
return true;
}
@@ -604,6 +654,9 @@
showName(a, b, shapeOp);
#endif
if (PathOpsDebug::gJson) {
+ if (check_for_conics(a) || check_for_conics(b)) {
+ return true;
+ }
if (check_for_duplicate_names(testName)) {
return true;
}