blob: 0f3fadaf14b8c6961393d0c224d8afa2d830363d [file] [log] [blame]
caryclark@google.com07393ca2013-04-08 11:47:37 +00001/*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7#ifndef SkPathOpsDebug_DEFINED
8#define SkPathOpsDebug_DEFINED
9
caryclark@google.coma5e55922013-05-07 18:51:31 +000010#include "SkPathOps.h"
caryclark@google.com07393ca2013-04-08 11:47:37 +000011#include "SkTypes.h"
bungeman60e0fee2015-08-26 05:15:46 -070012
13#include <stdlib.h>
bungeman@google.comfab44db2013-10-11 18:50:45 +000014#include <stdio.h>
caryclark@google.com07393ca2013-04-08 11:47:37 +000015
Cary Clarkab87d7a2016-10-04 10:01:04 -040016enum class SkOpPhase : char;
17class SkOpContourHead;
18
caryclark@google.com07393ca2013-04-08 11:47:37 +000019#ifdef SK_RELEASE
20#define FORCE_RELEASE 1
21#else
caryclark@google.comb3f09212013-04-17 15:49:16 +000022#define FORCE_RELEASE 1 // set force release to 1 for multiple thread -- no debugging
caryclark@google.com07393ca2013-04-08 11:47:37 +000023#endif
24
caryclarkb36a3cd2016-10-18 07:59:44 -070025#define DEBUG_UNDER_DEVELOPMENT 0
caryclark27c015d2016-09-23 05:47:20 -070026
caryclark@google.com07393ca2013-04-08 11:47:37 +000027#define ONE_OFF_DEBUG 0
28#define ONE_OFF_DEBUG_MATHEMATICA 0
29
caryclark@google.comdb60de72013-04-11 12:33:23 +000030#if defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_ANDROID)
caryclark@google.com07393ca2013-04-08 11:47:37 +000031 #define SK_RAND(seed) rand()
caryclark@google.com07393ca2013-04-08 11:47:37 +000032#else
33 #define SK_RAND(seed) rand_r(&seed)
caryclark@google.comdb60de72013-04-11 12:33:23 +000034#endif
35#ifdef SK_BUILD_FOR_WIN
36 #define SK_SNPRINTF _snprintf
37#else
skia.committer@gmail.com32840172013-04-09 07:01:27 +000038 #define SK_SNPRINTF snprintf
caryclark@google.com07393ca2013-04-08 11:47:37 +000039#endif
40
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000041#define WIND_AS_STRING(x) char x##Str[12]; \
42 if (!SkPathOpsDebug::ValidWind(x)) strcpy(x##Str, "?"); \
43 else SK_SNPRINTF(x##Str, sizeof(x##Str), "%d", x)
44
caryclark@google.com07393ca2013-04-08 11:47:37 +000045#if FORCE_RELEASE
46
47#define DEBUG_ACTIVE_OP 0
48#define DEBUG_ACTIVE_SPANS 0
caryclark@google.com07393ca2013-04-08 11:47:37 +000049#define DEBUG_ADD_INTERSECTING_TS 0
caryclark54359292015-03-26 07:52:43 -070050#define DEBUG_ADD_T 0
caryclark26ad22a2015-10-16 09:03:38 -070051#define DEBUG_ALIGNMENT 0
caryclark@google.com07393ca2013-04-08 11:47:37 +000052#define DEBUG_ANGLE 0
caryclark@google.com07393ca2013-04-08 11:47:37 +000053#define DEBUG_ASSEMBLE 0
Cary Clarkab87d7a2016-10-04 10:01:04 -040054#define DEBUG_COINCIDENCE 0 // sanity checking
55#define DEBUG_COINCIDENCE_DUMP 0 // accumulate and dump which algorithms fired
56#define DEBUG_COINCIDENCE_ORDER 0 // for well behaved curves, check if pairs match up in t-order
57#define DEBUG_COINCIDENCE_VERBOSE 0 // usually whether the next function generates coincidence
commit-bot@chromium.org2db7fe72014-05-07 15:31:40 +000058#define DEBUG_CUBIC_BINARY_SEARCH 0
caryclark03b03ca2015-04-23 09:13:37 -070059#define DEBUG_CUBIC_SPLIT 0
caryclark624637c2015-05-11 07:21:27 -070060#define DEBUG_DUMP_SEGMENTS 0
Cary Clark918fb1f2016-11-15 13:22:25 -050061#define DEBUG_DUMP_VERIFY 0
caryclark@google.com07393ca2013-04-08 11:47:37 +000062#define DEBUG_FLOW 0
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +000063#define DEBUG_LIMIT_WIND_SUM 0
caryclark@google.com07393ca2013-04-08 11:47:37 +000064#define DEBUG_MARK_DONE 0
65#define DEBUG_PATH_CONSTRUCTION 0
caryclark54359292015-03-26 07:52:43 -070066#define DEBUG_PERP 0
caryclark624637c2015-05-11 07:21:27 -070067#define DEBUG_SHOW_TEST_NAME 0
caryclark@google.com07393ca2013-04-08 11:47:37 +000068#define DEBUG_SORT 0
caryclark54359292015-03-26 07:52:43 -070069#define DEBUG_T_SECT 0
70#define DEBUG_T_SECT_DUMP 0
caryclark26ad22a2015-10-16 09:03:38 -070071#define DEBUG_T_SECT_LOOP_COUNT 0
caryclark@google.com4fdbb222013-07-23 15:27:41 +000072#define DEBUG_VALIDATE 0
caryclark@google.com07393ca2013-04-08 11:47:37 +000073#define DEBUG_WINDING 0
74#define DEBUG_WINDING_AT_T 0
75
76#else
77
78#define DEBUG_ACTIVE_OP 1
79#define DEBUG_ACTIVE_SPANS 1
caryclark@google.com07393ca2013-04-08 11:47:37 +000080#define DEBUG_ADD_INTERSECTING_TS 1
caryclark54359292015-03-26 07:52:43 -070081#define DEBUG_ADD_T 1
caryclark26ad22a2015-10-16 09:03:38 -070082#define DEBUG_ALIGNMENT 0
caryclark@google.com07393ca2013-04-08 11:47:37 +000083#define DEBUG_ANGLE 1
caryclark@google.com07393ca2013-04-08 11:47:37 +000084#define DEBUG_ASSEMBLE 1
Cary Clarkff114282016-12-14 11:56:16 -050085#define DEBUG_COINCIDENCE 1
Cary Clarkab87d7a2016-10-04 10:01:04 -040086#define DEBUG_COINCIDENCE_DUMP 0
caryclark81a478c2016-09-09 09:37:57 -070087#define DEBUG_COINCIDENCE_ORDER 0 // tight arc quads may generate out-of-order coincdence spans
Cary Clarkff114282016-12-14 11:56:16 -050088#define DEBUG_COINCIDENCE_VERBOSE 1
caryclark65b427c2014-09-18 10:32:57 -070089#define DEBUG_CUBIC_BINARY_SEARCH 0
caryclark03b03ca2015-04-23 09:13:37 -070090#define DEBUG_CUBIC_SPLIT 1
Cary Clark918fb1f2016-11-15 13:22:25 -050091#define DEBUG_DUMP_VERIFY 0
caryclark03b03ca2015-04-23 09:13:37 -070092#define DEBUG_DUMP_SEGMENTS 1
caryclark@google.com07393ca2013-04-08 11:47:37 +000093#define DEBUG_FLOW 1
caryclark55888e42016-07-18 10:01:36 -070094#define DEBUG_LIMIT_WIND_SUM 15
caryclark@google.com07393ca2013-04-08 11:47:37 +000095#define DEBUG_MARK_DONE 1
96#define DEBUG_PATH_CONSTRUCTION 1
caryclark03b03ca2015-04-23 09:13:37 -070097#define DEBUG_PERP 1
caryclark@google.com03610322013-04-18 15:58:21 +000098#define DEBUG_SHOW_TEST_NAME 1
caryclark@google.com07393ca2013-04-08 11:47:37 +000099#define DEBUG_SORT 1
caryclarked0935a2015-10-22 07:23:52 -0700100#define DEBUG_T_SECT 0
caryclarke839e782016-09-15 07:48:18 -0700101#define DEBUG_T_SECT_DUMP 0 // Use 1 normally. Use 2 to number segments, 3 for script output
caryclarked0935a2015-10-22 07:23:52 -0700102#define DEBUG_T_SECT_LOOP_COUNT 0
caryclark54359292015-03-26 07:52:43 -0700103#define DEBUG_VALIDATE 1
caryclark@google.com07393ca2013-04-08 11:47:37 +0000104#define DEBUG_WINDING 1
105#define DEBUG_WINDING_AT_T 1
106
107#endif
108
caryclark54359292015-03-26 07:52:43 -0700109#ifdef SK_RELEASE
caryclark1049f122015-04-20 08:31:59 -0700110 #define SkDEBUGRELEASE(a, b) b
111 #define SkDEBUGPARAMS(...)
reed0dc4dd62015-03-24 13:55:33 -0700112#else
caryclark1049f122015-04-20 08:31:59 -0700113 #define SkDEBUGRELEASE(a, b) a
114 #define SkDEBUGPARAMS(...) , __VA_ARGS__
reed0dc4dd62015-03-24 13:55:33 -0700115#endif
caryclark54359292015-03-26 07:52:43 -0700116
caryclark27c8eb82015-07-06 11:38:33 -0700117#if DEBUG_VALIDATE == 0
118 #define PATH_OPS_DEBUG_VALIDATE_PARAMS(...)
119#else
120 #define PATH_OPS_DEBUG_VALIDATE_PARAMS(...) , __VA_ARGS__
121#endif
122
caryclark54359292015-03-26 07:52:43 -0700123#if DEBUG_T_SECT == 0
124 #define PATH_OPS_DEBUG_T_SECT_RELEASE(a, b) b
125 #define PATH_OPS_DEBUG_T_SECT_PARAMS(...)
126 #define PATH_OPS_DEBUG_T_SECT_CODE(...)
127#else
128 #define PATH_OPS_DEBUG_T_SECT_RELEASE(a, b) a
129 #define PATH_OPS_DEBUG_T_SECT_PARAMS(...) , __VA_ARGS__
130 #define PATH_OPS_DEBUG_T_SECT_CODE(...) __VA_ARGS__
131#endif
132
133#if DEBUG_T_SECT_DUMP > 1
134 extern int gDumpTSectNum;
135#endif
136
Cary Clarkab87d7a2016-10-04 10:01:04 -0400137#if DEBUG_COINCIDENCE || DEBUG_COINCIDENCE_DUMP
138 #define DEBUG_COIN 1
caryclark26ad22a2015-10-16 09:03:38 -0700139#else
Cary Clarkab87d7a2016-10-04 10:01:04 -0400140 #define DEBUG_COIN 0
141#endif
142
143#if DEBUG_COIN
144 #define DEBUG_COIN_DECLARE_ONLY_PARAMS() \
145 int lineNo, SkOpPhase phase, int iteration
146 #define DEBUG_COIN_DECLARE_PARAMS() \
147 , DEBUG_COIN_DECLARE_ONLY_PARAMS()
148 #define DEBUG_COIN_ONLY_PARAMS() \
149 __LINE__, SkOpPhase::kNoChange, 0
150 #define DEBUG_COIN_PARAMS() \
151 , DEBUG_COIN_ONLY_PARAMS()
152 #define DEBUG_ITER_ONLY_PARAMS(iteration) \
153 __LINE__, SkOpPhase::kNoChange, iteration
154 #define DEBUG_ITER_PARAMS(iteration) \
155 , DEBUG_ITER_ONLY_PARAMS(iteration)
156 #define DEBUG_PHASE_ONLY_PARAMS(phase) \
157 __LINE__, SkOpPhase::phase, 0
158 #define DEBUG_PHASE_PARAMS(phase) \
159 , DEBUG_PHASE_ONLY_PARAMS(phase)
160 #define DEBUG_SET_PHASE() \
161 this->globalState()->debugSetPhase(__func__, lineNo, phase, iteration)
162 #define DEBUG_STATIC_SET_PHASE(obj) \
163 obj->globalState()->debugSetPhase(__func__, lineNo, phase, iteration)
164#elif DEBUG_VALIDATE
165 #define DEBUG_COIN_DECLARE_ONLY_PARAMS() \
166 SkOpPhase phase
167 #define DEBUG_COIN_DECLARE_PARAMS() \
168 , DEBUG_COIN_DECLARE_ONLY_PARAMS()
169 #define DEBUG_COIN_ONLY_PARAMS() \
170 SkOpPhase::kNoChange
171 #define DEBUG_COIN_PARAMS() \
172 , DEBUG_COIN_ONLY_PARAMS()
173 #define DEBUG_ITER_ONLY_PARAMS(iteration) \
174 SkOpPhase::kNoChange
175 #define DEBUG_ITER_PARAMS(iteration) \
176 , DEBUG_ITER_ONLY_PARAMS(iteration)
177 #define DEBUG_PHASE_ONLY_PARAMS(phase) \
178 SkOpPhase::phase
179 #define DEBUG_PHASE_PARAMS(phase) \
180 , DEBUG_PHASE_ONLY_PARAMS(phase)
181 #define DEBUG_SET_PHASE() \
182 this->globalState()->debugSetPhase(phase)
183 #define DEBUG_STATIC_SET_PHASE(obj) \
184 obj->globalState()->debugSetPhase(phase)
185#else
186 #define DEBUG_COIN_DECLARE_ONLY_PARAMS()
187 #define DEBUG_COIN_DECLARE_PARAMS()
188 #define DEBUG_COIN_ONLY_PARAMS()
189 #define DEBUG_COIN_PARAMS()
190 #define DEBUG_ITER_ONLY_PARAMS(iteration)
191 #define DEBUG_ITER_PARAMS(iteration)
192 #define DEBUG_PHASE_ONLY_PARAMS(phase)
193 #define DEBUG_PHASE_PARAMS(phase)
194 #define DEBUG_SET_PHASE()
195 #define DEBUG_STATIC_SET_PHASE(obj)
caryclark26ad22a2015-10-16 09:03:38 -0700196#endif
197
caryclark1049f122015-04-20 08:31:59 -0700198#define CUBIC_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}}"
199#define CONIC_DEBUG_STR "{{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}}, %1.9g}"
200#define QUAD_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}}"
201#define LINE_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}}}"
caryclark54359292015-03-26 07:52:43 -0700202#define PT_DEBUG_STR "{{%1.9g,%1.9g}}"
203
caryclark@google.com07393ca2013-04-08 11:47:37 +0000204#define T_DEBUG_STR(t, n) #t "[" #n "]=%1.9g"
205#define TX_DEBUG_STR(t) #t "[%d]=%1.9g"
206#define CUBIC_DEBUG_DATA(c) c[0].fX, c[0].fY, c[1].fX, c[1].fY, c[2].fX, c[2].fY, c[3].fX, c[3].fY
caryclark1049f122015-04-20 08:31:59 -0700207#define CONIC_DEBUG_DATA(c, w) c[0].fX, c[0].fY, c[1].fX, c[1].fY, c[2].fX, c[2].fY, w
caryclark@google.com07393ca2013-04-08 11:47:37 +0000208#define QUAD_DEBUG_DATA(q) q[0].fX, q[0].fY, q[1].fX, q[1].fY, q[2].fX, q[2].fY
209#define LINE_DEBUG_DATA(l) l[0].fX, l[0].fY, l[1].fX, l[1].fY
caryclarkdac1d172014-06-17 05:15:38 -0700210#define PT_DEBUG_DATA(i, n) i.pt(n).asSkPoint().fX, i.pt(n).asSkPoint().fY
caryclark@google.com07393ca2013-04-08 11:47:37 +0000211
caryclark@google.com07e97fc2013-07-08 17:17:02 +0000212#ifndef DEBUG_TEST
213#define DEBUG_TEST 0
caryclark@google.coma5e55922013-05-07 18:51:31 +0000214#endif
215
caryclark@google.com570863f2013-09-16 15:55:01 +0000216#if DEBUG_SHOW_TEST_NAME
217#include "SkTLS.h"
218#endif
219
caryclark29b25632016-08-25 11:27:17 -0700220// Tests with extreme numbers may fail, but all other tests should never fail.
221#define FAIL_IF(cond) \
222 do { bool fail = (cond); SkOPASSERT(!fail); if (fail) return false; } while (false)
caryclark025b11e2016-08-25 05:21:14 -0700223
caryclark29b25632016-08-25 11:27:17 -0700224#define FAIL_WITH_NULL_IF(cond) \
225 do { bool fail = (cond); SkOPASSERT(!fail); if (fail) return nullptr; } while (false)
226
227// Some functions serve two masters: one allows the function to fail, the other expects success
228// always. If abort is true, tests with normal numbers may not fail and assert if they do so.
229// If abort is false, both normal and extreme numbers may return false without asserting.
caryclark025b11e2016-08-25 05:21:14 -0700230#define RETURN_FALSE_IF(abort, cond) \
caryclark29b25632016-08-25 11:27:17 -0700231 do { bool fail = (cond); SkOPASSERT(!(abort) || !fail); if (fail) return false; \
232 } while (false)
caryclark025b11e2016-08-25 05:21:14 -0700233
caryclark@google.com570863f2013-09-16 15:55:01 +0000234class SkPathOpsDebug {
235public:
caryclark@google.com570863f2013-09-16 15:55:01 +0000236 static const char* kLVerbStr[];
Cary Clarkab87d7a2016-10-04 10:01:04 -0400237
238#if DEBUG_COIN
caryclark26ad22a2015-10-16 09:03:38 -0700239 struct GlitchLog;
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +0000240
Cary Clarkab87d7a2016-10-04 10:01:04 -0400241 enum GlitchType {
242 kUninitialized_Glitch,
243 kAddCorruptCoin_Glitch,
244 kAddExpandedCoin_Glitch,
245 kAddExpandedFail_Glitch,
246 kAddIfCollapsed_Glitch,
247 kAddIfMissingCoin_Glitch,
248 kAddMissingCoin_Glitch,
249 kAddMissingExtend_Glitch,
250 kAddOrOverlap_Glitch,
251 kCollapsedCoin_Glitch,
252 kCollapsedDone_Glitch,
253 kCollapsedOppValue_Glitch,
254 kCollapsedSpan_Glitch,
255 kCollapsedWindValue_Glitch,
256 kCorrectEnd_Glitch,
257 kDeletedCoin_Glitch,
258 kExpandCoin_Glitch,
259 kFail_Glitch,
260 kMarkCoinEnd_Glitch,
261 kMarkCoinInsert_Glitch,
262 kMarkCoinMissing_Glitch,
263 kMarkCoinStart_Glitch,
Cary Clarkab87d7a2016-10-04 10:01:04 -0400264 kMergeMatches_Glitch,
265 kMissingCoin_Glitch,
266 kMissingDone_Glitch,
267 kMissingIntersection_Glitch,
268 kMoveMultiple_Glitch,
269 kMoveNearbyClearAll_Glitch,
270 kMoveNearbyClearAll2_Glitch,
271 kMoveNearbyMerge_Glitch,
272 kMoveNearbyMergeFinal_Glitch,
273 kMoveNearbyRelease_Glitch,
274 kMoveNearbyReleaseFinal_Glitch,
275 kReleasedSpan_Glitch,
276 kReturnFalse_Glitch,
277 kUnaligned_Glitch,
278 kUnalignedHead_Glitch,
279 kUnalignedTail_Glitch,
280 };
281
282 struct CoinDictEntry {
283 int fIteration;
284 int fLineNumber;
285 GlitchType fGlitchType;
286 const char* fFunctionName;
287 };
288
289 struct CoinDict {
290 void add(const CoinDictEntry& key);
291 void add(const CoinDict& dict);
292 void dump(const char* str, bool visitCheck) const;
293 SkTDArray<CoinDictEntry> fDict;
294 };
295
296 static CoinDict gCoinSumChangedDict;
297 static CoinDict gCoinSumVisitedDict;
298 static CoinDict gCoinVistedDict;
299#endif
300
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +0000301#if defined(SK_DEBUG) || !FORCE_RELEASE
caryclark@google.com570863f2013-09-16 15:55:01 +0000302 static int gContourID;
303 static int gSegmentID;
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +0000304#endif
caryclark@google.com570863f2013-09-16 15:55:01 +0000305
caryclark624637c2015-05-11 07:21:27 -0700306#if DEBUG_SORT
caryclark@google.com570863f2013-09-16 15:55:01 +0000307 static int gSortCountDefault;
308 static int gSortCount;
309#endif
310
311#if DEBUG_ACTIVE_OP
312 static const char* kPathOpStr[];
313#endif
314
315 static void MathematicaIze(char* str, size_t bufferSize);
316 static bool ValidWind(int winding);
317 static void WindingPrintf(int winding);
318
319#if DEBUG_SHOW_TEST_NAME
320 static void* CreateNameStr();
321 static void DeleteNameStr(void* v);
322#define DEBUG_FILENAME_STRING_LENGTH 64
323#define DEBUG_FILENAME_STRING (reinterpret_cast<char* >(SkTLS::Get(SkPathOpsDebug::CreateNameStr, \
324 SkPathOpsDebug::DeleteNameStr)))
325 static void BumpTestName(char* );
caryclark@google.com570863f2013-09-16 15:55:01 +0000326#endif
caryclark03b03ca2015-04-23 09:13:37 -0700327 static const char* OpStr(SkPathOp );
caryclark55888e42016-07-18 10:01:36 -0700328 static void ShowActiveSpans(SkOpContourHead* contourList);
caryclark19eb3b22014-07-18 05:08:14 -0700329 static void ShowOnePath(const SkPath& path, const char* name, bool includeDeclaration);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000330 static void ShowPath(const SkPath& one, const SkPath& two, SkPathOp op, const char* name);
caryclark54359292015-03-26 07:52:43 -0700331
332 static bool ChaseContains(const SkTDArray<class SkOpSpanBase*>& , const class SkOpSpanBase* );
333
Cary Clarkab87d7a2016-10-04 10:01:04 -0400334 static void CheckHealth(class SkOpContourHead* contourList);
caryclark26ad22a2015-10-16 09:03:38 -0700335
caryclark55888e42016-07-18 10:01:36 -0700336 static const class SkOpAngle* DebugAngleAngle(const class SkOpAngle*, int id);
337 static class SkOpContour* DebugAngleContour(class SkOpAngle*, int id);
338 static const class SkOpPtT* DebugAnglePtT(const class SkOpAngle*, int id);
339 static const class SkOpSegment* DebugAngleSegment(const class SkOpAngle*, int id);
340 static const class SkOpSpanBase* DebugAngleSpan(const class SkOpAngle*, int id);
caryclark54359292015-03-26 07:52:43 -0700341
caryclark55888e42016-07-18 10:01:36 -0700342 static const class SkOpAngle* DebugContourAngle(class SkOpContour*, int id);
caryclark54359292015-03-26 07:52:43 -0700343 static class SkOpContour* DebugContourContour(class SkOpContour*, int id);
344 static const class SkOpPtT* DebugContourPtT(class SkOpContour*, int id);
345 static const class SkOpSegment* DebugContourSegment(class SkOpContour*, int id);
346 static const class SkOpSpanBase* DebugContourSpan(class SkOpContour*, int id);
347
caryclark55888e42016-07-18 10:01:36 -0700348 static const class SkOpAngle* DebugCoincidenceAngle(class SkOpCoincidence*, int id);
caryclark27c8eb82015-07-06 11:38:33 -0700349 static class SkOpContour* DebugCoincidenceContour(class SkOpCoincidence*, int id);
350 static const class SkOpPtT* DebugCoincidencePtT(class SkOpCoincidence*, int id);
351 static const class SkOpSegment* DebugCoincidenceSegment(class SkOpCoincidence*, int id);
352 static const class SkOpSpanBase* DebugCoincidenceSpan(class SkOpCoincidence*, int id);
353
caryclark55888e42016-07-18 10:01:36 -0700354 static const class SkOpAngle* DebugPtTAngle(const class SkOpPtT*, int id);
caryclark54359292015-03-26 07:52:43 -0700355 static class SkOpContour* DebugPtTContour(class SkOpPtT*, int id);
356 static const class SkOpPtT* DebugPtTPtT(const class SkOpPtT*, int id);
357 static const class SkOpSegment* DebugPtTSegment(const class SkOpPtT*, int id);
358 static const class SkOpSpanBase* DebugPtTSpan(const class SkOpPtT*, int id);
359
caryclark55888e42016-07-18 10:01:36 -0700360 static const class SkOpAngle* DebugSegmentAngle(const class SkOpSegment*, int id);
caryclark54359292015-03-26 07:52:43 -0700361 static class SkOpContour* DebugSegmentContour(class SkOpSegment*, int id);
362 static const class SkOpPtT* DebugSegmentPtT(const class SkOpSegment*, int id);
363 static const class SkOpSegment* DebugSegmentSegment(const class SkOpSegment*, int id);
364 static const class SkOpSpanBase* DebugSegmentSpan(const class SkOpSegment*, int id);
365
caryclark55888e42016-07-18 10:01:36 -0700366 static const class SkOpAngle* DebugSpanAngle(const class SkOpSpanBase*, int id);
caryclark54359292015-03-26 07:52:43 -0700367 static class SkOpContour* DebugSpanContour(class SkOpSpanBase*, int id);
368 static const class SkOpPtT* DebugSpanPtT(const class SkOpSpanBase*, int id);
369 static const class SkOpSegment* DebugSpanSegment(const class SkOpSpanBase*, int id);
370 static const class SkOpSpanBase* DebugSpanSpan(const class SkOpSpanBase*, int id);
Cary Clarkab87d7a2016-10-04 10:01:04 -0400371
372#if DEBUG_COIN
373 static void DumpCoinDict();
374 static void DumpGlitchType(GlitchType );
375#endif
caryclark13260682016-10-24 05:10:14 -0700376
caryclark13260682016-10-24 05:10:14 -0700377 static bool gVeryVerbose;
378
Cary Clark918fb1f2016-11-15 13:22:25 -0500379#if DEBUG_DUMP_VERIFY
caryclark13260682016-10-24 05:10:14 -0700380 static bool gDumpOp;
381 static bool gVerifyOp;
382
383 static void DumpOp(const SkPath& one, const SkPath& two, SkPathOp op,
384 const char* testName);
385 static void DumpOp(FILE* file, const SkPath& one, const SkPath& two, SkPathOp op,
386 const char* testName);
387 static void DumpSimplify(const SkPath& path, const char* testName);
388 static void DumpSimplify(FILE* file, const SkPath& path, const char* testName);
389 static void ReportOpFail(const SkPath& one, const SkPath& two, SkPathOp op);
390 static void ReportSimplifyFail(const SkPath& path);
391 static void VerifyOp(const SkPath& one, const SkPath& two, SkPathOp op,
392 const SkPath& result);
393 static void VerifySimplify(const SkPath& path, const SkPath& result);
394#endif
395
Cary Clarkff114282016-12-14 11:56:16 -0500396#if DEBUG_ACTIVE_SPANS
397 static SkString gActiveSpans;
398#endif
399
caryclark@google.com570863f2013-09-16 15:55:01 +0000400};
401
caryclark54359292015-03-26 07:52:43 -0700402struct SkDQuad;
caryclarkdac1d172014-06-17 05:15:38 -0700403
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000404// generates tools/path_sorter.htm and path_visualizer.htm compatible data
caryclark54359292015-03-26 07:52:43 -0700405void DumpQ(const SkDQuad& quad1, const SkDQuad& quad2, int testNo);
406void DumpT(const SkDQuad& quad, double t);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000407
caryclark@google.com07393ca2013-04-08 11:47:37 +0000408#endif