OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #include "SkAddIntersections.h" | 7 #include "SkAddIntersections.h" |
8 #include "SkOpCoincidence.h" | 8 #include "SkOpCoincidence.h" |
9 #include "SkOpEdgeBuilder.h" | 9 #include "SkOpEdgeBuilder.h" |
10 #include "SkPathOpsCommon.h" | 10 #include "SkPathOpsCommon.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 ++dumpID); | 216 ++dumpID); |
217 fprintf(file, " SkPath path;\n"); | 217 fprintf(file, " SkPath path;\n"); |
218 fprintf(file, " path.setFillType((SkPath::FillType) %d);\n", one.getFillT
ype()); | 218 fprintf(file, " path.setFillType((SkPath::FillType) %d);\n", one.getFillT
ype()); |
219 dump_path(file, one, false, true); | 219 dump_path(file, one, false, true); |
220 fprintf(file, " SkPath path1(path);\n"); | 220 fprintf(file, " SkPath path1(path);\n"); |
221 fprintf(file, " path.reset();\n"); | 221 fprintf(file, " path.reset();\n"); |
222 fprintf(file, " path.setFillType((SkPath::FillType) %d);\n", two.getFillT
ype()); | 222 fprintf(file, " path.setFillType((SkPath::FillType) %d);\n", two.getFillT
ype()); |
223 dump_path(file, two, false, true); | 223 dump_path(file, two, false, true); |
224 fprintf(file, " SkPath path2(path);\n"); | 224 fprintf(file, " SkPath path2(path);\n"); |
225 fprintf(file, " testPathOp(reporter, path1, path2, (SkPathOp) %d, filenam
e);\n", op); | 225 fprintf(file, " testPathOp(reporter, path1, path2, (SkPathOp) %d, filenam
e);\n", op); |
226 fprintf(file, "}\n"); | 226 fprintf(file, "}\n"); |
227 fclose(file); | 227 fclose(file); |
228 } | 228 } |
229 #endif | 229 #endif |
230 | 230 |
231 | 231 |
232 #if DEBUG_T_SECT_LOOP_COUNT | 232 #if DEBUG_T_SECT_LOOP_COUNT |
233 | 233 |
234 #include "SkMutex.h" | 234 #include "SkMutex.h" |
235 | 235 |
236 SK_DECLARE_STATIC_MUTEX(debugWorstLoop); | 236 static SkMutex debugWorstLoop; |
237 | 237 |
238 SkOpGlobalState debugWorstState(nullptr, nullptr SkDEBUGPARAMS(nullptr)); | 238 SkOpGlobalState debugWorstState(nullptr, nullptr SkDEBUGPARAMS(nullptr)); |
239 | 239 |
240 void ReportPathOpsDebugging() { | 240 void ReportPathOpsDebugging() { |
241 debugWorstState.debugLoopReport(); | 241 debugWorstState.debugLoopReport(); |
242 } | 242 } |
243 | 243 |
244 extern void (*gVerboseFinalize)(); | 244 extern void (*gVerboseFinalize)(); |
245 | 245 |
246 #endif | 246 #endif |
247 | 247 |
248 bool OpDebug(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result, | 248 bool OpDebug(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result, |
249 bool expectSuccess SkDEBUGPARAMS(const char* testName)) { | 249 bool expectSuccess SkDEBUGPARAMS(const char* testName)) { |
250 SkChunkAlloc allocator(4096); // FIXME: add a constant expression here, tun
e | 250 SkChunkAlloc allocator(4096); // FIXME: add a constant expression here, tun
e |
251 SkOpContour contour; | 251 SkOpContour contour; |
252 SkOpContourHead* contourList = static_cast<SkOpContourHead*>(&contour); | 252 SkOpContourHead* contourList = static_cast<SkOpContourHead*>(&contour); |
253 SkOpCoincidence coincidence; | 253 SkOpCoincidence coincidence; |
254 SkOpGlobalState globalState(&coincidence, contourList SkDEBUGPARAMS(testNam
e)); | 254 SkOpGlobalState globalState(&coincidence, contourList SkDEBUGPARAMS(testNam
e)); |
255 #if DEBUGGING_PATHOPS_FROM_HOST | 255 #if DEBUGGING_PATHOPS_FROM_HOST |
256 dump_op(one, two, op); | 256 dump_op(one, two, op); |
257 #endif | 257 #endif |
258 #if 0 && DEBUG_SHOW_TEST_NAME | 258 #if 0 && DEBUG_SHOW_TEST_NAME |
259 char* debugName = DEBUG_FILENAME_STRING; | 259 char* debugName = DEBUG_FILENAME_STRING; |
260 if (debugName && debugName[0]) { | 260 if (debugName && debugName[0]) { |
261 SkPathOpsDebug::BumpTestName(debugName); | 261 SkPathOpsDebug::BumpTestName(debugName); |
262 SkPathOpsDebug::ShowPath(one, two, op, debugName); | 262 SkPathOpsDebug::ShowPath(one, two, op, debugName); |
263 } | 263 } |
264 #endif | 264 #endif |
265 op = gOpInverse[op][one.isInverseFillType()][two.isInverseFillType()]; | 265 op = gOpInverse[op][one.isInverseFillType()][two.isInverseFillType()]; |
266 SkPath::FillType fillType = gOutInverse[op][one.isInverseFillType()][two.isI
nverseFillType()] | 266 SkPath::FillType fillType = gOutInverse[op][one.isInverseFillType()][two.isI
nverseFillType()] |
267 ? SkPath::kInverseEvenOdd_FillType : SkPath::kEvenOdd_FillType; | 267 ? SkPath::kInverseEvenOdd_FillType : SkPath::kEvenOdd_FillType; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 one.dumpHex(); | 450 one.dumpHex(); |
451 SkDebugf("two: fill=%d\n", two.getFillType()); | 451 SkDebugf("two: fill=%d\n", two.getFillType()); |
452 two.dumpHex(); | 452 two.dumpHex(); |
453 SkASSERT(0); | 453 SkASSERT(0); |
454 } | 454 } |
455 return true; | 455 return true; |
456 #else | 456 #else |
457 return OpDebug(one, two, op, result, true SkDEBUGPARAMS(nullptr)); | 457 return OpDebug(one, two, op, result, true SkDEBUGPARAMS(nullptr)); |
458 #endif | 458 #endif |
459 } | 459 } |
OLD | NEW |