7#ifndef SkPathOpsDebug_DEFINED
8#define SkPathOpsDebug_DEFINED
35#define FORCE_RELEASE 1
37#define FORCE_RELEASE 1
40#define DEBUG_UNDER_DEVELOPMENT 0
42#define ONE_OFF_DEBUG 0
43#define ONE_OFF_DEBUG_MATHEMATICA 0
45#if defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_ANDROID)
46 #define SK_RAND(seed) rand()
48 #define SK_RAND(seed) rand_r(&seed)
51#define WIND_AS_STRING(x) char x##Str[12]; \
52 if (!SkPathOpsDebug::ValidWind(x)) strcpy(x##Str, "?"); \
53 else snprintf(x##Str, sizeof(x##Str), "%d", x)
57#define DEBUG_ACTIVE_OP 0
58#define DEBUG_ACTIVE_SPANS 0
59#define DEBUG_ADD_INTERSECTING_TS 0
61#define DEBUG_ALIGNMENT 0
63#define DEBUG_ASSEMBLE 0
64#define DEBUG_COINCIDENCE 0
65#define DEBUG_COINCIDENCE_DUMP 0
66#define DEBUG_COINCIDENCE_ORDER 0
67#define DEBUG_COINCIDENCE_VERBOSE 0
68#define DEBUG_CUBIC_BINARY_SEARCH 0
69#define DEBUG_CUBIC_SPLIT 0
70#define DEBUG_DUMP_SEGMENTS 0
71#define DEBUG_DUMP_VERIFY 0
73#define DEBUG_LIMIT_WIND_SUM 0
74#define DEBUG_MARK_DONE 0
75#define DEBUG_PATH_CONSTRUCTION 0
79#define DEBUG_T_SECT_DUMP 0
80#define DEBUG_T_SECT_LOOP_COUNT 0
81#define DEBUG_VALIDATE 0
82#define DEBUG_WINDING 0
83#define DEBUG_WINDING_AT_T 0
87#define DEBUG_ACTIVE_OP 1
88#define DEBUG_ACTIVE_SPANS 1
89#define DEBUG_ADD_INTERSECTING_TS 1
91#define DEBUG_ALIGNMENT 0
93#define DEBUG_ASSEMBLE 1
94#define DEBUG_COINCIDENCE 1
95#define DEBUG_COINCIDENCE_DUMP 1
96#define DEBUG_COINCIDENCE_ORDER 1
97#define DEBUG_COINCIDENCE_VERBOSE 1
98#define DEBUG_CUBIC_BINARY_SEARCH 0
99#define DEBUG_CUBIC_SPLIT 1
100#define DEBUG_DUMP_VERIFY 1
101#define DEBUG_DUMP_SEGMENTS 1
103#define DEBUG_LIMIT_WIND_SUM 15
104#define DEBUG_MARK_DONE 1
105#define DEBUG_PATH_CONSTRUCTION 1
108#define DEBUG_T_SECT 0
109#define DEBUG_T_SECT_DUMP 0
110#define DEBUG_T_SECT_LOOP_COUNT 0
111#define DEBUG_VALIDATE 1
112#define DEBUG_WINDING 1
113#define DEBUG_WINDING_AT_T 1
118 #define SkDEBUGRELEASE(a, b) b
119 #define SkDEBUGPARAMS(...)
121 #define SkDEBUGRELEASE(a, b) a
122 #define SkDEBUGPARAMS(...) , __VA_ARGS__
125#if DEBUG_VALIDATE == 0
126 #define PATH_OPS_DEBUG_VALIDATE_PARAMS(...)
128 #define PATH_OPS_DEBUG_VALIDATE_PARAMS(...) , __VA_ARGS__
132 #define PATH_OPS_DEBUG_T_SECT_RELEASE(a, b) b
133 #define PATH_OPS_DEBUG_T_SECT_PARAMS(...)
134 #define PATH_OPS_DEBUG_T_SECT_CODE(...)
136 #define PATH_OPS_DEBUG_T_SECT_RELEASE(a, b) a
137 #define PATH_OPS_DEBUG_T_SECT_PARAMS(...) , __VA_ARGS__
138 #define PATH_OPS_DEBUG_T_SECT_CODE(...) __VA_ARGS__
141#if DEBUG_T_SECT_DUMP > 1
145#if DEBUG_COINCIDENCE || DEBUG_COINCIDENCE_DUMP
154 #define DEBUG_COIN_DECLARE_ONLY_PARAMS() \
155 int lineNo, SkOpPhase phase, int iteration
156 #define DEBUG_COIN_DECLARE_PARAMS() \
157 , DEBUG_COIN_DECLARE_ONLY_PARAMS()
158 #define DEBUG_COIN_ONLY_PARAMS() \
159 __LINE__, SkOpPhase::kNoChange, 0
160 #define DEBUG_COIN_PARAMS() \
161 , DEBUG_COIN_ONLY_PARAMS()
162 #define DEBUG_ITER_ONLY_PARAMS(iteration) \
163 __LINE__, SkOpPhase::kNoChange, iteration
164 #define DEBUG_ITER_PARAMS(iteration) \
165 , DEBUG_ITER_ONLY_PARAMS(iteration)
166 #define DEBUG_PHASE_ONLY_PARAMS(phase) \
167 __LINE__, SkOpPhase::phase, 0
168 #define DEBUG_PHASE_PARAMS(phase) \
169 , DEBUG_PHASE_ONLY_PARAMS(phase)
170 #define DEBUG_SET_PHASE() \
171 this->globalState()->debugSetPhase(__func__, lineNo, phase, iteration)
172 #define DEBUG_STATIC_SET_PHASE(obj) \
173 obj->globalState()->debugSetPhase(__func__, lineNo, phase, iteration)
175 #define DEBUG_COIN_DECLARE_ONLY_PARAMS() \
177 #define DEBUG_COIN_DECLARE_PARAMS() \
178 , DEBUG_COIN_DECLARE_ONLY_PARAMS()
179 #define DEBUG_COIN_ONLY_PARAMS() \
181 #define DEBUG_COIN_PARAMS() \
182 , DEBUG_COIN_ONLY_PARAMS()
183 #define DEBUG_ITER_ONLY_PARAMS(iteration) \
185 #define DEBUG_ITER_PARAMS(iteration) \
186 , DEBUG_ITER_ONLY_PARAMS(iteration)
187 #define DEBUG_PHASE_ONLY_PARAMS(phase) \
189 #define DEBUG_PHASE_PARAMS(phase) \
190 , DEBUG_PHASE_ONLY_PARAMS(phase)
191 #define DEBUG_SET_PHASE() \
192 this->globalState()->debugSetPhase(phase)
193 #define DEBUG_STATIC_SET_PHASE(obj) \
194 obj->globalState()->debugSetPhase(phase)
196 #define DEBUG_COIN_DECLARE_ONLY_PARAMS()
197 #define DEBUG_COIN_DECLARE_PARAMS()
198 #define DEBUG_COIN_ONLY_PARAMS()
199 #define DEBUG_COIN_PARAMS()
200 #define DEBUG_ITER_ONLY_PARAMS(iteration)
201 #define DEBUG_ITER_PARAMS(iteration)
202 #define DEBUG_PHASE_ONLY_PARAMS(phase)
203 #define DEBUG_PHASE_PARAMS(phase)
204 #define DEBUG_SET_PHASE()
205 #define DEBUG_STATIC_SET_PHASE(obj)
208#define CUBIC_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}}"
209#define CONIC_DEBUG_STR "{{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}}, %1.9g}"
210#define QUAD_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}}"
211#define LINE_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}}}"
212#define PT_DEBUG_STR "{{%1.9g,%1.9g}}"
214#define T_DEBUG_STR(t, n) #t "[" #n "]=%1.9g"
215#define TX_DEBUG_STR(t) #t "[%d]=%1.9g"
216#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
217#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
218#define QUAD_DEBUG_DATA(q) q[0].fX, q[0].fY, q[1].fX, q[1].fY, q[2].fX, q[2].fY
219#define LINE_DEBUG_DATA(l) l[0].fX, l[0].fY, l[1].fX, l[1].fY
220#define PT_DEBUG_DATA(i, n) i.pt(n).asSkPoint().fX, i.pt(n).asSkPoint().fY
227#define FAIL_IF(cond) \
228 do { bool fail = (cond); SkOPASSERT(!fail); if (fail) return false; } while (false)
230#define FAIL_WITH_NULL_IF(cond) \
231 do { bool fail = (cond); SkOPASSERT(!fail); if (fail) return nullptr; } while (false)
239 kUninitialized_Glitch,
240 kAddCorruptCoin_Glitch,
241 kAddExpandedCoin_Glitch,
242 kAddExpandedFail_Glitch,
243 kAddIfCollapsed_Glitch,
244 kAddIfMissingCoin_Glitch,
245 kAddMissingCoin_Glitch,
246 kAddMissingExtend_Glitch,
247 kAddOrOverlap_Glitch,
248 kCollapsedCoin_Glitch,
249 kCollapsedDone_Glitch,
250 kCollapsedOppValue_Glitch,
251 kCollapsedSpan_Glitch,
252 kCollapsedWindValue_Glitch,
258 kMarkCoinInsert_Glitch,
259 kMarkCoinMissing_Glitch,
260 kMarkCoinStart_Glitch,
261 kMergeMatches_Glitch,
264 kMissingIntersection_Glitch,
265 kMoveMultiple_Glitch,
266 kMoveNearbyClearAll_Glitch,
267 kMoveNearbyClearAll2_Glitch,
268 kMoveNearbyMerge_Glitch,
269 kMoveNearbyMergeFinal_Glitch,
270 kMoveNearbyRelease_Glitch,
271 kMoveNearbyReleaseFinal_Glitch,
272 kReleasedSpan_Glitch,
275 kUnalignedHead_Glitch,
276 kUnalignedTail_Glitch,
279 struct CoinDictEntry {
282 GlitchType fGlitchType;
283 const char* fFunctionName;
287 void add(
const CoinDictEntry&
key);
288 void add(
const CoinDict& dict);
289 void dump(
const char* str,
bool visitCheck)
const;
293 static CoinDict gCoinSumChangedDict;
294 static CoinDict gCoinSumVisitedDict;
295 static CoinDict gCoinVistedDict;
298#if defined(SK_DEBUG) || !FORCE_RELEASE
299 static int gContourID;
300 static int gSegmentID;
304 static int gSortCountDefault;
305 static int gSortCount;
309 static const char* kPathOpStr[];
314#if DEBUG_ACTIVE_SPANS
319 static bool gVerifyOp;
336 static void DumpCoinDict();
337 static void DumpGlitchType(GlitchType );
void DumpID(const SkDConic &, int id)
const SkOpSegment * CoincidenceSegment(SkOpCoincidence *, int id)
void DumpQ(const SkDQuad &quad1, const SkDQuad &quad2, int testNo)
void DumpContoursAngles(const SkOpContour &)
const SkOpAngle * SpanAngle(const SkOpSpanBase *, int id)
SkOpContour * PtTContour(SkOpPtT *, int id)
const SkOpSpanBase * SpanSpan(const SkOpSpanBase *, int id)
void DumpContoursPts(const SkOpContour &)
SkOpContour * ContourContour(SkOpContour *, int id)
const SkOpPtT * ContourPtT(SkOpContour *, int id)
const SkOpSegment * AngleSegment(const SkOpAngle *, int id)
void DumpSegment(const SkOpContour &, int)
void DumpT(const SkDQuad &quad, double t)
const SkOpAngle * AngleAngle(const SkOpAngle *, int id)
void DumpContours(const SkOpContour &)
const SkOpPtT * AnglePtT(const SkOpAngle *, int id)
void DumpContoursSpans(const SkOpContour &)
void DumpSpan(const SkOpContour &, int)
const SkOpPtT * SegmentPtT(const SkOpSegment *, int id)
const SkOpSpanBase * AngleSpan(const SkOpAngle *, int id)
void DumpPt(const SkOpContour &, int)
void DumpHex(const SkPath &path)
void DumpSpans(const SkOpContour &)
void DumpContoursAll(const SkOpContour &)
void DumpAngles(const SkOpContour &)
const SkOpAngle * SegmentAngle(const SkOpSegment *, int id)
const SkOpSpanBase * SegmentSpan(const SkOpSegment *, int id)
const SkOpAngle * ContourAngle(SkOpContour *, int id)
const SkOpSegment * SegmentSegment(const SkOpSegment *, int id)
void DumpCoin(const SkOpSegment &)
void Dump(const SkOpContour &)
void DumpContoursSpan(const SkOpContour &, int segmentID)
const SkOpPtT * CoincidencePtT(SkOpCoincidence *, int id)
const SkOpAngle * CoincidenceAngle(SkOpCoincidence *, int id)
void DumpAll(const SkOpContour &)
const SkOpSegment * ContourSegment(SkOpContour *, int id)
const SkOpSpanBase * CoincidenceSpan(SkOpCoincidence *, int id)
void DumpPts(const SkOpContour &, const char *prefix="seg")
const SkOpPtT * PtTPtT(const SkOpPtT *, int id)
SkOpContour * SpanContour(SkOpSpanBase *, int id)
const SkOpAngle * PtTAngle(const SkOpPtT *, int id)
SkOpContour * SegmentContour(SkOpSegment *, int id)
const SkOpPtT * SpanPtT(const SkOpSpanBase *, int id)
void DumpContoursSegment(const SkOpContour &, int segmentID)
const SkOpSegment * SpanSegment(const SkOpSpanBase *, int id)
SkOpContour * AngleContour(SkOpAngle *, int id)
const SkOpSpanBase * PtTSpan(const SkOpPtT *, int id)
void DumpContoursPt(const SkOpContour &, int segmentID)
const SkOpSpanBase * ContourSpan(SkOpContour *, int id)
SkOpContour * CoincidenceContour(SkOpCoincidence *, int id)
void DumpSegments(const SkOpContour &, const char *prefix="seg", SkPathOp op=(SkPathOp) -1)
const SkOpSegment * PtTSegment(const SkOpPtT *, int id)
static void dump(const float m[20], SkYUVColorSpace cs, bool rgb2yuv)
static void ShowPath(const SkPath &one, const SkPath &two, SkPathOp op, const char *name)
static const char * OpStr(SkPathOp)
static void ShowActiveSpans(SkOpContourHead *contourList)
static void MathematicaIze(char *str, size_t bufferSize)
static void ShowOnePath(const SkPath &path, const char *name, bool includeDeclaration)
static bool ValidWind(int winding)
static void CheckHealth(class SkOpContourHead *contourList)
static bool ChaseContains(const SkTDArray< SkOpSpanBase * > &, const SkOpSpanBase *)
static void WindingPrintf(int winding)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
DEF_SWITCHES_START aot vmservice shared library name