aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--experimental/Intersection/AddTestOutput/main.cpp111
-rw-r--r--gyp/shapeops_demo.gyp5
-rw-r--r--gyp/shapeops_edge.gyp9
3 files changed, 125 insertions, 0 deletions
diff --git a/experimental/Intersection/AddTestOutput/main.cpp b/experimental/Intersection/AddTestOutput/main.cpp
new file mode 100644
index 0000000000..257bba0026
--- /dev/null
+++ b/experimental/Intersection/AddTestOutput/main.cpp
@@ -0,0 +1,111 @@
+#include "SkStream.h"
+#include "SkString.h"
+#include "SkTDArray.h"
+#include <stdio.h>
+
+static bool replace(const char* fun, const char* dir, const char* filename, const char* marker,
+ const char* marker2, const char* replace, size_t replaceLen) {
+ SkString outFileStr(dir);
+ outFileStr.append(filename);
+ SkFILEStream opStreamIn(outFileStr.c_str());
+ if (!opStreamIn.isValid()) {
+ SkDebugf("%s couldn't find %s\n", fun, outFileStr.c_str());
+ return false;
+ }
+ SkTDArray<char> opData;
+ opData.setCount(opStreamIn.getLength());
+ size_t opLen = opData.count();
+ opStreamIn.read(opData.begin(), opLen);
+ opStreamIn.setPath(NULL);
+ SkFILEWStream opStreamOut(outFileStr.c_str());
+ if (!opStreamOut.isValid()) {
+ SkDebugf("%s couldn't open for writing %s\n", fun, outFileStr.c_str());
+ return false;
+ }
+
+ char* opInsert = strstr(opData.begin(), marker);
+ if (!opInsert) {
+ SkDebugf("%s missing marker in %s\n", fun, outFileStr.c_str());
+ return false;
+ }
+ const char* opInsertEnd = opInsert + strlen(marker);
+ if (marker2) {
+ char* opInsert2 = strstr(opInsert, marker2);
+ if (!opInsert2) {
+ SkDebugf("%s missing marker second half in %s\n", fun, outFileStr.c_str());
+ return false;
+ }
+ opInsertEnd = opInsert2 + strlen(marker2);
+ }
+ opStreamOut.write(opData.begin(), opInsert - opData.begin());
+ opStreamOut.write(replace, replaceLen);
+ opStreamOut.write(opInsertEnd, opLen - (opInsertEnd - opData.begin()));
+ opStreamOut.flush();
+ return true;
+}
+
+int main (int argc, char * const argv[]) {
+ if (argc != 2) {
+ SkDebugf("%s expected filename\n", argv[0]);
+ return 0;
+ }
+ const char* dir = "../../experimental/Intersection/";
+ SkString inFileStr;
+ if (argv[1][0] != '/') {
+ inFileStr.append(dir);
+ }
+ inFileStr.append(argv[1]);
+ SkFILEStream inFile(inFileStr.c_str());
+ if (!inFile.isValid()) {
+ SkDebugf("%s couldn't find %s\n", argv[0], argv[1]);
+ return 0;
+ }
+ SkTDArray<char> inData;
+ inData.setCount(inFile.getLength());
+ size_t inLen = inData.count();
+ inFile.read(inData.begin(), inLen);
+ inFile.setPath(NULL);
+ char* insert = strstr(inData.begin(), "\n\n\n");
+ if (!insert) {
+ SkDebugf("%s missing two blank line delimiter in %s\n", argv[0], argv[1]);
+ return 0;
+ }
+ insert += 1; // include first blank line
+ const char opMarker[] =
+ "</div>" "\n"
+ "\n"
+ "<script type=\"text/javascript\">" "\n"
+ "\n"
+ "var testDivs = [" "\n"
+ ;
+ if (!replace(argv[0], dir, "op.htm", opMarker, NULL, inData.begin(),
+ insert - inData.begin())) {
+ return 0;
+ }
+ const char newMarker[] =
+ "static void (*firstTest)() = "
+ ;
+ const char newMarker2[] =
+ ";" "\n"
+ "\n"
+ "static struct {" "\n"
+ " void (*fun)();" "\n"
+ " const char* str;" "\n"
+ "} tests[] = {" "\n"
+ ;
+ if (!replace(argv[0], dir, "SimplifyNew_Test.cpp", newMarker, newMarker2, insert + 2,
+ inLen - (insert - inData.begin()) - 2)) {
+ return 0;
+ }
+ const char simplifyMarker[] =
+ "#if 1 // set to 1 for multiple thread -- no debugging"
+ ;
+ const char simplifyReplace[] =
+ "#if 0 // set to 1 for multiple thread -- no debugging"
+ ;
+ if (!replace(argv[0], dir, "Simplify.cpp", simplifyMarker, NULL, simplifyReplace,
+ sizeof(simplifyReplace) - 1)) {
+ return 0;
+ }
+ return 0;
+}
diff --git a/gyp/shapeops_demo.gyp b/gyp/shapeops_demo.gyp
index b7c00f3680..25ac70aba0 100644
--- a/gyp/shapeops_demo.gyp
+++ b/gyp/shapeops_demo.gyp
@@ -34,11 +34,14 @@
'../experimental/Intersection/QuadraticBezierClip.cpp',
'../experimental/Intersection/QuadraticBounds.cpp',
'../experimental/Intersection/QuadraticIntersection.cpp',
+ '../experimental/Intersection/QuadraticImplicit.cpp',
'../experimental/Intersection/QuadraticLineSegments.cpp',
'../experimental/Intersection/QuadraticParameterization.cpp',
'../experimental/Intersection/QuadraticReduceOrder.cpp',
'../experimental/Intersection/QuadraticSubDivide.cpp',
'../experimental/Intersection/QuadraticUtilities.cpp',
+ '../experimental/Intersection/QuarticRoot.cpp',
+ '../experimental/Intersection/ShapeOps.cpp',
'../experimental/Intersection/Simplify.cpp',
'../experimental/Intersection/CubicParameterization.cpp',
'../experimental/Intersection/CubicReduceOrder.cpp',
@@ -54,7 +57,9 @@
'../experimental/Intersection/LineParameters.h',
'../experimental/Intersection/LineUtilities.h',
'../experimental/Intersection/QuadraticLineSegments.h',
+ '../experimental/Intersection/QuadraticParameterization.h',
'../experimental/Intersection/QuadraticUtilities.h',
+ '../experimental/Intersection/QuarticRoot.h',
'../experimental/Intersection/ShapeOps.h',
'../experimental/Intersection/Simplify.h',
'../experimental/Intersection/TSearch.h',
diff --git a/gyp/shapeops_edge.gyp b/gyp/shapeops_edge.gyp
index 87155768bf..cc62f3e2cb 100644
--- a/gyp/shapeops_edge.gyp
+++ b/gyp/shapeops_edge.gyp
@@ -22,6 +22,7 @@
'../experimental/Intersection/CubicIntersection.cpp',
'../experimental/Intersection/CubicIntersection_Test.cpp',
'../experimental/Intersection/CubicIntersection_TestData.cpp',
+ '../experimental/Intersection/CubicLineSegments.cpp',
'../experimental/Intersection/CubicParameterization.cpp',
'../experimental/Intersection/CubicParameterization_Test.cpp',
'../experimental/Intersection/CubicParameterizationCode.cpp',
@@ -43,6 +44,7 @@
'../experimental/Intersection/Extrema.cpp',
'../experimental/Intersection/Inline_Tests.cpp',
'../experimental/Intersection/Intersection_Tests.cpp',
+ '../experimental/Intersection/Intersections.cpp',
'../experimental/Intersection/IntersectionUtilities.cpp',
'../experimental/Intersection/LineCubicIntersection.cpp',
'../experimental/Intersection/LineCubicIntersection_Test.cpp',
@@ -56,6 +58,7 @@
'../experimental/Intersection/QuadraticBezierClip.cpp',
'../experimental/Intersection/QuadraticBezierClip_Test.cpp',
'../experimental/Intersection/QuadraticBounds.cpp',
+ '../experimental/Intersection/QuadraticImplicit.cpp',
'../experimental/Intersection/QuadraticIntersection.cpp',
'../experimental/Intersection/QuadraticIntersection_Test.cpp',
'../experimental/Intersection/QuadraticIntersection_TestData.cpp',
@@ -66,6 +69,9 @@
'../experimental/Intersection/QuadraticReduceOrder_Test.cpp',
'../experimental/Intersection/QuadraticSubDivide.cpp',
'../experimental/Intersection/QuadraticUtilities.cpp',
+ '../experimental/Intersection/QuarticRoot.cpp',
+ '../experimental/Intersection/QuarticRoot_Test.cpp',
+ '../experimental/Intersection/ShapeOps.cpp',
'../experimental/Intersection/Simplify.cpp',
'../experimental/Intersection/SimplifyAddIntersectingTs_Test.cpp',
'../experimental/Intersection/SimplifyAngle_Test.cpp',
@@ -75,6 +81,7 @@
'../experimental/Intersection/SimplifyRect4x4_Test.cpp',
'../experimental/Intersection/TestUtilities.cpp',
'../experimental/Intersection/CubicIntersection_TestData.h',
+ '../experimental/Intersection/CubicLineSegments.h',
'../experimental/Intersection/CubicUtilities.h',
'../experimental/Intersection/CurveIntersection.h',
'../experimental/Intersection/CurveUtilities.h',
@@ -90,7 +97,9 @@
'../experimental/Intersection/Parameterization_Test.h',
'../experimental/Intersection/QuadraticIntersection_TestData.h',
'../experimental/Intersection/QuadraticLineSegments.h',
+ '../experimental/Intersection/QuadraticParameterization.h',
'../experimental/Intersection/QuadraticUtilities.h',
+ '../experimental/Intersection/QuarticRoot.h',
'../experimental/Intersection/ShapeOps.h',
'../experimental/Intersection/Simplify.h',
'../experimental/Intersection/TestUtilities.h',