blob: de6c10e61c8281d05992b2c1bc1e486c38587940 [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
Mike Kleinc0bd9f92019-04-23 12:05:21 -050010#include "include/core/SkString.h"
11#include "include/core/SkTypes.h"
12#include "include/pathops/SkPathOps.h"
bungeman60e0fee2015-08-26 05:15:46 -070013
14#include <stdlib.h>
bungeman@google.comfab44db2013-10-11 18:50:45 +000015#include <stdio.h>
caryclark@google.com07393ca2013-04-08 11:47:37 +000016
Cary Clarkab87d7a2016-10-04 10:01:04 -040017enum class SkOpPhase : char;
Cary Clarkb8421ed2018-03-14 15:55:02 -040018struct SkDQuad;
19class SkOpAngle;
20class SkOpCoincidence;
21class SkOpContour;
Cary Clarkab87d7a2016-10-04 10:01:04 -040022class SkOpContourHead;
Cary Clarkb8421ed2018-03-14 15:55:02 -040023class SkOpPtT;
24class SkOpSegment;
25class SkOpSpan;
26class SkOpSpanBase;
27struct SkDPoint;
28struct SkDLine;
29struct SkDQuad;
30struct SkDConic;
31struct SkDCubic;
Cary Clark8762fb62018-10-16 16:06:24 -040032class SkTSect;
Cary Clarkb8421ed2018-03-14 15:55:02 -040033
Cary Clark4929a4a2018-10-17 14:12:41 -040034// define this when running fuzz
Kevin Lubick493f89e2020-09-14 08:37:35 -040035// #define SK_BUILD_FOR_FUZZER
Cary Clark4929a4a2018-10-17 14:12:41 -040036
Leon Scroggins III577536a2020-07-31 13:47:50 -040037// fake classes to fool msvs Visual Studio 2018 Immediate Window
38#define FakeClasses(a, b) \
Cary Clarkb8421ed2018-03-14 15:55:02 -040039class SkDebugTCoincident##a##b; \
40class SkDebugTSect##a##b; \
41class SkDebugTSpan##a##b
42
Leon Scroggins III577536a2020-07-31 13:47:50 -040043FakeClasses(Quad, Quad);
44FakeClasses(Conic, Quad);
45FakeClasses(Conic, Conic);
46FakeClasses(Cubic, Quad);
47FakeClasses(Cubic, Conic);
48FakeClasses(Cubic, Cubic);
Cary Clarkb8421ed2018-03-14 15:55:02 -040049
Leon Scroggins III577536a2020-07-31 13:47:50 -040050#undef FakeClasses
Cary Clarkab87d7a2016-10-04 10:01:04 -040051
caryclark@google.com07393ca2013-04-08 11:47:37 +000052#ifdef SK_RELEASE
53#define FORCE_RELEASE 1
54#else
caryclark@google.comb3f09212013-04-17 15:49:16 +000055#define FORCE_RELEASE 1 // set force release to 1 for multiple thread -- no debugging
caryclark@google.com07393ca2013-04-08 11:47:37 +000056#endif
57
caryclarkb36a3cd2016-10-18 07:59:44 -070058#define DEBUG_UNDER_DEVELOPMENT 0
caryclark27c015d2016-09-23 05:47:20 -070059
caryclark@google.com07393ca2013-04-08 11:47:37 +000060#define ONE_OFF_DEBUG 0
61#define ONE_OFF_DEBUG_MATHEMATICA 0
62
caryclark@google.comdb60de72013-04-11 12:33:23 +000063#if defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_ANDROID)
caryclark@google.com07393ca2013-04-08 11:47:37 +000064 #define SK_RAND(seed) rand()
caryclark@google.com07393ca2013-04-08 11:47:37 +000065#else
66 #define SK_RAND(seed) rand_r(&seed)
caryclark@google.comdb60de72013-04-11 12:33:23 +000067#endif
68#ifdef SK_BUILD_FOR_WIN
69 #define SK_SNPRINTF _snprintf
70#else
skia.committer@gmail.com32840172013-04-09 07:01:27 +000071 #define SK_SNPRINTF snprintf
caryclark@google.com07393ca2013-04-08 11:47:37 +000072#endif
73
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000074#define WIND_AS_STRING(x) char x##Str[12]; \
75 if (!SkPathOpsDebug::ValidWind(x)) strcpy(x##Str, "?"); \
76 else SK_SNPRINTF(x##Str, sizeof(x##Str), "%d", x)
77
caryclark@google.com07393ca2013-04-08 11:47:37 +000078#if FORCE_RELEASE
79
80#define DEBUG_ACTIVE_OP 0
81#define DEBUG_ACTIVE_SPANS 0
caryclark@google.com07393ca2013-04-08 11:47:37 +000082#define DEBUG_ADD_INTERSECTING_TS 0
caryclark54359292015-03-26 07:52:43 -070083#define DEBUG_ADD_T 0
caryclark26ad22a2015-10-16 09:03:38 -070084#define DEBUG_ALIGNMENT 0
caryclark@google.com07393ca2013-04-08 11:47:37 +000085#define DEBUG_ANGLE 0
caryclark@google.com07393ca2013-04-08 11:47:37 +000086#define DEBUG_ASSEMBLE 0
Leon Scroggins III982fff22020-07-31 14:09:06 -040087#define DEBUG_COINCIDENCE 0
Cary Clarkab87d7a2016-10-04 10:01:04 -040088#define DEBUG_COINCIDENCE_DUMP 0 // accumulate and dump which algorithms fired
89#define DEBUG_COINCIDENCE_ORDER 0 // for well behaved curves, check if pairs match up in t-order
90#define DEBUG_COINCIDENCE_VERBOSE 0 // usually whether the next function generates coincidence
commit-bot@chromium.org2db7fe72014-05-07 15:31:40 +000091#define DEBUG_CUBIC_BINARY_SEARCH 0
caryclark03b03ca2015-04-23 09:13:37 -070092#define DEBUG_CUBIC_SPLIT 0
caryclark624637c2015-05-11 07:21:27 -070093#define DEBUG_DUMP_SEGMENTS 0
Cary Clark918fb1f2016-11-15 13:22:25 -050094#define DEBUG_DUMP_VERIFY 0
caryclark@google.com07393ca2013-04-08 11:47:37 +000095#define DEBUG_FLOW 0
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +000096#define DEBUG_LIMIT_WIND_SUM 0
caryclark@google.com07393ca2013-04-08 11:47:37 +000097#define DEBUG_MARK_DONE 0
98#define DEBUG_PATH_CONSTRUCTION 0
caryclark54359292015-03-26 07:52:43 -070099#define DEBUG_PERP 0
caryclark@google.com07393ca2013-04-08 11:47:37 +0000100#define DEBUG_SORT 0
caryclark54359292015-03-26 07:52:43 -0700101#define DEBUG_T_SECT 0
102#define DEBUG_T_SECT_DUMP 0
caryclark26ad22a2015-10-16 09:03:38 -0700103#define DEBUG_T_SECT_LOOP_COUNT 0
caryclark@google.com4fdbb222013-07-23 15:27:41 +0000104#define DEBUG_VALIDATE 0
caryclark@google.com07393ca2013-04-08 11:47:37 +0000105#define DEBUG_WINDING 0
106#define DEBUG_WINDING_AT_T 0
107
108#else
109
110#define DEBUG_ACTIVE_OP 1
111#define DEBUG_ACTIVE_SPANS 1
caryclark@google.com07393ca2013-04-08 11:47:37 +0000112#define DEBUG_ADD_INTERSECTING_TS 1
caryclark54359292015-03-26 07:52:43 -0700113#define DEBUG_ADD_T 1
caryclark26ad22a2015-10-16 09:03:38 -0700114#define DEBUG_ALIGNMENT 0
caryclark@google.com07393ca2013-04-08 11:47:37 +0000115#define DEBUG_ANGLE 1
caryclark@google.com07393ca2013-04-08 11:47:37 +0000116#define DEBUG_ASSEMBLE 1
Cary Clarkff114282016-12-14 11:56:16 -0500117#define DEBUG_COINCIDENCE 1
Cary Clarkab87d7a2016-10-04 10:01:04 -0400118#define DEBUG_COINCIDENCE_DUMP 0
Cary Clark8762fb62018-10-16 16:06:24 -0400119#define DEBUG_COINCIDENCE_ORDER 0 // tight arc quads may generate out-of-order coincidence spans
Cary Clarkff114282016-12-14 11:56:16 -0500120#define DEBUG_COINCIDENCE_VERBOSE 1
caryclark65b427c2014-09-18 10:32:57 -0700121#define DEBUG_CUBIC_BINARY_SEARCH 0
caryclark03b03ca2015-04-23 09:13:37 -0700122#define DEBUG_CUBIC_SPLIT 1
Cary Clark918fb1f2016-11-15 13:22:25 -0500123#define DEBUG_DUMP_VERIFY 0
caryclark03b03ca2015-04-23 09:13:37 -0700124#define DEBUG_DUMP_SEGMENTS 1
caryclark@google.com07393ca2013-04-08 11:47:37 +0000125#define DEBUG_FLOW 1
caryclark55888e42016-07-18 10:01:36 -0700126#define DEBUG_LIMIT_WIND_SUM 15
caryclark@google.com07393ca2013-04-08 11:47:37 +0000127#define DEBUG_MARK_DONE 1
128#define DEBUG_PATH_CONSTRUCTION 1
caryclark03b03ca2015-04-23 09:13:37 -0700129#define DEBUG_PERP 1
caryclark@google.com07393ca2013-04-08 11:47:37 +0000130#define DEBUG_SORT 1
Cary Clarkb8421ed2018-03-14 15:55:02 -0400131#define DEBUG_T_SECT 0 // enabling may trigger validate asserts even though op does not fail
caryclarke839e782016-09-15 07:48:18 -0700132#define DEBUG_T_SECT_DUMP 0 // Use 1 normally. Use 2 to number segments, 3 for script output
caryclarked0935a2015-10-22 07:23:52 -0700133#define DEBUG_T_SECT_LOOP_COUNT 0
caryclark54359292015-03-26 07:52:43 -0700134#define DEBUG_VALIDATE 1
caryclark@google.com07393ca2013-04-08 11:47:37 +0000135#define DEBUG_WINDING 1
136#define DEBUG_WINDING_AT_T 1
137
138#endif
139
caryclark54359292015-03-26 07:52:43 -0700140#ifdef SK_RELEASE
caryclark1049f122015-04-20 08:31:59 -0700141 #define SkDEBUGRELEASE(a, b) b
142 #define SkDEBUGPARAMS(...)
reed0dc4dd62015-03-24 13:55:33 -0700143#else
caryclark1049f122015-04-20 08:31:59 -0700144 #define SkDEBUGRELEASE(a, b) a
145 #define SkDEBUGPARAMS(...) , __VA_ARGS__
reed0dc4dd62015-03-24 13:55:33 -0700146#endif
caryclark54359292015-03-26 07:52:43 -0700147
caryclark27c8eb82015-07-06 11:38:33 -0700148#if DEBUG_VALIDATE == 0
149 #define PATH_OPS_DEBUG_VALIDATE_PARAMS(...)
150#else
151 #define PATH_OPS_DEBUG_VALIDATE_PARAMS(...) , __VA_ARGS__
152#endif
153
caryclark54359292015-03-26 07:52:43 -0700154#if DEBUG_T_SECT == 0
155 #define PATH_OPS_DEBUG_T_SECT_RELEASE(a, b) b
156 #define PATH_OPS_DEBUG_T_SECT_PARAMS(...)
157 #define PATH_OPS_DEBUG_T_SECT_CODE(...)
158#else
159 #define PATH_OPS_DEBUG_T_SECT_RELEASE(a, b) a
160 #define PATH_OPS_DEBUG_T_SECT_PARAMS(...) , __VA_ARGS__
161 #define PATH_OPS_DEBUG_T_SECT_CODE(...) __VA_ARGS__
162#endif
163
164#if DEBUG_T_SECT_DUMP > 1
165 extern int gDumpTSectNum;
166#endif
167
Ben Wagner63fd7602017-10-09 15:45:33 -0400168#if DEBUG_COINCIDENCE || DEBUG_COINCIDENCE_DUMP
Cary Clarkab87d7a2016-10-04 10:01:04 -0400169 #define DEBUG_COIN 1
caryclark26ad22a2015-10-16 09:03:38 -0700170#else
Cary Clarkab87d7a2016-10-04 10:01:04 -0400171 #define DEBUG_COIN 0
172#endif
173
174#if DEBUG_COIN
175 #define DEBUG_COIN_DECLARE_ONLY_PARAMS() \
176 int lineNo, SkOpPhase phase, int iteration
177 #define DEBUG_COIN_DECLARE_PARAMS() \
178 , DEBUG_COIN_DECLARE_ONLY_PARAMS()
179 #define DEBUG_COIN_ONLY_PARAMS() \
180 __LINE__, SkOpPhase::kNoChange, 0
181 #define DEBUG_COIN_PARAMS() \
182 , DEBUG_COIN_ONLY_PARAMS()
183 #define DEBUG_ITER_ONLY_PARAMS(iteration) \
184 __LINE__, SkOpPhase::kNoChange, iteration
185 #define DEBUG_ITER_PARAMS(iteration) \
186 , DEBUG_ITER_ONLY_PARAMS(iteration)
187 #define DEBUG_PHASE_ONLY_PARAMS(phase) \
188 __LINE__, SkOpPhase::phase, 0
189 #define DEBUG_PHASE_PARAMS(phase) \
190 , DEBUG_PHASE_ONLY_PARAMS(phase)
191 #define DEBUG_SET_PHASE() \
192 this->globalState()->debugSetPhase(__func__, lineNo, phase, iteration)
193 #define DEBUG_STATIC_SET_PHASE(obj) \
194 obj->globalState()->debugSetPhase(__func__, lineNo, phase, iteration)
195#elif DEBUG_VALIDATE
196 #define DEBUG_COIN_DECLARE_ONLY_PARAMS() \
197 SkOpPhase phase
198 #define DEBUG_COIN_DECLARE_PARAMS() \
199 , DEBUG_COIN_DECLARE_ONLY_PARAMS()
200 #define DEBUG_COIN_ONLY_PARAMS() \
201 SkOpPhase::kNoChange
202 #define DEBUG_COIN_PARAMS() \
203 , DEBUG_COIN_ONLY_PARAMS()
204 #define DEBUG_ITER_ONLY_PARAMS(iteration) \
205 SkOpPhase::kNoChange
206 #define DEBUG_ITER_PARAMS(iteration) \
207 , DEBUG_ITER_ONLY_PARAMS(iteration)
208 #define DEBUG_PHASE_ONLY_PARAMS(phase) \
209 SkOpPhase::phase
210 #define DEBUG_PHASE_PARAMS(phase) \
211 , DEBUG_PHASE_ONLY_PARAMS(phase)
212 #define DEBUG_SET_PHASE() \
213 this->globalState()->debugSetPhase(phase)
214 #define DEBUG_STATIC_SET_PHASE(obj) \
215 obj->globalState()->debugSetPhase(phase)
216#else
217 #define DEBUG_COIN_DECLARE_ONLY_PARAMS()
218 #define DEBUG_COIN_DECLARE_PARAMS()
219 #define DEBUG_COIN_ONLY_PARAMS()
220 #define DEBUG_COIN_PARAMS()
221 #define DEBUG_ITER_ONLY_PARAMS(iteration)
222 #define DEBUG_ITER_PARAMS(iteration)
223 #define DEBUG_PHASE_ONLY_PARAMS(phase)
224 #define DEBUG_PHASE_PARAMS(phase)
225 #define DEBUG_SET_PHASE()
226 #define DEBUG_STATIC_SET_PHASE(obj)
caryclark26ad22a2015-10-16 09:03:38 -0700227#endif
228
caryclark1049f122015-04-20 08:31:59 -0700229#define CUBIC_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}}"
230#define CONIC_DEBUG_STR "{{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}}, %1.9g}"
231#define QUAD_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}}"
232#define LINE_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}}}"
caryclark54359292015-03-26 07:52:43 -0700233#define PT_DEBUG_STR "{{%1.9g,%1.9g}}"
234
caryclark@google.com07393ca2013-04-08 11:47:37 +0000235#define T_DEBUG_STR(t, n) #t "[" #n "]=%1.9g"
236#define TX_DEBUG_STR(t) #t "[%d]=%1.9g"
237#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 -0700238#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 +0000239#define QUAD_DEBUG_DATA(q) q[0].fX, q[0].fY, q[1].fX, q[1].fY, q[2].fX, q[2].fY
240#define LINE_DEBUG_DATA(l) l[0].fX, l[0].fY, l[1].fX, l[1].fY
caryclarkdac1d172014-06-17 05:15:38 -0700241#define PT_DEBUG_DATA(i, n) i.pt(n).asSkPoint().fX, i.pt(n).asSkPoint().fY
caryclark@google.com07393ca2013-04-08 11:47:37 +0000242
caryclark@google.com07e97fc2013-07-08 17:17:02 +0000243#ifndef DEBUG_TEST
244#define DEBUG_TEST 0
caryclark@google.coma5e55922013-05-07 18:51:31 +0000245#endif
246
caryclark29b25632016-08-25 11:27:17 -0700247// Tests with extreme numbers may fail, but all other tests should never fail.
248#define FAIL_IF(cond) \
249 do { bool fail = (cond); SkOPASSERT(!fail); if (fail) return false; } while (false)
caryclark025b11e2016-08-25 05:21:14 -0700250
caryclark29b25632016-08-25 11:27:17 -0700251#define FAIL_WITH_NULL_IF(cond) \
252 do { bool fail = (cond); SkOPASSERT(!fail); if (fail) return nullptr; } while (false)
253
caryclark@google.com570863f2013-09-16 15:55:01 +0000254class SkPathOpsDebug {
255public:
Cary Clarkab87d7a2016-10-04 10:01:04 -0400256#if DEBUG_COIN
caryclark26ad22a2015-10-16 09:03:38 -0700257 struct GlitchLog;
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +0000258
Cary Clarkab87d7a2016-10-04 10:01:04 -0400259 enum GlitchType {
260 kUninitialized_Glitch,
261 kAddCorruptCoin_Glitch,
262 kAddExpandedCoin_Glitch,
263 kAddExpandedFail_Glitch,
264 kAddIfCollapsed_Glitch,
265 kAddIfMissingCoin_Glitch,
266 kAddMissingCoin_Glitch,
267 kAddMissingExtend_Glitch,
268 kAddOrOverlap_Glitch,
269 kCollapsedCoin_Glitch,
270 kCollapsedDone_Glitch,
271 kCollapsedOppValue_Glitch,
272 kCollapsedSpan_Glitch,
273 kCollapsedWindValue_Glitch,
274 kCorrectEnd_Glitch,
275 kDeletedCoin_Glitch,
276 kExpandCoin_Glitch,
277 kFail_Glitch,
278 kMarkCoinEnd_Glitch,
279 kMarkCoinInsert_Glitch,
280 kMarkCoinMissing_Glitch,
281 kMarkCoinStart_Glitch,
Cary Clarkab87d7a2016-10-04 10:01:04 -0400282 kMergeMatches_Glitch,
283 kMissingCoin_Glitch,
284 kMissingDone_Glitch,
285 kMissingIntersection_Glitch,
286 kMoveMultiple_Glitch,
287 kMoveNearbyClearAll_Glitch,
288 kMoveNearbyClearAll2_Glitch,
289 kMoveNearbyMerge_Glitch,
290 kMoveNearbyMergeFinal_Glitch,
291 kMoveNearbyRelease_Glitch,
292 kMoveNearbyReleaseFinal_Glitch,
293 kReleasedSpan_Glitch,
294 kReturnFalse_Glitch,
295 kUnaligned_Glitch,
296 kUnalignedHead_Glitch,
297 kUnalignedTail_Glitch,
298 };
299
300 struct CoinDictEntry {
301 int fIteration;
302 int fLineNumber;
303 GlitchType fGlitchType;
304 const char* fFunctionName;
305 };
306
307 struct CoinDict {
308 void add(const CoinDictEntry& key);
309 void add(const CoinDict& dict);
310 void dump(const char* str, bool visitCheck) const;
311 SkTDArray<CoinDictEntry> fDict;
312 };
313
314 static CoinDict gCoinSumChangedDict;
315 static CoinDict gCoinSumVisitedDict;
316 static CoinDict gCoinVistedDict;
317#endif
318
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +0000319#if defined(SK_DEBUG) || !FORCE_RELEASE
caryclark@google.com570863f2013-09-16 15:55:01 +0000320 static int gContourID;
321 static int gSegmentID;
commit-bot@chromium.org8cb1daa2014-04-25 12:59:11 +0000322#endif
caryclark@google.com570863f2013-09-16 15:55:01 +0000323
caryclark624637c2015-05-11 07:21:27 -0700324#if DEBUG_SORT
caryclark@google.com570863f2013-09-16 15:55:01 +0000325 static int gSortCountDefault;
326 static int gSortCount;
327#endif
328
329#if DEBUG_ACTIVE_OP
330 static const char* kPathOpStr[];
331#endif
Cary Clarkb8421ed2018-03-14 15:55:02 -0400332 static bool gRunFail;
333 static bool gVeryVerbose;
caryclark@google.com570863f2013-09-16 15:55:01 +0000334
Cary Clarkb8421ed2018-03-14 15:55:02 -0400335#if DEBUG_ACTIVE_SPANS
336 static SkString gActiveSpans;
337#endif
338#if DEBUG_DUMP_VERIFY
339 static bool gDumpOp;
340 static bool gVerifyOp;
341#endif
342
343 static const char* OpStr(SkPathOp );
caryclark@google.com570863f2013-09-16 15:55:01 +0000344 static void MathematicaIze(char* str, size_t bufferSize);
345 static bool ValidWind(int winding);
346 static void WindingPrintf(int winding);
347
caryclark55888e42016-07-18 10:01:36 -0700348 static void ShowActiveSpans(SkOpContourHead* contourList);
caryclark19eb3b22014-07-18 05:08:14 -0700349 static void ShowOnePath(const SkPath& path, const char* name, bool includeDeclaration);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000350 static void ShowPath(const SkPath& one, const SkPath& two, SkPathOp op, const char* name);
caryclark54359292015-03-26 07:52:43 -0700351
Cary Clarkb8421ed2018-03-14 15:55:02 -0400352 static bool ChaseContains(const SkTDArray<SkOpSpanBase*>& , const SkOpSpanBase* );
caryclark54359292015-03-26 07:52:43 -0700353
Cary Clarkab87d7a2016-10-04 10:01:04 -0400354 static void CheckHealth(class SkOpContourHead* contourList);
caryclark26ad22a2015-10-16 09:03:38 -0700355
Cary Clarkab87d7a2016-10-04 10:01:04 -0400356#if DEBUG_COIN
Cary Clarkb8421ed2018-03-14 15:55:02 -0400357 static void DumpCoinDict();
358 static void DumpGlitchType(GlitchType );
Cary Clarkff114282016-12-14 11:56:16 -0500359#endif
360
caryclark@google.com570863f2013-09-16 15:55:01 +0000361};
362
Cary Clarkb8421ed2018-03-14 15:55:02 -0400363// Visual Studio 2017 does not permit calling member functions from the Immediate Window.
Cary Clark8762fb62018-10-16 16:06:24 -0400364// Global functions work fine, however. Use globals rather than static members inside a class.
365const SkOpAngle* AngleAngle(const SkOpAngle*, int id);
366SkOpContour* AngleContour(SkOpAngle*, int id);
367const SkOpPtT* AnglePtT(const SkOpAngle*, int id);
368const SkOpSegment* AngleSegment(const SkOpAngle*, int id);
369const SkOpSpanBase* AngleSpan(const SkOpAngle*, int id);
Cary Clarkb8421ed2018-03-14 15:55:02 -0400370
Cary Clark8762fb62018-10-16 16:06:24 -0400371const SkOpAngle* ContourAngle(SkOpContour*, int id);
372SkOpContour* ContourContour(SkOpContour*, int id);
373const SkOpPtT* ContourPtT(SkOpContour*, int id);
374const SkOpSegment* ContourSegment(SkOpContour*, int id);
375const SkOpSpanBase* ContourSpan(SkOpContour*, int id);
Cary Clarkb8421ed2018-03-14 15:55:02 -0400376
Cary Clark8762fb62018-10-16 16:06:24 -0400377const SkOpAngle* CoincidenceAngle(SkOpCoincidence*, int id);
378SkOpContour* CoincidenceContour(SkOpCoincidence*, int id);
379const SkOpPtT* CoincidencePtT(SkOpCoincidence*, int id);
380const SkOpSegment* CoincidenceSegment(SkOpCoincidence*, int id);
381const SkOpSpanBase* CoincidenceSpan(SkOpCoincidence*, int id);
Cary Clarkb8421ed2018-03-14 15:55:02 -0400382
Cary Clark8762fb62018-10-16 16:06:24 -0400383const SkOpAngle* PtTAngle(const SkOpPtT*, int id);
384SkOpContour* PtTContour(SkOpPtT*, int id);
385const SkOpPtT* PtTPtT(const SkOpPtT*, int id);
386const SkOpSegment* PtTSegment(const SkOpPtT*, int id);
387const SkOpSpanBase* PtTSpan(const SkOpPtT*, int id);
Cary Clarkb8421ed2018-03-14 15:55:02 -0400388
Cary Clark8762fb62018-10-16 16:06:24 -0400389const SkOpAngle* SegmentAngle(const SkOpSegment*, int id);
390SkOpContour* SegmentContour(SkOpSegment*, int id);
391const SkOpPtT* SegmentPtT(const SkOpSegment*, int id);
392const SkOpSegment* SegmentSegment(const SkOpSegment*, int id);
393const SkOpSpanBase* SegmentSpan(const SkOpSegment*, int id);
Cary Clarkb8421ed2018-03-14 15:55:02 -0400394
Cary Clark8762fb62018-10-16 16:06:24 -0400395const SkOpAngle* SpanAngle(const SkOpSpanBase*, int id);
396SkOpContour* SpanContour(SkOpSpanBase*, int id);
397const SkOpPtT* SpanPtT(const SkOpSpanBase*, int id);
398const SkOpSegment* SpanSegment(const SkOpSpanBase*, int id);
399const SkOpSpanBase* SpanSpan(const SkOpSpanBase*, int id);
Cary Clarkb8421ed2018-03-14 15:55:02 -0400400
401#if DEBUG_DUMP_VERIFY
Cary Clark8762fb62018-10-16 16:06:24 -0400402void DumpOp(const SkPath& one, const SkPath& two, SkPathOp op,
403 const char* testName);
404void DumpOp(FILE* file, const SkPath& one, const SkPath& two, SkPathOp op,
405 const char* testName);
406void DumpSimplify(const SkPath& path, const char* testName);
407void DumpSimplify(FILE* file, const SkPath& path, const char* testName);
408void ReportOpFail(const SkPath& one, const SkPath& two, SkPathOp op);
409void ReportSimplifyFail(const SkPath& path);
410void VerifyOp(const SkPath& one, const SkPath& two, SkPathOp op,
411 const SkPath& result);
412void VerifySimplify(const SkPath& path, const SkPath& result);
Cary Clarkb8421ed2018-03-14 15:55:02 -0400413#endif
414
Cary Clark8762fb62018-10-16 16:06:24 -0400415// global path dumps for msvs Visual Studio 17 to use from Immediate Window
416void Dump(const SkOpContour& );
417void DumpAll(const SkOpContour& );
418void DumpAngles(const SkOpContour& );
419void DumpContours(const SkOpContour& );
420void DumpContoursAll(const SkOpContour& );
421void DumpContoursAngles(const SkOpContour& );
422void DumpContoursPts(const SkOpContour& );
423void DumpContoursPt(const SkOpContour& , int segmentID);
424void DumpContoursSegment(const SkOpContour& , int segmentID);
425void DumpContoursSpan(const SkOpContour& , int segmentID);
426void DumpContoursSpans(const SkOpContour& );
427void DumpPt(const SkOpContour& , int );
428void DumpPts(const SkOpContour& , const char* prefix = "seg");
429void DumpSegment(const SkOpContour& , int );
430void DumpSegments(const SkOpContour& , const char* prefix = "seg", SkPathOp op = (SkPathOp) -1);
431void DumpSpan(const SkOpContour& , int );
432void DumpSpans(const SkOpContour& );
Cary Clarkb8421ed2018-03-14 15:55:02 -0400433
Cary Clark8762fb62018-10-16 16:06:24 -0400434void Dump(const SkOpSegment& );
435void DumpAll(const SkOpSegment& );
436void DumpAngles(const SkOpSegment& );
437void DumpCoin(const SkOpSegment& );
438void DumpPts(const SkOpSegment& , const char* prefix = "seg");
Cary Clarkb8421ed2018-03-14 15:55:02 -0400439
Cary Clark8762fb62018-10-16 16:06:24 -0400440void Dump(const SkOpPtT& );
441void DumpAll(const SkOpPtT& );
Cary Clarkb8421ed2018-03-14 15:55:02 -0400442
Cary Clark8762fb62018-10-16 16:06:24 -0400443void Dump(const SkOpSpanBase& );
444void DumpCoin(const SkOpSpanBase& );
445void DumpAll(const SkOpSpanBase& );
Cary Clarkb8421ed2018-03-14 15:55:02 -0400446
Cary Clark8762fb62018-10-16 16:06:24 -0400447void DumpCoin(const SkOpSpan& );
448bool DumpSpan(const SkOpSpan& );
Cary Clarkb8421ed2018-03-14 15:55:02 -0400449
Cary Clark8762fb62018-10-16 16:06:24 -0400450void Dump(const SkDConic& );
451void DumpID(const SkDConic& , int id);
Cary Clarkb8421ed2018-03-14 15:55:02 -0400452
Cary Clark8762fb62018-10-16 16:06:24 -0400453void Dump(const SkDCubic& );
454void DumpID(const SkDCubic& , int id);
Cary Clarkb8421ed2018-03-14 15:55:02 -0400455
Cary Clark8762fb62018-10-16 16:06:24 -0400456void Dump(const SkDLine& );
457void DumpID(const SkDLine& , int id);
Cary Clarkb8421ed2018-03-14 15:55:02 -0400458
Cary Clark8762fb62018-10-16 16:06:24 -0400459void Dump(const SkDQuad& );
460void DumpID(const SkDQuad& , int id);
Cary Clarkb8421ed2018-03-14 15:55:02 -0400461
Cary Clark8762fb62018-10-16 16:06:24 -0400462void Dump(const SkDPoint& );
Cary Clarkb8421ed2018-03-14 15:55:02 -0400463
Cary Clark8762fb62018-10-16 16:06:24 -0400464void Dump(const SkOpAngle& );
caryclarkdac1d172014-06-17 05:15:38 -0700465
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000466// generates tools/path_sorter.htm and path_visualizer.htm compatible data
caryclark54359292015-03-26 07:52:43 -0700467void DumpQ(const SkDQuad& quad1, const SkDQuad& quad2, int testNo);
468void DumpT(const SkDQuad& quad, double t);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000469
Cary Clarkb8421ed2018-03-14 15:55:02 -0400470// global path dumps for msvs Visual Studio 17 to use from Immediate Window
471void Dump(const SkPath& path);
472void DumpHex(const SkPath& path);
473
caryclark@google.com07393ca2013-04-08 11:47:37 +0000474#endif