blob: a6613bc9e6662f12531c3d67111c896bb0244519 [file] [log] [blame]
caryclark54359292015-03-26 07:52:43 -07001/*
2 * Copyright 2014 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
8#include "PathOpsTSectDebug.h"
9#include "SkOpCoincidence.h"
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000010#include "SkOpContour.h"
11#include "SkIntersectionHelper.h"
caryclark1049f122015-04-20 08:31:59 -070012#include "SkMutex.h"
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000013#include "SkOpSegment.h"
caryclark19eb3b22014-07-18 05:08:14 -070014#include "SkString.h"
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000015
caryclark27c8eb82015-07-06 11:38:33 -070016extern bool FLAGS_runFail;
17
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000018inline void DebugDumpDouble(double x) {
19 if (x == floor(x)) {
20 SkDebugf("%.0f", x);
21 } else {
22 SkDebugf("%1.19g", x);
23 }
24}
25
26inline void DebugDumpFloat(float x) {
27 if (x == floorf(x)) {
28 SkDebugf("%.0f", x);
29 } else {
30 SkDebugf("%1.9gf", x);
31 }
32}
33
caryclark65f55312014-11-13 06:58:52 -080034inline void DebugDumpHexFloat(float x) {
35 SkDebugf("SkBits2Float(0x%08x)", SkFloat2Bits(x));
36}
caryclark19eb3b22014-07-18 05:08:14 -070037
commit-bot@chromium.org4431e772014-04-14 17:08:59 +000038// if not defined by PathOpsDebug.cpp ...
39#if !defined SK_DEBUG && FORCE_RELEASE
40bool SkPathOpsDebug::ValidWind(int wind) {
41 return wind > SK_MinS32 + 0xFFFF && wind < SK_MaxS32 - 0xFFFF;
42}
43
44void SkPathOpsDebug::WindingPrintf(int wind) {
45 if (wind == SK_MinS32) {
46 SkDebugf("?");
47 } else {
48 SkDebugf("%d", wind);
49 }
50}
51#endif
52
caryclark55888e42016-07-18 10:01:36 -070053static void DumpID(int id) {
54 SkDebugf("} ");
55 if (id >= 0) {
56 SkDebugf("id=%d", id);
57 }
58 SkDebugf("\n");
59}
60
caryclark1049f122015-04-20 08:31:59 -070061void SkDConic::dump() const {
caryclark54359292015-03-26 07:52:43 -070062 dumpInner();
caryclark1049f122015-04-20 08:31:59 -070063 SkDebugf("},\n");
64}
65
66void SkDConic::dumpID(int id) const {
67 dumpInner();
caryclark55888e42016-07-18 10:01:36 -070068 DumpID(id);
caryclark1049f122015-04-20 08:31:59 -070069}
70
71void SkDConic::dumpInner() const {
caryclark26ad22a2015-10-16 09:03:38 -070072 SkDebugf("{");
73 fPts.dumpInner();
74 SkDebugf("}}, %1.9gf", fWeight);
caryclark1049f122015-04-20 08:31:59 -070075}
76
77void SkDCubic::dump() const {
78 this->dumpInner();
caryclark54359292015-03-26 07:52:43 -070079 SkDebugf("}},\n");
reed0dc4dd62015-03-24 13:55:33 -070080}
81
caryclark54359292015-03-26 07:52:43 -070082void SkDCubic::dumpID(int id) const {
caryclark1049f122015-04-20 08:31:59 -070083 this->dumpInner();
caryclark55888e42016-07-18 10:01:36 -070084 SkDebugf("}");
85 DumpID(id);
reed0dc4dd62015-03-24 13:55:33 -070086}
87
caryclark54359292015-03-26 07:52:43 -070088static inline bool double_is_NaN(double x) { return x != x; }
89
90void SkDCubic::dumpInner() const {
91 SkDebugf("{{");
92 int index = 0;
reed0dc4dd62015-03-24 13:55:33 -070093 do {
caryclark54359292015-03-26 07:52:43 -070094 if (index != 0) {
95 if (double_is_NaN(fPts[index].fX) && double_is_NaN(fPts[index].fY)) {
96 return;
reed0dc4dd62015-03-24 13:55:33 -070097 }
caryclark54359292015-03-26 07:52:43 -070098 SkDebugf(", ");
reed0dc4dd62015-03-24 13:55:33 -070099 }
caryclark54359292015-03-26 07:52:43 -0700100 fPts[index].dump();
101 } while (++index < 3);
102 if (double_is_NaN(fPts[index].fX) && double_is_NaN(fPts[index].fY)) {
reed0dc4dd62015-03-24 13:55:33 -0700103 return;
104 }
caryclark54359292015-03-26 07:52:43 -0700105 SkDebugf(", ");
reed0dc4dd62015-03-24 13:55:33 -0700106 fPts[index].dump();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000107}
108
caryclark55888e42016-07-18 10:01:36 -0700109void SkDCurve::dump() const {
110 dumpID(-1);
111}
112
caryclark1049f122015-04-20 08:31:59 -0700113void SkDCurve::dumpID(int id) const {
114#ifndef SK_RELEASE
115 switch(fVerb) {
116 case SkPath::kLine_Verb:
117 fLine.dumpID(id);
118 break;
119 case SkPath::kQuad_Verb:
120 fQuad.dumpID(id);
121 break;
122 case SkPath::kConic_Verb:
123 fConic.dumpID(id);
124 break;
125 case SkPath::kCubic_Verb:
126 fCubic.dumpID(id);
127 break;
128 default:
129 SkASSERT(0);
130 }
131#else
132 fCubic.dumpID(id);
133#endif
134}
135
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000136void SkDLine::dump() const {
caryclark1049f122015-04-20 08:31:59 -0700137 this->dumpInner();
138 SkDebugf("}},\n");
139}
140
141void SkDLine::dumpID(int id) const {
142 this->dumpInner();
caryclark55888e42016-07-18 10:01:36 -0700143 SkDebugf("}");
144 DumpID(id);
caryclark1049f122015-04-20 08:31:59 -0700145}
146
147void SkDLine::dumpInner() const {
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000148 SkDebugf("{{");
149 fPts[0].dump();
150 SkDebugf(", ");
151 fPts[1].dump();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000152}
153
154void SkDPoint::dump() const {
155 SkDebugf("{");
156 DebugDumpDouble(fX);
157 SkDebugf(", ");
158 DebugDumpDouble(fY);
159 SkDebugf("}");
160}
161
162void SkDPoint::Dump(const SkPoint& pt) {
163 SkDebugf("{");
164 DebugDumpFloat(pt.fX);
165 SkDebugf(", ");
166 DebugDumpFloat(pt.fY);
167 SkDebugf("}");
168}
169
caryclark65f55312014-11-13 06:58:52 -0800170void SkDPoint::DumpHex(const SkPoint& pt) {
171 SkDebugf("{");
172 DebugDumpHexFloat(pt.fX);
173 SkDebugf(", ");
174 DebugDumpHexFloat(pt.fY);
175 SkDebugf("}");
176}
177
178void SkDQuad::dump() const {
caryclark54359292015-03-26 07:52:43 -0700179 dumpInner();
180 SkDebugf("}},\n");
caryclark65f55312014-11-13 06:58:52 -0800181}
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000182
caryclark54359292015-03-26 07:52:43 -0700183void SkDQuad::dumpID(int id) const {
184 dumpInner();
caryclark55888e42016-07-18 10:01:36 -0700185 SkDebugf("}");
186 DumpID(id);
caryclark54359292015-03-26 07:52:43 -0700187}
188
189void SkDQuad::dumpInner() const {
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000190 SkDebugf("{{");
191 int index = 0;
192 do {
193 fPts[index].dump();
194 SkDebugf(", ");
195 } while (++index < 2);
196 fPts[index].dump();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000197}
198
caryclark54359292015-03-26 07:52:43 -0700199void SkIntersections::dump() const {
200 SkDebugf("used=%d of %d", fUsed, fMax);
201 for (int index = 0; index < fUsed; ++index) {
202 SkDebugf(" t=(%s%1.9g,%s%1.9g) pt=(%1.9g,%1.9g)",
203 fIsCoincident[0] & (1 << index) ? "*" : "", fT[0][index],
204 fIsCoincident[1] & (1 << index) ? "*" : "", fT[1][index],
205 fPt[index].fX, fPt[index].fY);
206 if (index < 2 && fNearlySame[index]) {
207 SkDebugf(" pt2=(%1.9g,%1.9g)",fPt2[index].fX, fPt2[index].fY);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000208 }
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000209 }
210 SkDebugf("\n");
211}
212
caryclark54359292015-03-26 07:52:43 -0700213const SkOpAngle* SkPathOpsDebug::DebugAngleAngle(const SkOpAngle* angle, int id) {
214 return angle->debugAngle(id);
215}
216
217SkOpContour* SkPathOpsDebug::DebugAngleContour(SkOpAngle* angle, int id) {
218 return angle->debugContour(id);
219}
220
221const SkOpPtT* SkPathOpsDebug::DebugAnglePtT(const SkOpAngle* angle, int id) {
222 return angle->debugPtT(id);
223}
224
225const SkOpSegment* SkPathOpsDebug::DebugAngleSegment(const SkOpAngle* angle, int id) {
226 return angle->debugSegment(id);
227}
228
229const SkOpSpanBase* SkPathOpsDebug::DebugAngleSpan(const SkOpAngle* angle, int id) {
230 return angle->debugSpan(id);
231}
232
233const SkOpAngle* SkPathOpsDebug::DebugContourAngle(SkOpContour* contour, int id) {
234 return contour->debugAngle(id);
235}
236
237SkOpContour* SkPathOpsDebug::DebugContourContour(SkOpContour* contour, int id) {
238 return contour->debugContour(id);
239}
240
241const SkOpPtT* SkPathOpsDebug::DebugContourPtT(SkOpContour* contour, int id) {
242 return contour->debugPtT(id);
243}
244
245const SkOpSegment* SkPathOpsDebug::DebugContourSegment(SkOpContour* contour, int id) {
246 return contour->debugSegment(id);
247}
248
249const SkOpSpanBase* SkPathOpsDebug::DebugContourSpan(SkOpContour* contour, int id) {
250 return contour->debugSpan(id);
251}
252
caryclark27c8eb82015-07-06 11:38:33 -0700253const SkOpAngle* SkPathOpsDebug::DebugCoincidenceAngle(SkOpCoincidence* coin, int id) {
254 return coin->debugAngle(id);
255}
256
257SkOpContour* SkPathOpsDebug::DebugCoincidenceContour(SkOpCoincidence* coin, int id) {
258 return coin->debugContour(id);
259}
260
261const SkOpPtT* SkPathOpsDebug::DebugCoincidencePtT(SkOpCoincidence* coin, int id) {
262 return coin->debugPtT(id);
263}
264
265const SkOpSegment* SkPathOpsDebug::DebugCoincidenceSegment(SkOpCoincidence* coin, int id) {
266 return coin->debugSegment(id);
267}
268
269const SkOpSpanBase* SkPathOpsDebug::DebugCoincidenceSpan(SkOpCoincidence* coin, int id) {
270 return coin->debugSpan(id);
271}
272
caryclark54359292015-03-26 07:52:43 -0700273const SkOpAngle* SkPathOpsDebug::DebugPtTAngle(const SkOpPtT* ptT, int id) {
274 return ptT->debugAngle(id);
275}
276
277SkOpContour* SkPathOpsDebug::DebugPtTContour(SkOpPtT* ptT, int id) {
278 return ptT->debugContour(id);
279}
280
281const SkOpPtT* SkPathOpsDebug::DebugPtTPtT(const SkOpPtT* ptT, int id) {
282 return ptT->debugPtT(id);
283}
284
285const SkOpSegment* SkPathOpsDebug::DebugPtTSegment(const SkOpPtT* ptT, int id) {
286 return ptT->debugSegment(id);
287}
288
289const SkOpSpanBase* SkPathOpsDebug::DebugPtTSpan(const SkOpPtT* ptT, int id) {
290 return ptT->debugSpan(id);
291}
292
293const SkOpAngle* SkPathOpsDebug::DebugSegmentAngle(const SkOpSegment* span, int id) {
294 return span->debugAngle(id);
295}
296
297SkOpContour* SkPathOpsDebug::DebugSegmentContour(SkOpSegment* span, int id) {
298 return span->debugContour(id);
299}
300
301const SkOpPtT* SkPathOpsDebug::DebugSegmentPtT(const SkOpSegment* span, int id) {
302 return span->debugPtT(id);
303}
304
305const SkOpSegment* SkPathOpsDebug::DebugSegmentSegment(const SkOpSegment* span, int id) {
306 return span->debugSegment(id);
307}
308
309const SkOpSpanBase* SkPathOpsDebug::DebugSegmentSpan(const SkOpSegment* span, int id) {
310 return span->debugSpan(id);
311}
312
313const SkOpAngle* SkPathOpsDebug::DebugSpanAngle(const SkOpSpanBase* span, int id) {
314 return span->debugAngle(id);
315}
316
317SkOpContour* SkPathOpsDebug::DebugSpanContour(SkOpSpanBase* span, int id) {
318 return span->debugContour(id);
319}
320
321const SkOpPtT* SkPathOpsDebug::DebugSpanPtT(const SkOpSpanBase* span, int id) {
322 return span->debugPtT(id);
323}
324
325const SkOpSegment* SkPathOpsDebug::DebugSpanSegment(const SkOpSpanBase* span, int id) {
326 return span->debugSegment(id);
327}
328
329const SkOpSpanBase* SkPathOpsDebug::DebugSpanSpan(const SkOpSpanBase* span, int id) {
330 return span->debugSpan(id);
331}
332
caryclark624637c2015-05-11 07:21:27 -0700333void SkOpContour::dumpContours() const {
334 SkOpContour* contour = this->globalState()->contourHead();
335 do {
336 contour->dump();
337 } while ((contour = contour->next()));
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000338}
339
caryclark624637c2015-05-11 07:21:27 -0700340void SkOpContour::dumpContoursAll() const {
341 SkOpContour* contour = this->globalState()->contourHead();
342 do {
343 contour->dumpAll();
344 } while ((contour = contour->next()));
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000345}
346
caryclark624637c2015-05-11 07:21:27 -0700347void SkOpContour::dumpContoursAngles() const {
348 SkOpContour* contour = this->globalState()->contourHead();
349 do {
350 contour->dumpAngles();
351 } while ((contour = contour->next()));
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000352}
353
caryclark624637c2015-05-11 07:21:27 -0700354void SkOpContour::dumpContoursPts() const {
355 SkOpContour* contour = this->globalState()->contourHead();
356 do {
357 contour->dumpPts();
358 } while ((contour = contour->next()));
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000359}
360
caryclark624637c2015-05-11 07:21:27 -0700361void SkOpContour::dumpContoursPt(int segmentID) const {
362 SkOpContour* contour = this->globalState()->contourHead();
363 do {
364 contour->dumpPt(segmentID);
365 } while ((contour = contour->next()));
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000366}
367
caryclark624637c2015-05-11 07:21:27 -0700368void SkOpContour::dumpContoursSegment(int segmentID) const {
369 SkOpContour* contour = this->globalState()->contourHead();
370 do {
371 contour->dumpSegment(segmentID);
372 } while ((contour = contour->next()));
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000373}
374
caryclark624637c2015-05-11 07:21:27 -0700375void SkOpContour::dumpContoursSpan(int spanID) const {
376 SkOpContour* contour = this->globalState()->contourHead();
377 do {
378 contour->dumpSpan(spanID);
379 } while ((contour = contour->next()));
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000380}
381
caryclark624637c2015-05-11 07:21:27 -0700382void SkOpContour::dumpContoursSpans() const {
383 SkOpContour* contour = this->globalState()->contourHead();
384 do {
385 contour->dumpSpans();
386 } while ((contour = contour->next()));
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000387}
388
caryclark1049f122015-04-20 08:31:59 -0700389template <typename TCurve, typename OppCurve>
390const SkTSpan<TCurve, OppCurve>* DebugSpan(const SkTSect<TCurve, OppCurve>* sect, int id) {
caryclark54359292015-03-26 07:52:43 -0700391 return sect->debugSpan(id);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000392}
393
caryclark1049f122015-04-20 08:31:59 -0700394void DontCallDebugSpan(int id);
395void DontCallDebugSpan(int id) { // exists to instantiate the templates
396 SkDQuad quad;
397 SkDConic conic;
398 SkDCubic cubic;
caryclarke25a4f62016-07-26 09:26:29 -0700399 SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
400 SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
401 SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
402 SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
403 SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
404 SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
405 SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
406 SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
407 SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
caryclark1049f122015-04-20 08:31:59 -0700408 DebugSpan(&q1q2, id);
409 DebugSpan(&q1k2, id);
410 DebugSpan(&q1c2, id);
411 DebugSpan(&k1q2, id);
412 DebugSpan(&k1k2, id);
413 DebugSpan(&k1c2, id);
414 DebugSpan(&c1q2, id);
415 DebugSpan(&c1k2, id);
416 DebugSpan(&c1c2, id);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000417}
418
caryclark1049f122015-04-20 08:31:59 -0700419template <typename TCurve, typename OppCurve>
420const SkTSpan<TCurve, OppCurve>* DebugT(const SkTSect<TCurve, OppCurve>* sect, double t) {
caryclark54359292015-03-26 07:52:43 -0700421 return sect->debugT(t);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000422}
423
caryclark1049f122015-04-20 08:31:59 -0700424void DontCallDebugT(double t);
425void DontCallDebugT(double t) { // exists to instantiate the templates
426 SkDQuad quad;
427 SkDConic conic;
428 SkDCubic cubic;
caryclarke25a4f62016-07-26 09:26:29 -0700429 SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
430 SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
431 SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
432 SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
433 SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
434 SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
435 SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
436 SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
437 SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
caryclark1049f122015-04-20 08:31:59 -0700438 DebugT(&q1q2, t);
439 DebugT(&q1k2, t);
440 DebugT(&q1c2, t);
441 DebugT(&k1q2, t);
442 DebugT(&k1k2, t);
443 DebugT(&k1c2, t);
444 DebugT(&c1q2, t);
445 DebugT(&c1k2, t);
446 DebugT(&c1c2, t);
caryclarkdac1d172014-06-17 05:15:38 -0700447}
448
caryclark1049f122015-04-20 08:31:59 -0700449template <typename TCurve, typename OppCurve>
450void Dump(const SkTSect<TCurve, OppCurve>* sect) {
caryclark54359292015-03-26 07:52:43 -0700451 sect->dump();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000452}
453
caryclark1049f122015-04-20 08:31:59 -0700454void DontCallDumpTSect();
455void DontCallDumpTSect() { // exists to instantiate the templates
456 SkDQuad quad;
457 SkDConic conic;
458 SkDCubic cubic;
caryclarke25a4f62016-07-26 09:26:29 -0700459 SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
460 SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
461 SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
462 SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
463 SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
464 SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
465 SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
466 SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
467 SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
caryclark1049f122015-04-20 08:31:59 -0700468 Dump(&q1q2);
469 Dump(&q1k2);
470 Dump(&q1c2);
471 Dump(&k1q2);
472 Dump(&k1k2);
473 Dump(&k1c2);
474 Dump(&c1q2);
475 Dump(&c1k2);
476 Dump(&c1c2);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000477}
478
caryclark1049f122015-04-20 08:31:59 -0700479template <typename TCurve, typename OppCurve>
480void DumpBoth(SkTSect<TCurve, OppCurve>* sect1, SkTSect<OppCurve, TCurve>* sect2) {
caryclark54359292015-03-26 07:52:43 -0700481 sect1->dumpBoth(sect2);
caryclarkdac1d172014-06-17 05:15:38 -0700482}
483
caryclark1049f122015-04-20 08:31:59 -0700484void DontCallDumpBoth();
485void DontCallDumpBoth() { // exists to instantiate the templates
486 SkDQuad quad;
487 SkDConic conic;
488 SkDCubic cubic;
caryclarke25a4f62016-07-26 09:26:29 -0700489 SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
490 SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
491 SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
492 SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
493 SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
494 SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
495 SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
496 SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
497 SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
caryclark1049f122015-04-20 08:31:59 -0700498 DumpBoth(&q1q2, &q1q2);
499 DumpBoth(&q1k2, &k1q2);
500 DumpBoth(&q1c2, &c1q2);
501 DumpBoth(&k1q2, &q1k2);
502 DumpBoth(&k1k2, &k1k2);
503 DumpBoth(&k1c2, &c1k2);
504 DumpBoth(&c1q2, &q1c2);
505 DumpBoth(&c1k2, &k1c2);
506 DumpBoth(&c1c2, &c1c2);
caryclarkdac1d172014-06-17 05:15:38 -0700507}
508
caryclark1049f122015-04-20 08:31:59 -0700509template <typename TCurve, typename OppCurve>
510void DumpBounded(SkTSect<TCurve, OppCurve>* sect1, int id) {
511 sect1->dumpBounded(id);
512}
513
514void DontCallDumpBounded();
515void DontCallDumpBounded() {
516 SkDQuad quad;
517 SkDConic conic;
518 SkDCubic cubic;
caryclarke25a4f62016-07-26 09:26:29 -0700519 SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
520 SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
521 SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
522 SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
523 SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
524 SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
525 SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
526 SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
527 SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
caryclark1049f122015-04-20 08:31:59 -0700528 DumpBounded(&q1q2, 0);
529 DumpBounded(&q1k2, 0);
530 DumpBounded(&q1c2, 0);
531 DumpBounded(&k1q2, 0);
532 DumpBounded(&k1k2, 0);
533 DumpBounded(&k1c2, 0);
534 DumpBounded(&c1q2, 0);
535 DumpBounded(&c1k2, 0);
536 DumpBounded(&c1c2, 0);
537}
538
539template <typename TCurve, typename OppCurve>
540void DumpBounds(SkTSect<TCurve, OppCurve>* sect1) {
541 sect1->dumpBounds();
542}
543
544void DontCallDumpBounds();
545void DontCallDumpBounds() {
546 SkDQuad quad;
547 SkDConic conic;
548 SkDCubic cubic;
caryclarke25a4f62016-07-26 09:26:29 -0700549 SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
550 SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
551 SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
552 SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
553 SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
554 SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
555 SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
556 SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
557 SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
caryclark1049f122015-04-20 08:31:59 -0700558 DumpBounds(&q1q2);
559 DumpBounds(&q1k2);
560 DumpBounds(&q1c2);
561 DumpBounds(&k1q2);
562 DumpBounds(&k1k2);
563 DumpBounds(&k1c2);
564 DumpBounds(&c1q2);
565 DumpBounds(&c1k2);
566 DumpBounds(&c1c2);
567}
568
569template <typename TCurve, typename OppCurve>
570void DumpCoin(SkTSect<TCurve, OppCurve>* sect1) {
caryclark54359292015-03-26 07:52:43 -0700571 sect1->dumpCoin();
caryclarkdac1d172014-06-17 05:15:38 -0700572}
573
caryclark1049f122015-04-20 08:31:59 -0700574void DontCallDumpCoin();
575void DontCallDumpCoin() { // exists to instantiate the templates
576 SkDQuad quad;
577 SkDConic conic;
578 SkDCubic cubic;
caryclarke25a4f62016-07-26 09:26:29 -0700579 SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
580 SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
581 SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
582 SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
583 SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
584 SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
585 SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
586 SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
587 SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
caryclark1049f122015-04-20 08:31:59 -0700588 DumpCoin(&q1q2);
589 DumpCoin(&q1k2);
590 DumpCoin(&q1c2);
591 DumpCoin(&k1q2);
592 DumpCoin(&k1k2);
593 DumpCoin(&k1c2);
594 DumpCoin(&c1q2);
595 DumpCoin(&c1k2);
596 DumpCoin(&c1c2);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000597}
598
caryclark1049f122015-04-20 08:31:59 -0700599template <typename TCurve, typename OppCurve>
600void DumpCoinCurves(SkTSect<TCurve, OppCurve>* sect1) {
caryclark54359292015-03-26 07:52:43 -0700601 sect1->dumpCoinCurves();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000602}
603
caryclark1049f122015-04-20 08:31:59 -0700604void DontCallDumpCoinCurves();
605void DontCallDumpCoinCurves() { // exists to instantiate the templates
606 SkDQuad quad;
607 SkDConic conic;
608 SkDCubic cubic;
caryclarke25a4f62016-07-26 09:26:29 -0700609 SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
610 SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
611 SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
612 SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
613 SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
614 SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
615 SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
616 SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
617 SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
caryclark1049f122015-04-20 08:31:59 -0700618 DumpCoinCurves(&q1q2);
619 DumpCoinCurves(&q1k2);
620 DumpCoinCurves(&q1c2);
621 DumpCoinCurves(&k1q2);
622 DumpCoinCurves(&k1k2);
623 DumpCoinCurves(&k1c2);
624 DumpCoinCurves(&c1q2);
625 DumpCoinCurves(&c1k2);
626 DumpCoinCurves(&c1c2);
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000627}
628
caryclark1049f122015-04-20 08:31:59 -0700629template <typename TCurve, typename OppCurve>
630void DumpCurves(const SkTSect<TCurve, OppCurve>* sect) {
caryclark54359292015-03-26 07:52:43 -0700631 sect->dumpCurves();
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000632}
633
caryclark1049f122015-04-20 08:31:59 -0700634void DontCallDumpCurves();
635void DontCallDumpCurves() { // exists to instantiate the templates
636 SkDQuad quad;
637 SkDConic conic;
638 SkDCubic cubic;
caryclarke25a4f62016-07-26 09:26:29 -0700639 SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
640 SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
641 SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
642 SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
643 SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
644 SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
645 SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
646 SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
647 SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
caryclark1049f122015-04-20 08:31:59 -0700648 DumpCurves(&q1q2);
649 DumpCurves(&q1k2);
650 DumpCurves(&q1c2);
651 DumpCurves(&k1q2);
652 DumpCurves(&k1k2);
653 DumpCurves(&k1c2);
654 DumpCurves(&c1q2);
655 DumpCurves(&c1k2);
656 DumpCurves(&c1c2);
657}
658
659template <typename TCurve, typename OppCurve>
660void Dump(const SkTSpan<TCurve, OppCurve>* span) {
661 span->dump();
662}
663
664void DontCallDumpTSpan();
665void DontCallDumpTSpan() { // exists to instantiate the templates
666 SkTSpan<SkDQuad, SkDQuad> q1q2; q1q2.debugInit();
667 SkTSpan<SkDQuad, SkDConic> q1k2; q1k2.debugInit();
668 SkTSpan<SkDQuad, SkDCubic> q1c2; q1c2.debugInit();
669 SkTSpan<SkDConic, SkDQuad> k1q2; k1q2.debugInit();
670 SkTSpan<SkDConic, SkDConic> k1k2; k1k2.debugInit();
671 SkTSpan<SkDConic, SkDCubic> k1c2; k1c2.debugInit();
672 SkTSpan<SkDCubic, SkDQuad> c1q2; c1q2.debugInit();
673 SkTSpan<SkDCubic, SkDConic> c1k2; c1k2.debugInit();
674 SkTSpan<SkDCubic, SkDCubic> c1c2; c1c2.debugInit();
675 Dump(&q1q2);
676 Dump(&q1k2);
677 Dump(&q1c2);
678 Dump(&k1q2);
679 Dump(&k1k2);
680 Dump(&k1c2);
681 Dump(&c1q2);
682 Dump(&c1k2);
683 Dump(&c1c2);
684}
685
686template <typename TCurve, typename OppCurve>
caryclark26ad22a2015-10-16 09:03:38 -0700687void DumpAll(const SkTSpan<TCurve, OppCurve>* span) {
688 span->dumpAll();
689}
690
691void DontCallDumpSpanAll();
692void DontCallDumpSpanAll() { // exists to instantiate the templates
693 SkTSpan<SkDQuad, SkDQuad> q1q2; q1q2.debugInit();
694 SkTSpan<SkDQuad, SkDConic> q1k2; q1k2.debugInit();
695 SkTSpan<SkDQuad, SkDCubic> q1c2; q1c2.debugInit();
696 SkTSpan<SkDConic, SkDQuad> k1q2; k1q2.debugInit();
697 SkTSpan<SkDConic, SkDConic> k1k2; k1k2.debugInit();
698 SkTSpan<SkDConic, SkDCubic> k1c2; k1c2.debugInit();
699 SkTSpan<SkDCubic, SkDQuad> c1q2; c1q2.debugInit();
700 SkTSpan<SkDCubic, SkDConic> c1k2; c1k2.debugInit();
701 SkTSpan<SkDCubic, SkDCubic> c1c2; c1c2.debugInit();
702 DumpAll(&q1q2);
703 DumpAll(&q1k2);
704 DumpAll(&q1c2);
705 DumpAll(&k1q2);
706 DumpAll(&k1k2);
707 DumpAll(&k1c2);
708 DumpAll(&c1q2);
709 DumpAll(&c1k2);
710 DumpAll(&c1c2);
711}
712
713template <typename TCurve, typename OppCurve>
714void DumpBounded(const SkTSpan<TCurve, OppCurve>* span) {
715 span->dumpBounded(0);
716}
717
718void DontCallDumpSpanBounded();
719void DontCallDumpSpanBounded() { // exists to instantiate the templates
720 SkTSpan<SkDQuad, SkDQuad> q1q2; q1q2.debugInit();
721 SkTSpan<SkDQuad, SkDConic> q1k2; q1k2.debugInit();
722 SkTSpan<SkDQuad, SkDCubic> q1c2; q1c2.debugInit();
723 SkTSpan<SkDConic, SkDQuad> k1q2; k1q2.debugInit();
724 SkTSpan<SkDConic, SkDConic> k1k2; k1k2.debugInit();
725 SkTSpan<SkDConic, SkDCubic> k1c2; k1c2.debugInit();
726 SkTSpan<SkDCubic, SkDQuad> c1q2; c1q2.debugInit();
727 SkTSpan<SkDCubic, SkDConic> c1k2; c1k2.debugInit();
728 SkTSpan<SkDCubic, SkDCubic> c1c2; c1c2.debugInit();
729 DumpBounded(&q1q2);
730 DumpBounded(&q1k2);
731 DumpBounded(&q1c2);
732 DumpBounded(&k1q2);
733 DumpBounded(&k1k2);
734 DumpBounded(&k1c2);
735 DumpBounded(&c1q2);
736 DumpBounded(&c1k2);
737 DumpBounded(&c1c2);
738}
739
740template <typename TCurve, typename OppCurve>
caryclark1049f122015-04-20 08:31:59 -0700741void DumpCoin(const SkTSpan<TCurve, OppCurve>* span) {
742 span->dumpCoin();
743}
744
745void DontCallDumpSpanCoin();
746void DontCallDumpSpanCoin() { // exists to instantiate the templates
747 SkTSpan<SkDQuad, SkDQuad> q1q2; q1q2.debugInit();
748 SkTSpan<SkDQuad, SkDConic> q1k2; q1k2.debugInit();
749 SkTSpan<SkDQuad, SkDCubic> q1c2; q1c2.debugInit();
750 SkTSpan<SkDConic, SkDQuad> k1q2; k1q2.debugInit();
751 SkTSpan<SkDConic, SkDConic> k1k2; k1k2.debugInit();
752 SkTSpan<SkDConic, SkDCubic> k1c2; k1c2.debugInit();
753 SkTSpan<SkDCubic, SkDQuad> c1q2; c1q2.debugInit();
754 SkTSpan<SkDCubic, SkDConic> c1k2; c1k2.debugInit();
755 SkTSpan<SkDCubic, SkDCubic> c1c2; c1c2.debugInit();
756 DumpCoin(&q1q2);
757 DumpCoin(&q1k2);
758 DumpCoin(&q1c2);
759 DumpCoin(&k1q2);
760 DumpCoin(&k1k2);
761 DumpCoin(&k1c2);
762 DumpCoin(&c1q2);
763 DumpCoin(&c1k2);
764 DumpCoin(&c1c2);
caryclarkdac1d172014-06-17 05:15:38 -0700765}
766
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000767static void dumpTestCase(const SkDQuad& quad1, const SkDQuad& quad2, int testNo) {
caryclark54359292015-03-26 07:52:43 -0700768 SkDebugf("\n<div id=\"quad%d\">\n", testNo);
769 quad1.dumpInner();
770 SkDebugf("}}, ");
commit-bot@chromium.org4431e772014-04-14 17:08:59 +0000771 quad2.dump();
772 SkDebugf("</div>\n\n");
773}
774
775static void dumpTestTrailer() {
776 SkDebugf("</div>\n\n<script type=\"text/javascript\">\n\n");
777 SkDebugf(" var testDivs = [\n");
778}
779
780static void dumpTestList(int testNo, double min) {
781 SkDebugf(" quad%d,", testNo);
782 if (min > 0) {
783 SkDebugf(" // %1.9g", min);
784 }
785 SkDebugf("\n");
786}
787
788void DumpQ(const SkDQuad& quad1, const SkDQuad& quad2, int testNo) {
789 SkDebugf("\n");
790 dumpTestCase(quad1, quad2, testNo);
791 dumpTestTrailer();
792 dumpTestList(testNo, 0);
793 SkDebugf("\n");
794}
795
796void DumpT(const SkDQuad& quad, double t) {
797 SkDLine line = {{quad.ptAtT(t), quad[0]}};
798 line.dump();
799}
caryclark54359292015-03-26 07:52:43 -0700800
801const SkOpAngle* SkOpAngle::debugAngle(int id) const {
802 return this->segment()->debugAngle(id);
803}
804
caryclark55888e42016-07-18 10:01:36 -0700805const SkOpCoincidence* SkOpAngle::debugCoincidence() const {
806 return this->segment()->debugCoincidence();
807}
808
caryclark54359292015-03-26 07:52:43 -0700809SkOpContour* SkOpAngle::debugContour(int id) {
810 return this->segment()->debugContour(id);
811}
812
813const SkOpPtT* SkOpAngle::debugPtT(int id) const {
814 return this->segment()->debugPtT(id);
815}
816
817const SkOpSegment* SkOpAngle::debugSegment(int id) const {
818 return this->segment()->debugSegment(id);
819}
820
caryclark624637c2015-05-11 07:21:27 -0700821int SkOpAngle::debugSign() const {
822 SkASSERT(fStart->t() != fEnd->t());
823 return fStart->t() < fEnd->t() ? -1 : 1;
824}
825
caryclark54359292015-03-26 07:52:43 -0700826const SkOpSpanBase* SkOpAngle::debugSpan(int id) const {
827 return this->segment()->debugSpan(id);
828}
829
830void SkOpAngle::dump() const {
831 dumpOne(true);
832 SkDebugf("\n");
833}
834
835void SkOpAngle::dumpOne(bool functionHeader) const {
836// fSegment->debugValidate();
837 const SkOpSegment* segment = this->segment();
838 const SkOpSpan& mSpan = *fStart->starter(fEnd);
839 if (functionHeader) {
840 SkDebugf("%s ", __FUNCTION__);
841 }
842 SkDebugf("[%d", segment->debugID());
843 SkDebugf("/%d", debugID());
844 SkDebugf("] next=");
845 if (fNext) {
846 SkDebugf("%d", fNext->fStart->segment()->debugID());
847 SkDebugf("/%d", fNext->debugID());
848 } else {
849 SkDebugf("?");
850 }
851 SkDebugf(" sect=%d/%d ", fSectorStart, fSectorEnd);
852 SkDebugf(" s=%1.9g [%d] e=%1.9g [%d]", fStart->t(), fStart->debugID(),
853 fEnd->t(), fEnd->debugID());
caryclark624637c2015-05-11 07:21:27 -0700854 SkDebugf(" sgn=%d windVal=%d", this->debugSign(), mSpan.windValue());
caryclark54359292015-03-26 07:52:43 -0700855
856 SkDebugf(" windSum=");
857 SkPathOpsDebug::WindingPrintf(mSpan.windSum());
858 if (mSpan.oppValue() != 0 || mSpan.oppSum() != SK_MinS32) {
859 SkDebugf(" oppVal=%d", mSpan.oppValue());
860 SkDebugf(" oppSum=");
861 SkPathOpsDebug::WindingPrintf(mSpan.oppSum());
862 }
863 if (mSpan.done()) {
864 SkDebugf(" done");
865 }
866 if (unorderable()) {
867 SkDebugf(" unorderable");
868 }
869 if (segment->operand()) {
870 SkDebugf(" operand");
871 }
caryclark54359292015-03-26 07:52:43 -0700872}
873
874void SkOpAngle::dumpTo(const SkOpSegment* segment, const SkOpAngle* to) const {
875 const SkOpAngle* first = this;
876 const SkOpAngle* next = this;
877 const char* indent = "";
878 do {
879 SkDebugf("%s", indent);
880 next->dumpOne(false);
881 if (segment == next->fStart->segment()) {
882 if (this == fNext) {
883 SkDebugf(" << from");
884 }
885 if (to == fNext) {
886 SkDebugf(" << to");
887 }
888 }
889 SkDebugf("\n");
890 indent = " ";
891 next = next->fNext;
892 } while (next && next != first);
893}
894
895void SkOpAngle::dumpCurves() const {
896 const SkOpAngle* first = this;
897 const SkOpAngle* next = this;
898 do {
899 next->fCurvePart.dumpID(next->segment()->debugID());
900 next = next->fNext;
901 } while (next && next != first);
902}
903
904void SkOpAngle::dumpLoop() const {
905 const SkOpAngle* first = this;
906 const SkOpAngle* next = this;
907 do {
908 next->dumpOne(false);
909 SkDebugf("\n");
910 next = next->fNext;
911 } while (next && next != first);
912}
913
914void SkOpAngle::dumpTest() const {
915 const SkOpAngle* first = this;
916 const SkOpAngle* next = this;
917 do {
918 SkDebugf("{ ");
919 SkOpSegment* segment = next->segment();
920 segment->dumpPts();
921 SkDebugf(", %d, %1.9g, %1.9g, {} },\n", SkPathOpsVerbToPoints(segment->verb()) + 1,
922 next->start()->t(), next->end()->t());
923 next = next->fNext;
924 } while (next && next != first);
925}
926
927bool SkOpPtT::debugMatchID(int id) const {
928 int limit = this->debugLoopLimit(false);
929 int loop = 0;
930 const SkOpPtT* ptT = this;
931 do {
932 if (ptT->debugID() == id) {
933 return true;
934 }
935 } while ((!limit || ++loop <= limit) && (ptT = ptT->next()) && ptT != this);
936 return false;
937}
938
939const SkOpAngle* SkOpPtT::debugAngle(int id) const {
940 return this->span()->debugAngle(id);
941}
942
943SkOpContour* SkOpPtT::debugContour(int id) {
944 return this->span()->debugContour(id);
945}
946
caryclark55888e42016-07-18 10:01:36 -0700947const SkOpCoincidence* SkOpPtT::debugCoincidence() const {
948 return this->span()->debugCoincidence();
949}
950
caryclark54359292015-03-26 07:52:43 -0700951const SkOpPtT* SkOpPtT::debugPtT(int id) const {
952 return this->span()->debugPtT(id);
953}
954
955const SkOpSegment* SkOpPtT::debugSegment(int id) const {
956 return this->span()->debugSegment(id);
957}
958
959const SkOpSpanBase* SkOpPtT::debugSpan(int id) const {
960 return this->span()->debugSpan(id);
961}
962
963void SkOpPtT::dump() const {
964 SkDebugf("seg=%d span=%d ptT=%d",
965 this->segment()->debugID(), this->span()->debugID(), this->debugID());
966 this->dumpBase();
967 SkDebugf("\n");
968}
969
970void SkOpPtT::dumpAll() const {
971 contour()->indentDump();
972 const SkOpPtT* next = this;
973 int limit = debugLoopLimit(true);
974 int loop = 0;
975 do {
976 SkDebugf("%.*s", contour()->debugIndent(), " ");
977 SkDebugf("seg=%d span=%d ptT=%d",
978 next->segment()->debugID(), next->span()->debugID(), next->debugID());
979 next->dumpBase();
980 SkDebugf("\n");
981 if (limit && ++loop >= limit) {
982 SkDebugf("*** abort loop ***\n");
983 break;
984 }
985 } while ((next = next->fNext) && next != this);
986 contour()->outdentDump();
987}
988
989void SkOpPtT::dumpBase() const {
caryclark55888e42016-07-18 10:01:36 -0700990 SkDebugf(" t=%1.9g pt=(%1.9g,%1.9g)%s%s%s", this->fT, this->fPt.fX, this->fPt.fY,
991 this->fCoincident ? " coin" : "",
caryclark54359292015-03-26 07:52:43 -0700992 this->fDuplicatePt ? " dup" : "", this->fDeleted ? " deleted" : "");
993}
994
995const SkOpAngle* SkOpSpanBase::debugAngle(int id) const {
996 return this->segment()->debugAngle(id);
997}
998
caryclark55888e42016-07-18 10:01:36 -0700999const SkOpCoincidence* SkOpSpanBase::debugCoincidence() const {
1000 return this->segment()->debugCoincidence();
1001}
1002
caryclark54359292015-03-26 07:52:43 -07001003SkOpContour* SkOpSpanBase::debugContour(int id) {
1004 return this->segment()->debugContour(id);
1005}
1006
1007const SkOpPtT* SkOpSpanBase::debugPtT(int id) const {
1008 return this->segment()->debugPtT(id);
1009}
1010
1011const SkOpSegment* SkOpSpanBase::debugSegment(int id) const {
1012 return this->segment()->debugSegment(id);
1013}
1014
1015const SkOpSpanBase* SkOpSpanBase::debugSpan(int id) const {
1016 return this->segment()->debugSpan(id);
1017}
1018
1019void SkOpSpanBase::dump() const {
caryclark55888e42016-07-18 10:01:36 -07001020 this->dumpHead();
1021 this->fPtT.dump();
caryclark54359292015-03-26 07:52:43 -07001022}
1023
caryclark55888e42016-07-18 10:01:36 -07001024void SkOpSpanBase::dumpHead() const {
caryclark54359292015-03-26 07:52:43 -07001025 SkDebugf("%.*s", contour()->debugIndent(), " ");
1026 SkDebugf("seg=%d span=%d", this->segment()->debugID(), this->debugID());
1027 this->dumpBase();
1028 SkDebugf("\n");
caryclark55888e42016-07-18 10:01:36 -07001029}
1030
1031void SkOpSpanBase::dumpAll() const {
1032 this->dumpHead();
caryclark54359292015-03-26 07:52:43 -07001033 this->fPtT.dumpAll();
1034}
1035
1036void SkOpSpanBase::dumpBase() const {
1037 if (this->fAligned) {
1038 SkDebugf(" aligned");
1039 }
1040 if (this->fChased) {
1041 SkDebugf(" chased");
1042 }
caryclark55888e42016-07-18 10:01:36 -07001043#ifdef SK_DEBUG
1044 if (this->fDeleted) {
1045 SkDebugf(" deleted");
1046 }
1047#endif
caryclark54359292015-03-26 07:52:43 -07001048 if (!this->final()) {
1049 this->upCast()->dumpSpan();
1050 }
1051 const SkOpSpanBase* coin = this->coinEnd();
1052 if (this != coin) {
1053 SkDebugf(" coinEnd seg/span=%d/%d", coin->segment()->debugID(), coin->debugID());
1054 } else if (this->final() || !this->upCast()->isCoincident()) {
1055 const SkOpPtT* oPt = this->ptT()->next();
1056 SkDebugf(" seg/span=%d/%d", oPt->segment()->debugID(), oPt->span()->debugID());
1057 }
caryclark08bc8482015-04-24 09:08:57 -07001058 SkDebugf(" adds=%d", fSpanAdds);
caryclark54359292015-03-26 07:52:43 -07001059}
1060
1061void SkOpSpanBase::dumpCoin() const {
1062 const SkOpSpan* span = this->upCastable();
1063 if (!span) {
1064 return;
1065 }
1066 if (!span->isCoincident()) {
1067 return;
1068 }
1069 span->dumpCoin();
1070}
1071
1072void SkOpSpan::dumpCoin() const {
1073 const SkOpSpan* coincident = fCoincident;
1074 bool ok = debugCoinLoopCheck();
1075 this->dump();
1076 int loop = 0;
1077 do {
1078 coincident->dump();
1079 if (!ok && ++loop > 10) {
1080 SkDebugf("*** abort loop ***\n");
1081 break;
1082 }
1083 } while ((coincident = coincident->fCoincident) != this);
1084}
1085
1086bool SkOpSpan::dumpSpan() const {
1087 SkOpSpan* coin = fCoincident;
1088 if (this != coin) {
1089 SkDebugf(" coinStart seg/span=%d/%d", coin->segment()->debugID(), coin->debugID());
1090 }
1091 SkDebugf(" windVal=%d", this->windValue());
1092 SkDebugf(" windSum=");
1093 SkPathOpsDebug::WindingPrintf(this->windSum());
1094 if (this->oppValue() != 0 || this->oppSum() != SK_MinS32) {
1095 SkDebugf(" oppVal=%d", this->oppValue());
1096 SkDebugf(" oppSum=");
1097 SkPathOpsDebug::WindingPrintf(this->oppSum());
1098 }
1099 if (this->done()) {
1100 SkDebugf(" done");
1101 }
1102 return this != coin;
1103}
1104
1105const SkOpAngle* SkOpSegment::debugAngle(int id) const {
1106 return this->contour()->debugAngle(id);
1107}
1108
caryclark55888e42016-07-18 10:01:36 -07001109
1110const SkOpCoincidence* SkOpSegment::debugCoincidence() const {
1111 return this->contour()->debugCoincidence();
1112}
1113
caryclark54359292015-03-26 07:52:43 -07001114SkOpContour* SkOpSegment::debugContour(int id) {
1115 return this->contour()->debugContour(id);
1116}
1117
1118const SkOpPtT* SkOpSegment::debugPtT(int id) const {
1119 return this->contour()->debugPtT(id);
1120}
1121
1122const SkOpSegment* SkOpSegment::debugSegment(int id) const {
1123 return this->contour()->debugSegment(id);
1124}
1125
1126const SkOpSpanBase* SkOpSegment::debugSpan(int id) const {
1127 return this->contour()->debugSpan(id);
1128}
1129
1130void SkOpSegment::dump() const {
1131 SkDebugf("%.*s", contour()->debugIndent(), " ");
1132 this->dumpPts();
1133 const SkOpSpanBase* span = &fHead;
1134 contour()->indentDump();
1135 do {
1136 SkDebugf("%.*s span=%d ", contour()->debugIndent(), " ", span->debugID());
1137 span->ptT()->dumpBase();
1138 span->dumpBase();
1139 SkDebugf("\n");
1140 } while (!span->final() && (span = span->upCast()->next()));
1141 contour()->outdentDump();
1142}
1143
1144void SkOpSegment::dumpAll() const {
1145 SkDebugf("%.*s", contour()->debugIndent(), " ");
1146 this->dumpPts();
1147 const SkOpSpanBase* span = &fHead;
1148 contour()->indentDump();
1149 do {
1150 span->dumpAll();
1151 } while (!span->final() && (span = span->upCast()->next()));
1152 contour()->outdentDump();
1153}
1154
1155void SkOpSegment::dumpAngles() const {
1156 SkDebugf("seg=%d\n", debugID());
1157 const SkOpSpanBase* span = &fHead;
1158 do {
1159 const SkOpAngle* fAngle = span->fromAngle();
halcanary96fcdcc2015-08-27 07:41:13 -07001160 const SkOpAngle* tAngle = span->final() ? nullptr : span->upCast()->toAngle();
caryclark54359292015-03-26 07:52:43 -07001161 if (fAngle) {
1162 SkDebugf(" span=%d from=%d ", span->debugID(), fAngle->debugID());
1163 fAngle->dumpTo(this, tAngle);
1164 }
1165 if (tAngle) {
1166 SkDebugf(" span=%d to=%d ", span->debugID(), tAngle->debugID());
1167 tAngle->dumpTo(this, fAngle);
1168 }
1169 } while (!span->final() && (span = span->upCast()->next()));
1170}
1171
1172void SkOpSegment::dumpCoin() const {
1173 const SkOpSpan* span = &fHead;
1174 do {
1175 span->dumpCoin();
1176 } while ((span = span->next()->upCastable()));
1177}
1178
caryclark26ad22a2015-10-16 09:03:38 -07001179void SkOpSegment::dumpPtsInner(const char* prefix) const {
caryclark54359292015-03-26 07:52:43 -07001180 int last = SkPathOpsVerbToPoints(fVerb);
caryclark26ad22a2015-10-16 09:03:38 -07001181 SkDebugf("%s=%d {{", prefix, this->debugID());
caryclark1049f122015-04-20 08:31:59 -07001182 if (fVerb == SkPath::kConic_Verb) {
1183 SkDebugf("{");
1184 }
caryclark54359292015-03-26 07:52:43 -07001185 int index = 0;
1186 do {
1187 SkDPoint::Dump(fPts[index]);
1188 SkDebugf(", ");
1189 } while (++index < last);
1190 SkDPoint::Dump(fPts[index]);
caryclark1049f122015-04-20 08:31:59 -07001191 SkDebugf("}}");
1192 if (fVerb == SkPath::kConic_Verb) {
1193 SkDebugf(", %1.9gf}", fWeight);
1194 }
caryclark624637c2015-05-11 07:21:27 -07001195}
1196
caryclark26ad22a2015-10-16 09:03:38 -07001197void SkOpSegment::dumpPts(const char* prefix) const {
1198 dumpPtsInner(prefix);
caryclark1049f122015-04-20 08:31:59 -07001199 SkDebugf("\n");
caryclark54359292015-03-26 07:52:43 -07001200}
1201
1202void SkCoincidentSpans::dump() const {
1203 SkDebugf("- seg=%d span=%d ptT=%d ", fCoinPtTStart->segment()->debugID(),
1204 fCoinPtTStart->span()->debugID(), fCoinPtTStart->debugID());
1205 fCoinPtTStart->dumpBase();
1206 SkDebugf(" span=%d ptT=%d ", fCoinPtTEnd->span()->debugID(), fCoinPtTEnd->debugID());
1207 fCoinPtTEnd->dumpBase();
1208 if (fCoinPtTStart->segment()->operand()) {
1209 SkDebugf(" operand");
1210 }
1211 if (fCoinPtTStart->segment()->isXor()) {
1212 SkDebugf(" xor");
1213 }
1214 SkDebugf("\n");
1215 SkDebugf("+ seg=%d span=%d ptT=%d ", fOppPtTStart->segment()->debugID(),
1216 fOppPtTStart->span()->debugID(), fOppPtTStart->debugID());
1217 fOppPtTStart->dumpBase();
1218 SkDebugf(" span=%d ptT=%d ", fOppPtTEnd->span()->debugID(), fOppPtTEnd->debugID());
1219 fOppPtTEnd->dumpBase();
1220 if (fOppPtTStart->segment()->operand()) {
1221 SkDebugf(" operand");
1222 }
1223 if (fOppPtTStart->segment()->isXor()) {
1224 SkDebugf(" xor");
1225 }
1226 SkDebugf("\n");
1227}
1228
1229void SkOpCoincidence::dump() const {
1230 SkCoincidentSpans* span = fHead;
1231 while (span) {
1232 span->dump();
caryclark55888e42016-07-18 10:01:36 -07001233 span = span->next();
caryclark54359292015-03-26 07:52:43 -07001234 }
caryclark26ad22a2015-10-16 09:03:38 -07001235 if (!fTop || fHead == fTop) {
caryclark27c8eb82015-07-06 11:38:33 -07001236 return;
1237 }
1238 SkDebugf("top:\n");
1239 span = fTop;
caryclark55888e42016-07-18 10:01:36 -07001240 int count = 0;
caryclark27c8eb82015-07-06 11:38:33 -07001241 while (span) {
1242 span->dump();
caryclark55888e42016-07-18 10:01:36 -07001243 span = span->next();
1244 SkCoincidentSpans* check = fTop;
1245 ++count;
1246 for (int index = 0; index < count; ++index) {
1247 if (span == check) {
1248 SkDebugf("(loops to #%d)\n", index);
1249 return;
1250 }
1251 check = check->next();
1252 }
caryclark27c8eb82015-07-06 11:38:33 -07001253 }
caryclark54359292015-03-26 07:52:43 -07001254}
1255
caryclark624637c2015-05-11 07:21:27 -07001256void SkOpContour::dump() const {
caryclark1049f122015-04-20 08:31:59 -07001257 SkDebugf("contour=%d count=%d op=%d xor=%d\n", this->debugID(), fCount, fOperand, fXor);
caryclark54359292015-03-26 07:52:43 -07001258 if (!fCount) {
1259 return;
1260 }
1261 const SkOpSegment* segment = &fHead;
caryclark624637c2015-05-11 07:21:27 -07001262 SkDEBUGCODE(fDebugIndent = 0);
1263 this->indentDump();
caryclark54359292015-03-26 07:52:43 -07001264 do {
1265 segment->dump();
1266 } while ((segment = segment->next()));
caryclark624637c2015-05-11 07:21:27 -07001267 this->outdentDump();
caryclark54359292015-03-26 07:52:43 -07001268}
1269
caryclark624637c2015-05-11 07:21:27 -07001270void SkOpContour::dumpAll() const {
caryclark1049f122015-04-20 08:31:59 -07001271 SkDebugf("contour=%d count=%d op=%d xor=%d\n", this->debugID(), fCount, fOperand, fXor);
caryclark54359292015-03-26 07:52:43 -07001272 if (!fCount) {
1273 return;
1274 }
1275 const SkOpSegment* segment = &fHead;
caryclark624637c2015-05-11 07:21:27 -07001276 SkDEBUGCODE(fDebugIndent = 0);
1277 this->indentDump();
caryclark54359292015-03-26 07:52:43 -07001278 do {
1279 segment->dumpAll();
1280 } while ((segment = segment->next()));
caryclark624637c2015-05-11 07:21:27 -07001281 this->outdentDump();
caryclark54359292015-03-26 07:52:43 -07001282}
1283
1284
1285void SkOpContour::dumpAngles() const {
1286 SkDebugf("contour=%d\n", this->debugID());
1287 const SkOpSegment* segment = &fHead;
1288 do {
1289 SkDebugf(" seg=%d ", segment->debugID());
1290 segment->dumpAngles();
1291 } while ((segment = segment->next()));
1292}
1293
1294void SkOpContour::dumpPt(int index) const {
1295 const SkOpSegment* segment = &fHead;
1296 do {
1297 if (segment->debugID() == index) {
1298 segment->dumpPts();
1299 }
1300 } while ((segment = segment->next()));
1301}
1302
caryclark26ad22a2015-10-16 09:03:38 -07001303void SkOpContour::dumpPts(const char* prefix) const {
caryclark54359292015-03-26 07:52:43 -07001304 SkDebugf("contour=%d\n", this->debugID());
1305 const SkOpSegment* segment = &fHead;
1306 do {
caryclark26ad22a2015-10-16 09:03:38 -07001307 SkDebugf(" %s=%d ", prefix, segment->debugID());
1308 segment->dumpPts(prefix);
caryclark54359292015-03-26 07:52:43 -07001309 } while ((segment = segment->next()));
1310}
1311
caryclark26ad22a2015-10-16 09:03:38 -07001312void SkOpContour::dumpPtsX(const char* prefix) const {
caryclark54359292015-03-26 07:52:43 -07001313 if (!this->fCount) {
1314 SkDebugf("<empty>\n");
1315 return;
1316 }
1317 const SkOpSegment* segment = &fHead;
1318 do {
caryclark26ad22a2015-10-16 09:03:38 -07001319 segment->dumpPts(prefix);
caryclark54359292015-03-26 07:52:43 -07001320 } while ((segment = segment->next()));
1321}
1322
1323void SkOpContour::dumpSegment(int index) const {
1324 debugSegment(index)->dump();
1325}
1326
caryclark26ad22a2015-10-16 09:03:38 -07001327void SkOpContour::dumpSegments(const char* prefix, SkPathOp op) const {
caryclark54359292015-03-26 07:52:43 -07001328 bool firstOp = false;
1329 const SkOpContour* c = this;
1330 do {
caryclark26ad22a2015-10-16 09:03:38 -07001331 if (!firstOp && c->operand() && op >= 0) {
caryclark54359292015-03-26 07:52:43 -07001332#if DEBUG_ACTIVE_OP
1333 SkDebugf("op %s\n", SkPathOpsDebug::kPathOpStr[op]);
1334#endif
1335 firstOp = true;
1336 }
caryclark26ad22a2015-10-16 09:03:38 -07001337 c->dumpPtsX(prefix);
caryclark54359292015-03-26 07:52:43 -07001338 } while ((c = c->next()));
1339}
1340
1341void SkOpContour::dumpSpan(int index) const {
1342 debugSpan(index)->dump();
1343}
1344
1345void SkOpContour::dumpSpans() const {
1346 SkDebugf("contour=%d\n", this->debugID());
1347 const SkOpSegment* segment = &fHead;
1348 do {
1349 SkDebugf(" seg=%d ", segment->debugID());
1350 segment->dump();
1351 } while ((segment = segment->next()));
1352}
1353
caryclark03b03ca2015-04-23 09:13:37 -07001354void SkOpCurve::dump() const {
1355 int count = SkPathOpsVerbToPoints(SkDEBUGRELEASE(fVerb, SkPath::kCubic_Verb));
1356 SkDebugf("{{");
1357 int index;
1358 for (index = 0; index <= count - 1; ++index) {
1359 SkDebugf("{%1.9gf,%1.9gf}, ", fPts[index].fX, fPts[index].fY);
1360 }
1361 SkDebugf("{%1.9gf,%1.9gf}}}\n", fPts[index].fX, fPts[index].fY);
1362}
1363
caryclark54359292015-03-26 07:52:43 -07001364#ifdef SK_DEBUG
1365const SkOpAngle* SkOpGlobalState::debugAngle(int id) const {
caryclark624637c2015-05-11 07:21:27 -07001366 const SkOpContour* contour = fContourHead;
caryclark54359292015-03-26 07:52:43 -07001367 do {
1368 const SkOpSegment* segment = contour->first();
1369 while (segment) {
1370 const SkOpSpan* span = segment->head();
1371 do {
1372 SkOpAngle* angle = span->fromAngle();
1373 if (angle && angle->debugID() == id) {
1374 return angle;
1375 }
1376 angle = span->toAngle();
1377 if (angle && angle->debugID() == id) {
1378 return angle;
1379 }
1380 } while ((span = span->next()->upCastable()));
1381 const SkOpSpanBase* tail = segment->tail();
1382 SkOpAngle* angle = tail->fromAngle();
1383 if (angle && angle->debugID() == id) {
1384 return angle;
1385 }
1386 segment = segment->next();
1387 }
1388 } while ((contour = contour->next()));
halcanary96fcdcc2015-08-27 07:41:13 -07001389 return nullptr;
caryclark54359292015-03-26 07:52:43 -07001390}
1391
1392SkOpContour* SkOpGlobalState::debugContour(int id) {
caryclark624637c2015-05-11 07:21:27 -07001393 SkOpContour* contour = fContourHead;
caryclark54359292015-03-26 07:52:43 -07001394 do {
1395 if (contour->debugID() == id) {
1396 return contour;
1397 }
1398 } while ((contour = contour->next()));
halcanary96fcdcc2015-08-27 07:41:13 -07001399 return nullptr;
caryclark54359292015-03-26 07:52:43 -07001400}
1401
1402const SkOpPtT* SkOpGlobalState::debugPtT(int id) const {
caryclark624637c2015-05-11 07:21:27 -07001403 const SkOpContour* contour = fContourHead;
caryclark54359292015-03-26 07:52:43 -07001404 do {
1405 const SkOpSegment* segment = contour->first();
1406 while (segment) {
1407 const SkOpSpan* span = segment->head();
1408 do {
1409 const SkOpPtT* ptT = span->ptT();
1410 if (ptT->debugMatchID(id)) {
1411 return ptT;
1412 }
1413 } while ((span = span->next()->upCastable()));
1414 const SkOpSpanBase* tail = segment->tail();
1415 const SkOpPtT* ptT = tail->ptT();
1416 if (ptT->debugMatchID(id)) {
1417 return ptT;
1418 }
1419 segment = segment->next();
1420 }
1421 } while ((contour = contour->next()));
halcanary96fcdcc2015-08-27 07:41:13 -07001422 return nullptr;
caryclark54359292015-03-26 07:52:43 -07001423}
1424
1425const SkOpSegment* SkOpGlobalState::debugSegment(int id) const {
caryclark624637c2015-05-11 07:21:27 -07001426 const SkOpContour* contour = fContourHead;
caryclark54359292015-03-26 07:52:43 -07001427 do {
1428 const SkOpSegment* segment = contour->first();
1429 while (segment) {
1430 if (segment->debugID() == id) {
1431 return segment;
1432 }
1433 segment = segment->next();
1434 }
1435 } while ((contour = contour->next()));
halcanary96fcdcc2015-08-27 07:41:13 -07001436 return nullptr;
caryclark54359292015-03-26 07:52:43 -07001437}
1438
1439const SkOpSpanBase* SkOpGlobalState::debugSpan(int id) const {
caryclark624637c2015-05-11 07:21:27 -07001440 const SkOpContour* contour = fContourHead;
caryclark54359292015-03-26 07:52:43 -07001441 do {
1442 const SkOpSegment* segment = contour->first();
1443 while (segment) {
1444 const SkOpSpan* span = segment->head();
1445 do {
1446 if (span->debugID() == id) {
1447 return span;
1448 }
1449 } while ((span = span->next()->upCastable()));
1450 const SkOpSpanBase* tail = segment->tail();
1451 if (tail->debugID() == id) {
1452 return tail;
1453 }
1454 segment = segment->next();
1455 }
1456 } while ((contour = contour->next()));
halcanary96fcdcc2015-08-27 07:41:13 -07001457 return nullptr;
caryclark54359292015-03-26 07:52:43 -07001458}
1459#endif
1460
caryclark54359292015-03-26 07:52:43 -07001461#if DEBUG_T_SECT_DUMP > 1
1462int gDumpTSectNum;
1463#endif