PathOpsDebug.cpp 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525
  1. /*
  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. #include "include/core/SkString.h"
  8. #include "include/private/SkMutex.h"
  9. #include "src/pathops/SkIntersectionHelper.h"
  10. #include "src/pathops/SkOpCoincidence.h"
  11. #include "src/pathops/SkOpContour.h"
  12. #include "src/pathops/SkOpSegment.h"
  13. #include "tests/PathOpsDebug.h"
  14. #include "tests/PathOpsTSectDebug.h"
  15. bool PathOpsDebug::gJson;
  16. bool PathOpsDebug::gMarkJsonFlaky;
  17. bool PathOpsDebug::gOutFirst;
  18. bool PathOpsDebug::gCheckForDuplicateNames;
  19. bool PathOpsDebug::gOutputSVG;
  20. FILE* PathOpsDebug::gOut;
  21. inline void DebugDumpDouble(double x) {
  22. if (x == floor(x)) {
  23. SkDebugf("%.0f", x);
  24. } else {
  25. SkDebugf("%1.19g", x);
  26. }
  27. }
  28. inline void DebugDumpFloat(float x) {
  29. if (x == floorf(x)) {
  30. SkDebugf("%.0f", x);
  31. } else {
  32. SkDebugf("%1.9gf", x);
  33. }
  34. }
  35. inline void DebugDumpHexFloat(float x) {
  36. SkDebugf("SkBits2Float(0x%08x)", SkFloat2Bits(x));
  37. }
  38. // if not defined by PathOpsDebug.cpp ...
  39. #if !defined SK_DEBUG && FORCE_RELEASE
  40. bool SkPathOpsDebug::ValidWind(int wind) {
  41. return wind > SK_MinS32 + 0xFFFF && wind < SK_MaxS32 - 0xFFFF;
  42. }
  43. void SkPathOpsDebug::WindingPrintf(int wind) {
  44. if (wind == SK_MinS32) {
  45. SkDebugf("?");
  46. } else {
  47. SkDebugf("%d", wind);
  48. }
  49. }
  50. #endif
  51. static void DumpID(int id) {
  52. SkDebugf("} ");
  53. if (id >= 0) {
  54. SkDebugf("id=%d", id);
  55. }
  56. SkDebugf("\n");
  57. }
  58. void SkDConic::dump() const {
  59. dumpInner();
  60. SkDebugf("},\n");
  61. }
  62. void SkDConic::dumpID(int id) const {
  63. dumpInner();
  64. DumpID(id);
  65. }
  66. void SkDConic::dumpInner() const {
  67. SkDebugf("{");
  68. fPts.dumpInner();
  69. SkDebugf("}}, %1.9gf", fWeight);
  70. }
  71. void SkDCubic::dump() const {
  72. this->dumpInner();
  73. SkDebugf("}},\n");
  74. }
  75. void SkDCubic::dumpID(int id) const {
  76. this->dumpInner();
  77. SkDebugf("}");
  78. DumpID(id);
  79. }
  80. static inline bool double_is_NaN(double x) { return x != x; }
  81. void SkDCubic::dumpInner() const {
  82. SkDebugf("{{");
  83. int index = 0;
  84. do {
  85. if (index != 0) {
  86. if (double_is_NaN(fPts[index].fX) && double_is_NaN(fPts[index].fY)) {
  87. return;
  88. }
  89. SkDebugf(", ");
  90. }
  91. fPts[index].dump();
  92. } while (++index < 3);
  93. if (double_is_NaN(fPts[index].fX) && double_is_NaN(fPts[index].fY)) {
  94. return;
  95. }
  96. SkDebugf(", ");
  97. fPts[index].dump();
  98. }
  99. void SkDCurve::dump() const {
  100. dumpID(-1);
  101. }
  102. void SkDCurve::dumpID(int id) const {
  103. #ifndef SK_RELEASE
  104. switch(fVerb) {
  105. case SkPath::kLine_Verb:
  106. fLine.dumpID(id);
  107. break;
  108. case SkPath::kQuad_Verb:
  109. fQuad.dumpID(id);
  110. break;
  111. case SkPath::kConic_Verb:
  112. fConic.dumpID(id);
  113. break;
  114. case SkPath::kCubic_Verb:
  115. fCubic.dumpID(id);
  116. break;
  117. default:
  118. SkASSERT(0);
  119. }
  120. #else
  121. fCubic.dumpID(id);
  122. #endif
  123. }
  124. void SkDLine::dump() const {
  125. this->dumpInner();
  126. SkDebugf("}},\n");
  127. }
  128. void SkDLine::dumpID(int id) const {
  129. this->dumpInner();
  130. SkDebugf("}");
  131. DumpID(id);
  132. }
  133. void SkDLine::dumpInner() const {
  134. SkDebugf("{{");
  135. fPts[0].dump();
  136. SkDebugf(", ");
  137. fPts[1].dump();
  138. }
  139. void SkDPoint::dump() const {
  140. SkDebugf("{");
  141. DebugDumpDouble(fX);
  142. SkDebugf(", ");
  143. DebugDumpDouble(fY);
  144. SkDebugf("}");
  145. }
  146. void SkDPoint::Dump(const SkPoint& pt) {
  147. SkDebugf("{");
  148. DebugDumpFloat(pt.fX);
  149. SkDebugf(", ");
  150. DebugDumpFloat(pt.fY);
  151. SkDebugf("}");
  152. }
  153. void SkDPoint::DumpHex(const SkPoint& pt) {
  154. SkDebugf("{");
  155. DebugDumpHexFloat(pt.fX);
  156. SkDebugf(", ");
  157. DebugDumpHexFloat(pt.fY);
  158. SkDebugf("}");
  159. }
  160. void SkDQuad::dump() const {
  161. dumpInner();
  162. SkDebugf("}},\n");
  163. }
  164. void SkDQuad::dumpID(int id) const {
  165. dumpInner();
  166. SkDebugf("}");
  167. DumpID(id);
  168. }
  169. void SkDQuad::dumpInner() const {
  170. SkDebugf("{{");
  171. int index = 0;
  172. do {
  173. fPts[index].dump();
  174. SkDebugf(", ");
  175. } while (++index < 2);
  176. fPts[index].dump();
  177. }
  178. void SkIntersections::dump() const {
  179. SkDebugf("used=%d of %d", fUsed, fMax);
  180. for (int index = 0; index < fUsed; ++index) {
  181. SkDebugf(" t=(%s%1.9g,%s%1.9g) pt=(%1.9g,%1.9g)",
  182. fIsCoincident[0] & (1 << index) ? "*" : "", fT[0][index],
  183. fIsCoincident[1] & (1 << index) ? "*" : "", fT[1][index],
  184. fPt[index].fX, fPt[index].fY);
  185. if (index < 2 && fNearlySame[index]) {
  186. SkDebugf(" pt2=(%1.9g,%1.9g)",fPt2[index].fX, fPt2[index].fY);
  187. }
  188. }
  189. SkDebugf("\n");
  190. }
  191. const SkOpAngle* AngleAngle(const SkOpAngle* angle, int id) {
  192. return angle->debugAngle(id);
  193. }
  194. SkOpContour* AngleContour(SkOpAngle* angle, int id) {
  195. return angle->debugContour(id);
  196. }
  197. const SkOpPtT* AnglePtT(const SkOpAngle* angle, int id) {
  198. return angle->debugPtT(id);
  199. }
  200. const SkOpSegment* AngleSegment(const SkOpAngle* angle, int id) {
  201. return angle->debugSegment(id);
  202. }
  203. const SkOpSpanBase* AngleSpan(const SkOpAngle* angle, int id) {
  204. return angle->debugSpan(id);
  205. }
  206. const SkOpAngle* ContourAngle(SkOpContour* contour, int id) {
  207. return contour->debugAngle(id);
  208. }
  209. SkOpContour* ContourContour(SkOpContour* contour, int id) {
  210. return contour->debugContour(id);
  211. }
  212. const SkOpPtT* ContourPtT(SkOpContour* contour, int id) {
  213. return contour->debugPtT(id);
  214. }
  215. const SkOpSegment* ContourSegment(SkOpContour* contour, int id) {
  216. return contour->debugSegment(id);
  217. }
  218. const SkOpSpanBase* ContourSpan(SkOpContour* contour, int id) {
  219. return contour->debugSpan(id);
  220. }
  221. const SkOpAngle* CoincidenceAngle(SkOpCoincidence* coin, int id) {
  222. return coin->debugAngle(id);
  223. }
  224. SkOpContour* CoincidenceContour(SkOpCoincidence* coin, int id) {
  225. return coin->debugContour(id);
  226. }
  227. const SkOpPtT* CoincidencePtT(SkOpCoincidence* coin, int id) {
  228. return coin->debugPtT(id);
  229. }
  230. const SkOpSegment* CoincidenceSegment(SkOpCoincidence* coin, int id) {
  231. return coin->debugSegment(id);
  232. }
  233. const SkOpSpanBase* CoincidenceSpan(SkOpCoincidence* coin, int id) {
  234. return coin->debugSpan(id);
  235. }
  236. const SkOpAngle* PtTAngle(const SkOpPtT* ptT, int id) {
  237. return ptT->debugAngle(id);
  238. }
  239. SkOpContour* PtTContour(SkOpPtT* ptT, int id) {
  240. return ptT->debugContour(id);
  241. }
  242. const SkOpPtT* PtTPtT(const SkOpPtT* ptT, int id) {
  243. return ptT->debugPtT(id);
  244. }
  245. const SkOpSegment* PtTSegment(const SkOpPtT* ptT, int id) {
  246. return ptT->debugSegment(id);
  247. }
  248. const SkOpSpanBase* PtTSpan(const SkOpPtT* ptT, int id) {
  249. return ptT->debugSpan(id);
  250. }
  251. const SkOpAngle* SegmentAngle(const SkOpSegment* span, int id) {
  252. return span->debugAngle(id);
  253. }
  254. SkOpContour* SegmentContour(SkOpSegment* span, int id) {
  255. return span->debugContour(id);
  256. }
  257. const SkOpPtT* SegmentPtT(const SkOpSegment* span, int id) {
  258. return span->debugPtT(id);
  259. }
  260. const SkOpSegment* SegmentSegment(const SkOpSegment* span, int id) {
  261. return span->debugSegment(id);
  262. }
  263. const SkOpSpanBase* SegmentSpan(const SkOpSegment* span, int id) {
  264. return span->debugSpan(id);
  265. }
  266. const SkOpAngle* SpanAngle(const SkOpSpanBase* span, int id) {
  267. return span->debugAngle(id);
  268. }
  269. SkOpContour* SpanContour(SkOpSpanBase* span, int id) {
  270. return span->debugContour(id);
  271. }
  272. const SkOpPtT* SpanPtT(const SkOpSpanBase* span, int id) {
  273. return span->debugPtT(id);
  274. }
  275. const SkOpSegment* SpanSegment(const SkOpSpanBase* span, int id) {
  276. return span->debugSegment(id);
  277. }
  278. const SkOpSpanBase* SpanSpan(const SkOpSpanBase* span, int id) {
  279. return span->debugSpan(id);
  280. }
  281. #if DEBUG_COIN
  282. void SkPathOpsDebug::DumpCoinDict() {
  283. SkPathOpsDebug::gCoinSumChangedDict.dump("unused coin algorithm", false);
  284. SkPathOpsDebug::gCoinSumVisitedDict.dump("visited coin function", true);
  285. }
  286. void SkPathOpsDebug::CoinDict::dump(const char* str, bool visitCheck) const {
  287. int count = fDict.count();
  288. for (int index = 0; index < count; ++index) {
  289. const auto& entry = fDict[index];
  290. if (visitCheck || entry.fGlitchType == kUninitialized_Glitch) {
  291. SkDebugf("%s %s : line %d iteration %d", str, entry.fFunctionName,
  292. entry.fLineNumber, entry.fIteration);
  293. DumpGlitchType(entry.fGlitchType);
  294. SkDebugf("\n");
  295. }
  296. }
  297. }
  298. #endif
  299. void SkOpContour::dumpContours() const {
  300. SkOpContour* contour = this->globalState()->contourHead();
  301. do {
  302. contour->dump();
  303. } while ((contour = contour->next()));
  304. }
  305. void SkOpContour::dumpContoursAll() const {
  306. SkOpContour* contour = this->globalState()->contourHead();
  307. do {
  308. contour->dumpAll();
  309. } while ((contour = contour->next()));
  310. }
  311. void SkOpContour::dumpContoursAngles() const {
  312. SkOpContour* contour = this->globalState()->contourHead();
  313. do {
  314. contour->dumpAngles();
  315. } while ((contour = contour->next()));
  316. }
  317. void SkOpContour::dumpContoursPts() const {
  318. SkOpContour* contour = this->globalState()->contourHead();
  319. do {
  320. contour->dumpPts();
  321. } while ((contour = contour->next()));
  322. }
  323. void SkOpContour::dumpContoursPt(int segmentID) const {
  324. SkOpContour* contour = this->globalState()->contourHead();
  325. do {
  326. contour->dumpPt(segmentID);
  327. } while ((contour = contour->next()));
  328. }
  329. void SkOpContour::dumpContoursSegment(int segmentID) const {
  330. SkOpContour* contour = this->globalState()->contourHead();
  331. do {
  332. contour->dumpSegment(segmentID);
  333. } while ((contour = contour->next()));
  334. }
  335. void SkOpContour::dumpContoursSpan(int spanID) const {
  336. SkOpContour* contour = this->globalState()->contourHead();
  337. do {
  338. contour->dumpSpan(spanID);
  339. } while ((contour = contour->next()));
  340. }
  341. void SkOpContour::dumpContoursSpans() const {
  342. SkOpContour* contour = this->globalState()->contourHead();
  343. do {
  344. contour->dumpSpans();
  345. } while ((contour = contour->next()));
  346. }
  347. #ifdef SK_DEBUG
  348. const SkTSpan* DebugSpan(const SkTSect* sect, int id) {
  349. return sect->debugSpan(id);
  350. }
  351. const SkTSpan* DebugT(const SkTSect* sect, double t) {
  352. return sect->debugT(t);
  353. }
  354. #endif
  355. void Dump(const SkTSect* sect) {
  356. sect->dump();
  357. }
  358. void DumpBoth(SkTSect* sect1, SkTSect* sect2) {
  359. sect1->dumpBoth(sect2);
  360. }
  361. void DumpBounded(SkTSect* sect1, int id) {
  362. sect1->dumpBounded(id);
  363. }
  364. void DumpBounds(SkTSect* sect1) {
  365. sect1->dumpBounds();
  366. }
  367. void DumpCoin(SkTSect* sect1) {
  368. sect1->dumpCoin();
  369. }
  370. void DumpCoinCurves(SkTSect* sect1) {
  371. sect1->dumpCoinCurves();
  372. }
  373. void DumpCurves(const SkTSect* sect) {
  374. sect->dumpCurves();
  375. }
  376. void Dump(const SkTSpan* span) {
  377. span->dump();
  378. }
  379. void DumpAll(const SkTSpan* span) {
  380. span->dumpAll();
  381. }
  382. void DumpBounded(const SkTSpan* span) {
  383. span->dumpBounded(0);
  384. }
  385. void DumpCoin(const SkTSpan* span) {
  386. span->dumpCoin();
  387. }
  388. static void dumpTestCase(const SkDQuad& quad1, const SkDQuad& quad2, int testNo) {
  389. SkDebugf("\n<div id=\"quad%d\">\n", testNo);
  390. quad1.dumpInner();
  391. SkDebugf("}}, ");
  392. quad2.dump();
  393. SkDebugf("</div>\n\n");
  394. }
  395. static void dumpTestTrailer() {
  396. SkDebugf("</div>\n\n<script type=\"text/javascript\">\n\n");
  397. SkDebugf(" var testDivs = [\n");
  398. }
  399. static void dumpTestList(int testNo, double min) {
  400. SkDebugf(" quad%d,", testNo);
  401. if (min > 0) {
  402. SkDebugf(" // %1.9g", min);
  403. }
  404. SkDebugf("\n");
  405. }
  406. void DumpQ(const SkDQuad& quad1, const SkDQuad& quad2, int testNo) {
  407. SkDebugf("\n");
  408. dumpTestCase(quad1, quad2, testNo);
  409. dumpTestTrailer();
  410. dumpTestList(testNo, 0);
  411. SkDebugf("\n");
  412. }
  413. void DumpT(const SkDQuad& quad, double t) {
  414. SkDLine line = {{quad.ptAtT(t), quad[0]}};
  415. line.dump();
  416. }
  417. const SkOpAngle* SkOpAngle::debugAngle(int id) const {
  418. return this->segment()->debugAngle(id);
  419. }
  420. const SkOpCoincidence* SkOpAngle::debugCoincidence() const {
  421. return this->segment()->debugCoincidence();
  422. }
  423. SkOpContour* SkOpAngle::debugContour(int id) const {
  424. return this->segment()->debugContour(id);
  425. }
  426. const SkOpPtT* SkOpAngle::debugPtT(int id) const {
  427. return this->segment()->debugPtT(id);
  428. }
  429. const SkOpSegment* SkOpAngle::debugSegment(int id) const {
  430. return this->segment()->debugSegment(id);
  431. }
  432. int SkOpAngle::debugSign() const {
  433. SkASSERT(fStart->t() != fEnd->t());
  434. return fStart->t() < fEnd->t() ? -1 : 1;
  435. }
  436. const SkOpSpanBase* SkOpAngle::debugSpan(int id) const {
  437. return this->segment()->debugSpan(id);
  438. }
  439. void SkOpAngle::dump() const {
  440. dumpOne(true);
  441. SkDebugf("\n");
  442. }
  443. void SkOpAngle::dumpOne(bool functionHeader) const {
  444. // fSegment->debugValidate();
  445. const SkOpSegment* segment = this->segment();
  446. const SkOpSpan& mSpan = *fStart->starter(fEnd);
  447. if (functionHeader) {
  448. SkDebugf("%s ", __FUNCTION__);
  449. }
  450. SkDebugf("[%d", segment->debugID());
  451. SkDebugf("/%d", debugID());
  452. SkDebugf("] next=");
  453. if (fNext) {
  454. SkDebugf("%d", fNext->fStart->segment()->debugID());
  455. SkDebugf("/%d", fNext->debugID());
  456. } else {
  457. SkDebugf("?");
  458. }
  459. SkDebugf(" sect=%d/%d ", fSectorStart, fSectorEnd);
  460. SkDebugf(" s=%1.9g [%d] e=%1.9g [%d]", fStart->t(), fStart->debugID(),
  461. fEnd->t(), fEnd->debugID());
  462. SkDebugf(" sgn=%d windVal=%d", this->debugSign(), mSpan.windValue());
  463. SkDebugf(" windSum=");
  464. SkPathOpsDebug::WindingPrintf(mSpan.windSum());
  465. if (mSpan.oppValue() != 0 || mSpan.oppSum() != SK_MinS32) {
  466. SkDebugf(" oppVal=%d", mSpan.oppValue());
  467. SkDebugf(" oppSum=");
  468. SkPathOpsDebug::WindingPrintf(mSpan.oppSum());
  469. }
  470. if (mSpan.done()) {
  471. SkDebugf(" done");
  472. }
  473. if (unorderable()) {
  474. SkDebugf(" unorderable");
  475. }
  476. if (segment->operand()) {
  477. SkDebugf(" operand");
  478. }
  479. }
  480. void SkOpAngle::dumpTo(const SkOpSegment* segment, const SkOpAngle* to) const {
  481. const SkOpAngle* first = this;
  482. const SkOpAngle* next = this;
  483. const char* indent = "";
  484. do {
  485. SkDebugf("%s", indent);
  486. next->dumpOne(false);
  487. if (segment == next->fStart->segment()) {
  488. if (this == fNext) {
  489. SkDebugf(" << from");
  490. }
  491. if (to == fNext) {
  492. SkDebugf(" << to");
  493. }
  494. }
  495. SkDebugf("\n");
  496. indent = " ";
  497. next = next->fNext;
  498. } while (next && next != first);
  499. }
  500. void SkOpAngle::dumpCurves() const {
  501. const SkOpAngle* first = this;
  502. const SkOpAngle* next = this;
  503. do {
  504. next->fPart.fCurve.dumpID(next->segment()->debugID());
  505. next = next->fNext;
  506. } while (next && next != first);
  507. }
  508. void SkOpAngle::dumpLoop() const {
  509. const SkOpAngle* first = this;
  510. const SkOpAngle* next = this;
  511. do {
  512. next->dumpOne(false);
  513. SkDebugf("\n");
  514. next = next->fNext;
  515. } while (next && next != first);
  516. }
  517. void SkOpAngle::dumpTest() const {
  518. const SkOpAngle* first = this;
  519. const SkOpAngle* next = this;
  520. do {
  521. SkDebugf("{ ");
  522. SkOpSegment* segment = next->segment();
  523. segment->dumpPts();
  524. SkDebugf(", %d, %1.9g, %1.9g, {} },\n", SkPathOpsVerbToPoints(segment->verb()) + 1,
  525. next->start()->t(), next->end()->t());
  526. next = next->fNext;
  527. } while (next && next != first);
  528. }
  529. bool SkOpPtT::debugMatchID(int id) const {
  530. int limit = this->debugLoopLimit(false);
  531. int loop = 0;
  532. const SkOpPtT* ptT = this;
  533. do {
  534. if (ptT->debugID() == id) {
  535. return true;
  536. }
  537. } while ((!limit || ++loop <= limit) && (ptT = ptT->next()) && ptT != this);
  538. return false;
  539. }
  540. const SkOpAngle* SkOpPtT::debugAngle(int id) const {
  541. return this->span()->debugAngle(id);
  542. }
  543. SkOpContour* SkOpPtT::debugContour(int id) const {
  544. return this->span()->debugContour(id);
  545. }
  546. const SkOpCoincidence* SkOpPtT::debugCoincidence() const {
  547. return this->span()->debugCoincidence();
  548. }
  549. const SkOpPtT* SkOpPtT::debugPtT(int id) const {
  550. return this->span()->debugPtT(id);
  551. }
  552. const SkOpSegment* SkOpPtT::debugSegment(int id) const {
  553. return this->span()->debugSegment(id);
  554. }
  555. const SkOpSpanBase* SkOpPtT::debugSpan(int id) const {
  556. return this->span()->debugSpan(id);
  557. }
  558. void SkOpPtT::dump() const {
  559. SkDebugf("seg=%d span=%d ptT=%d",
  560. this->segment()->debugID(), this->span()->debugID(), this->debugID());
  561. this->dumpBase();
  562. SkDebugf("\n");
  563. }
  564. void SkOpPtT::dumpAll() const {
  565. contour()->indentDump();
  566. const SkOpPtT* next = this;
  567. int limit = debugLoopLimit(true);
  568. int loop = 0;
  569. do {
  570. SkDebugf("%.*s", contour()->debugIndent(), " ");
  571. SkDebugf("seg=%d span=%d ptT=%d",
  572. next->segment()->debugID(), next->span()->debugID(), next->debugID());
  573. next->dumpBase();
  574. SkDebugf("\n");
  575. if (limit && ++loop >= limit) {
  576. SkDebugf("*** abort loop ***\n");
  577. break;
  578. }
  579. } while ((next = next->fNext) && next != this);
  580. contour()->outdentDump();
  581. }
  582. void SkOpPtT::dumpBase() const {
  583. SkDebugf(" t=%1.9g pt=(%1.9g,%1.9g)%s%s%s", this->fT, this->fPt.fX, this->fPt.fY,
  584. this->fCoincident ? " coin" : "",
  585. this->fDuplicatePt ? " dup" : "", this->fDeleted ? " deleted" : "");
  586. }
  587. const SkOpAngle* SkOpSpanBase::debugAngle(int id) const {
  588. return this->segment()->debugAngle(id);
  589. }
  590. const SkOpCoincidence* SkOpSpanBase::debugCoincidence() const {
  591. return this->segment()->debugCoincidence();
  592. }
  593. SkOpContour* SkOpSpanBase::debugContour(int id) const {
  594. return this->segment()->debugContour(id);
  595. }
  596. const SkOpPtT* SkOpSpanBase::debugPtT(int id) const {
  597. return this->segment()->debugPtT(id);
  598. }
  599. const SkOpSegment* SkOpSpanBase::debugSegment(int id) const {
  600. return this->segment()->debugSegment(id);
  601. }
  602. const SkOpSpanBase* SkOpSpanBase::debugSpan(int id) const {
  603. return this->segment()->debugSpan(id);
  604. }
  605. void SkOpSpanBase::dump() const {
  606. this->dumpHead();
  607. this->fPtT.dump();
  608. }
  609. void SkOpSpanBase::dumpHead() const {
  610. SkDebugf("%.*s", contour()->debugIndent(), " ");
  611. SkDebugf("seg=%d span=%d", this->segment()->debugID(), this->debugID());
  612. this->dumpBase();
  613. SkDebugf("\n");
  614. }
  615. void SkOpSpanBase::dumpAll() const {
  616. this->dumpHead();
  617. this->fPtT.dumpAll();
  618. }
  619. void SkOpSpanBase::dumpBase() const {
  620. if (this->fAligned) {
  621. SkDebugf(" aligned");
  622. }
  623. if (this->fChased) {
  624. SkDebugf(" chased");
  625. }
  626. #ifdef SK_DEBUG
  627. if (this->fDebugDeleted) {
  628. SkDebugf(" deleted");
  629. }
  630. #endif
  631. if (!this->final()) {
  632. this->upCast()->dumpSpan();
  633. }
  634. const SkOpSpanBase* coin = this->coinEnd();
  635. if (this != coin) {
  636. SkDebugf(" coinEnd seg/span=%d/%d", coin->segment()->debugID(), coin->debugID());
  637. } else if (this->final() || !this->upCast()->isCoincident()) {
  638. const SkOpPtT* oPt = this->ptT()->next();
  639. SkDebugf(" seg/span=%d/%d", oPt->segment()->debugID(), oPt->span()->debugID());
  640. }
  641. SkDebugf(" adds=%d", fSpanAdds);
  642. }
  643. void SkOpSpanBase::dumpCoin() const {
  644. const SkOpSpan* span = this->upCastable();
  645. if (!span) {
  646. return;
  647. }
  648. if (!span->isCoincident()) {
  649. return;
  650. }
  651. span->dumpCoin();
  652. }
  653. void SkOpSpan::dumpCoin() const {
  654. const SkOpSpan* coincident = fCoincident;
  655. bool ok = debugCoinLoopCheck();
  656. this->dump();
  657. int loop = 0;
  658. do {
  659. coincident->dump();
  660. if (!ok && ++loop > 10) {
  661. SkDebugf("*** abort loop ***\n");
  662. break;
  663. }
  664. } while ((coincident = coincident->fCoincident) != this);
  665. }
  666. bool SkOpSpan::dumpSpan() const {
  667. SkOpSpan* coin = fCoincident;
  668. if (this != coin) {
  669. SkDebugf(" coinStart seg/span=%d/%d", coin->segment()->debugID(), coin->debugID());
  670. }
  671. SkDebugf(" windVal=%d", this->windValue());
  672. SkDebugf(" windSum=");
  673. SkPathOpsDebug::WindingPrintf(this->windSum());
  674. if (this->oppValue() != 0 || this->oppSum() != SK_MinS32) {
  675. SkDebugf(" oppVal=%d", this->oppValue());
  676. SkDebugf(" oppSum=");
  677. SkPathOpsDebug::WindingPrintf(this->oppSum());
  678. }
  679. if (this->done()) {
  680. SkDebugf(" done");
  681. }
  682. return this != coin;
  683. }
  684. const SkOpAngle* SkOpSegment::debugAngle(int id) const {
  685. return this->contour()->debugAngle(id);
  686. }
  687. const SkOpCoincidence* SkOpSegment::debugCoincidence() const {
  688. return this->contour()->debugCoincidence();
  689. }
  690. SkOpContour* SkOpSegment::debugContour(int id) const {
  691. return this->contour()->debugContour(id);
  692. }
  693. const SkOpPtT* SkOpSegment::debugPtT(int id) const {
  694. return this->contour()->debugPtT(id);
  695. }
  696. const SkOpSegment* SkOpSegment::debugSegment(int id) const {
  697. return this->contour()->debugSegment(id);
  698. }
  699. const SkOpSpanBase* SkOpSegment::debugSpan(int id) const {
  700. return this->contour()->debugSpan(id);
  701. }
  702. void SkOpSegment::dump() const {
  703. SkDebugf("%.*s", contour()->debugIndent(), " ");
  704. this->dumpPts();
  705. const SkOpSpanBase* span = &fHead;
  706. contour()->indentDump();
  707. do {
  708. SkDebugf("%.*s span=%d ", contour()->debugIndent(), " ", span->debugID());
  709. span->ptT()->dumpBase();
  710. span->dumpBase();
  711. SkDebugf("\n");
  712. } while (!span->final() && (span = span->upCast()->next()));
  713. contour()->outdentDump();
  714. }
  715. void SkOpSegment::dumpAll() const {
  716. SkDebugf("%.*s", contour()->debugIndent(), " ");
  717. this->dumpPts();
  718. const SkOpSpanBase* span = &fHead;
  719. contour()->indentDump();
  720. do {
  721. span->dumpAll();
  722. } while (!span->final() && (span = span->upCast()->next()));
  723. contour()->outdentDump();
  724. }
  725. void SkOpSegment::dumpAngles() const {
  726. SkDebugf("seg=%d\n", debugID());
  727. const SkOpSpanBase* span = &fHead;
  728. do {
  729. const SkOpAngle* fAngle = span->fromAngle();
  730. const SkOpAngle* tAngle = span->final() ? nullptr : span->upCast()->toAngle();
  731. if (fAngle) {
  732. SkDebugf(" span=%d from=%d ", span->debugID(), fAngle->debugID());
  733. fAngle->dumpTo(this, tAngle);
  734. }
  735. if (tAngle) {
  736. SkDebugf(" span=%d to=%d ", span->debugID(), tAngle->debugID());
  737. tAngle->dumpTo(this, fAngle);
  738. }
  739. } while (!span->final() && (span = span->upCast()->next()));
  740. }
  741. void SkOpSegment::dumpCoin() const {
  742. const SkOpSpan* span = &fHead;
  743. do {
  744. span->dumpCoin();
  745. } while ((span = span->next()->upCastable()));
  746. }
  747. void SkOpSegment::dumpPtsInner(const char* prefix) const {
  748. int last = SkPathOpsVerbToPoints(fVerb);
  749. SkDebugf("%s=%d {{", prefix, this->debugID());
  750. if (fVerb == SkPath::kConic_Verb) {
  751. SkDebugf("{");
  752. }
  753. int index = 0;
  754. do {
  755. SkDPoint::Dump(fPts[index]);
  756. SkDebugf(", ");
  757. } while (++index < last);
  758. SkDPoint::Dump(fPts[index]);
  759. SkDebugf("}}");
  760. if (fVerb == SkPath::kConic_Verb) {
  761. SkDebugf(", %1.9gf}", fWeight);
  762. }
  763. }
  764. void SkOpSegment::dumpPts(const char* prefix) const {
  765. dumpPtsInner(prefix);
  766. SkDebugf("\n");
  767. }
  768. void SkCoincidentSpans::dump() const {
  769. SkDebugf("- seg=%d span=%d ptT=%d ", fCoinPtTStart->segment()->debugID(),
  770. fCoinPtTStart->span()->debugID(), fCoinPtTStart->debugID());
  771. fCoinPtTStart->dumpBase();
  772. SkDebugf(" span=%d ptT=%d ", fCoinPtTEnd->span()->debugID(), fCoinPtTEnd->debugID());
  773. fCoinPtTEnd->dumpBase();
  774. if (fCoinPtTStart->segment()->operand()) {
  775. SkDebugf(" operand");
  776. }
  777. if (fCoinPtTStart->segment()->isXor()) {
  778. SkDebugf(" xor");
  779. }
  780. SkDebugf("\n");
  781. SkDebugf("+ seg=%d span=%d ptT=%d ", fOppPtTStart->segment()->debugID(),
  782. fOppPtTStart->span()->debugID(), fOppPtTStart->debugID());
  783. fOppPtTStart->dumpBase();
  784. SkDebugf(" span=%d ptT=%d ", fOppPtTEnd->span()->debugID(), fOppPtTEnd->debugID());
  785. fOppPtTEnd->dumpBase();
  786. if (fOppPtTStart->segment()->operand()) {
  787. SkDebugf(" operand");
  788. }
  789. if (fOppPtTStart->segment()->isXor()) {
  790. SkDebugf(" xor");
  791. }
  792. SkDebugf("\n");
  793. }
  794. void SkOpCoincidence::dump() const {
  795. SkCoincidentSpans* span = fHead;
  796. while (span) {
  797. span->dump();
  798. span = span->next();
  799. }
  800. if (!fTop || fHead == fTop) {
  801. return;
  802. }
  803. SkDebugf("top:\n");
  804. span = fTop;
  805. int count = 0;
  806. while (span) {
  807. span->dump();
  808. span = span->next();
  809. SkCoincidentSpans* check = fTop;
  810. ++count;
  811. for (int index = 0; index < count; ++index) {
  812. if (span == check) {
  813. SkDebugf("(loops to #%d)\n", index);
  814. return;
  815. }
  816. check = check->next();
  817. }
  818. }
  819. }
  820. void SkOpContour::dump() const {
  821. SkDebugf("contour=%d count=%d op=%d xor=%d\n", this->debugID(), fCount, fOperand, fXor);
  822. if (!fCount) {
  823. return;
  824. }
  825. const SkOpSegment* segment = &fHead;
  826. SkDEBUGCODE(fDebugIndent = 0);
  827. this->indentDump();
  828. do {
  829. segment->dump();
  830. } while ((segment = segment->next()));
  831. this->outdentDump();
  832. }
  833. void SkOpContour::dumpAll() const {
  834. SkDebugf("contour=%d count=%d op=%d xor=%d\n", this->debugID(), fCount, fOperand, fXor);
  835. if (!fCount) {
  836. return;
  837. }
  838. const SkOpSegment* segment = &fHead;
  839. SkDEBUGCODE(fDebugIndent = 0);
  840. this->indentDump();
  841. do {
  842. segment->dumpAll();
  843. } while ((segment = segment->next()));
  844. this->outdentDump();
  845. }
  846. void SkOpContour::dumpAngles() const {
  847. SkDebugf("contour=%d\n", this->debugID());
  848. const SkOpSegment* segment = &fHead;
  849. do {
  850. SkDebugf(" seg=%d ", segment->debugID());
  851. segment->dumpAngles();
  852. } while ((segment = segment->next()));
  853. }
  854. void SkOpContour::dumpPt(int index) const {
  855. const SkOpSegment* segment = &fHead;
  856. do {
  857. if (segment->debugID() == index) {
  858. segment->dumpPts();
  859. }
  860. } while ((segment = segment->next()));
  861. }
  862. void SkOpContour::dumpPts(const char* prefix) const {
  863. SkDebugf("contour=%d\n", this->debugID());
  864. const SkOpSegment* segment = &fHead;
  865. do {
  866. SkDebugf(" %s=%d ", prefix, segment->debugID());
  867. segment->dumpPts(prefix);
  868. } while ((segment = segment->next()));
  869. }
  870. void SkOpContour::dumpPtsX(const char* prefix) const {
  871. if (!this->fCount) {
  872. SkDebugf("<empty>\n");
  873. return;
  874. }
  875. const SkOpSegment* segment = &fHead;
  876. do {
  877. segment->dumpPts(prefix);
  878. } while ((segment = segment->next()));
  879. }
  880. void SkOpContour::dumpSegment(int index) const {
  881. debugSegment(index)->dump();
  882. }
  883. void SkOpContour::dumpSegments(const char* prefix, SkPathOp op) const {
  884. bool firstOp = false;
  885. const SkOpContour* c = this;
  886. do {
  887. if (!firstOp && c->operand()) {
  888. #if DEBUG_ACTIVE_OP
  889. SkDebugf("op %s\n", SkPathOpsDebug::kPathOpStr[op]);
  890. #endif
  891. firstOp = true;
  892. }
  893. c->dumpPtsX(prefix);
  894. } while ((c = c->next()));
  895. }
  896. void SkOpContour::dumpSpan(int index) const {
  897. debugSpan(index)->dump();
  898. }
  899. void SkOpContour::dumpSpans() const {
  900. SkDebugf("contour=%d\n", this->debugID());
  901. const SkOpSegment* segment = &fHead;
  902. do {
  903. SkDebugf(" seg=%d ", segment->debugID());
  904. segment->dump();
  905. } while ((segment = segment->next()));
  906. }
  907. void SkOpCurve::dump() const {
  908. int count = SkPathOpsVerbToPoints(SkDEBUGRELEASE(fVerb, SkPath::kCubic_Verb));
  909. SkDebugf("{{");
  910. int index;
  911. for (index = 0; index <= count - 1; ++index) {
  912. SkDebugf("{%1.9gf,%1.9gf}, ", fPts[index].fX, fPts[index].fY);
  913. }
  914. SkDebugf("{%1.9gf,%1.9gf}}}\n", fPts[index].fX, fPts[index].fY);
  915. }
  916. #ifdef SK_DEBUG
  917. const SkOpAngle* SkOpGlobalState::debugAngle(int id) const {
  918. const SkOpContour* contour = fContourHead;
  919. do {
  920. const SkOpSegment* segment = contour->first();
  921. while (segment) {
  922. const SkOpSpan* span = segment->head();
  923. do {
  924. SkOpAngle* angle = span->fromAngle();
  925. if (angle && angle->debugID() == id) {
  926. return angle;
  927. }
  928. angle = span->toAngle();
  929. if (angle && angle->debugID() == id) {
  930. return angle;
  931. }
  932. } while ((span = span->next()->upCastable()));
  933. const SkOpSpanBase* tail = segment->tail();
  934. SkOpAngle* angle = tail->fromAngle();
  935. if (angle && angle->debugID() == id) {
  936. return angle;
  937. }
  938. segment = segment->next();
  939. }
  940. } while ((contour = contour->next()));
  941. return nullptr;
  942. }
  943. SkOpContour* SkOpGlobalState::debugContour(int id) const {
  944. SkOpContour* contour = fContourHead;
  945. do {
  946. if (contour->debugID() == id) {
  947. return contour;
  948. }
  949. } while ((contour = contour->next()));
  950. return nullptr;
  951. }
  952. const SkOpPtT* SkOpGlobalState::debugPtT(int id) const {
  953. const SkOpContour* contour = fContourHead;
  954. do {
  955. const SkOpSegment* segment = contour->first();
  956. while (segment) {
  957. const SkOpSpan* span = segment->head();
  958. do {
  959. const SkOpPtT* ptT = span->ptT();
  960. if (ptT->debugMatchID(id)) {
  961. return ptT;
  962. }
  963. } while ((span = span->next()->upCastable()));
  964. const SkOpSpanBase* tail = segment->tail();
  965. const SkOpPtT* ptT = tail->ptT();
  966. if (ptT->debugMatchID(id)) {
  967. return ptT;
  968. }
  969. segment = segment->next();
  970. }
  971. } while ((contour = contour->next()));
  972. return nullptr;
  973. }
  974. const SkOpSegment* SkOpGlobalState::debugSegment(int id) const {
  975. const SkOpContour* contour = fContourHead;
  976. do {
  977. const SkOpSegment* segment = contour->first();
  978. while (segment) {
  979. if (segment->debugID() == id) {
  980. return segment;
  981. }
  982. segment = segment->next();
  983. }
  984. } while ((contour = contour->next()));
  985. return nullptr;
  986. }
  987. const SkOpSpanBase* SkOpGlobalState::debugSpan(int id) const {
  988. const SkOpContour* contour = fContourHead;
  989. do {
  990. const SkOpSegment* segment = contour->first();
  991. while (segment) {
  992. const SkOpSpan* span = segment->head();
  993. do {
  994. if (span->debugID() == id) {
  995. return span;
  996. }
  997. } while ((span = span->next()->upCastable()));
  998. const SkOpSpanBase* tail = segment->tail();
  999. if (tail->debugID() == id) {
  1000. return tail;
  1001. }
  1002. segment = segment->next();
  1003. }
  1004. } while ((contour = contour->next()));
  1005. return nullptr;
  1006. }
  1007. #endif
  1008. char SkTCoincident::dumpIsCoincidentStr() const {
  1009. if (!!fMatch != fMatch) {
  1010. return '?';
  1011. }
  1012. return fMatch ? '*' : 0;
  1013. }
  1014. void SkTCoincident::dump() const {
  1015. SkDebugf("t=%1.9g pt=(%1.9g,%1.9g)%s\n", fPerpT, fPerpPt.fX, fPerpPt.fY,
  1016. fMatch ? " match" : "");
  1017. }
  1018. #ifdef SK_DEBUG
  1019. const SkTSpan* SkTSect::debugSpan(int id) const {
  1020. const SkTSpan* test = fHead;
  1021. do {
  1022. if (test->debugID() == id) {
  1023. return test;
  1024. }
  1025. } while ((test = test->next()));
  1026. return nullptr;
  1027. }
  1028. const SkTSpan* SkTSect::debugT(double t) const {
  1029. const SkTSpan* test = fHead;
  1030. const SkTSpan* closest = nullptr;
  1031. double bestDist = DBL_MAX;
  1032. do {
  1033. if (between(test->fStartT, t, test->fEndT)) {
  1034. return test;
  1035. }
  1036. double testDist = SkTMin(fabs(test->fStartT - t), fabs(test->fEndT - t));
  1037. if (bestDist > testDist) {
  1038. bestDist = testDist;
  1039. closest = test;
  1040. }
  1041. } while ((test = test->next()));
  1042. SkASSERT(closest);
  1043. return closest;
  1044. }
  1045. #endif
  1046. void SkTSect::dump() const {
  1047. dumpCommon(fHead);
  1048. }
  1049. extern int gDumpTSectNum;
  1050. void SkTSect::dumpBoth(SkTSect* opp) const {
  1051. #if DEBUG_T_SECT_DUMP <= 2
  1052. #if DEBUG_T_SECT_DUMP == 2
  1053. SkDebugf("%d ", ++gDumpTSectNum);
  1054. #endif
  1055. this->dump();
  1056. SkDebugf("\n");
  1057. opp->dump();
  1058. SkDebugf("\n");
  1059. #elif DEBUG_T_SECT_DUMP == 3
  1060. SkDebugf("<div id=\"sect%d\">\n", ++gDumpTSectNum);
  1061. if (this->fHead) {
  1062. this->dumpCurves();
  1063. }
  1064. if (opp->fHead) {
  1065. opp->dumpCurves();
  1066. }
  1067. SkDebugf("</div>\n\n");
  1068. #endif
  1069. }
  1070. void SkTSect::dumpBounded(int id) const {
  1071. #ifdef SK_DEBUG
  1072. const SkTSpan* bounded = debugSpan(id);
  1073. if (!bounded) {
  1074. SkDebugf("no span matches %d\n", id);
  1075. return;
  1076. }
  1077. const SkTSpan* test = bounded->debugOpp()->fHead;
  1078. do {
  1079. if (test->findOppSpan(bounded)) {
  1080. test->dump();
  1081. SkDebugf(" ");
  1082. }
  1083. } while ((test = test->next()));
  1084. SkDebugf("\n");
  1085. #endif
  1086. }
  1087. void SkTSect::dumpBounds() const {
  1088. const SkTSpan* test = fHead;
  1089. do {
  1090. test->dumpBounds();
  1091. } while ((test = test->next()));
  1092. }
  1093. void SkTSect::dumpCoin() const {
  1094. dumpCommon(fCoincident);
  1095. }
  1096. void SkTSect::dumpCoinCurves() const {
  1097. dumpCommonCurves(fCoincident);
  1098. }
  1099. void SkTSect::dumpCommon(const SkTSpan* test) const {
  1100. SkDebugf("id=%d", debugID());
  1101. if (!test) {
  1102. SkDebugf(" (empty)");
  1103. return;
  1104. }
  1105. do {
  1106. SkDebugf(" ");
  1107. test->dump();
  1108. } while ((test = test->next()));
  1109. }
  1110. void SkTSect::dumpCommonCurves(const SkTSpan* test) const {
  1111. #if DEBUG_T_SECT
  1112. do {
  1113. test->fPart->dumpID(test->debugID());
  1114. } while ((test = test->next()));
  1115. #endif
  1116. }
  1117. void SkTSect::dumpCurves() const {
  1118. dumpCommonCurves(fHead);
  1119. }
  1120. #ifdef SK_DEBUG
  1121. const SkTSpan* SkTSpan::debugSpan(int id) const {
  1122. return fDebugSect->debugSpan(id);
  1123. }
  1124. const SkTSpan* SkTSpan::debugT(double t) const {
  1125. return fDebugSect->debugT(t);
  1126. }
  1127. #endif
  1128. void SkTSpan::dumpAll() const {
  1129. dumpID();
  1130. SkDebugf("=(%g,%g) [", fStartT, fEndT);
  1131. const SkTSpanBounded* testBounded = fBounded;
  1132. while (testBounded) {
  1133. const SkTSpan* span = testBounded->fBounded;
  1134. const SkTSpanBounded* next = testBounded->fNext;
  1135. span->dumpID();
  1136. SkDebugf("=(%g,%g)", span->fStartT, span->fEndT);
  1137. if (next) {
  1138. SkDebugf(" ");
  1139. }
  1140. testBounded = next;
  1141. }
  1142. SkDebugf("]\n");
  1143. }
  1144. void SkTSpan::dump() const {
  1145. dumpID();
  1146. SkDebugf("=(%g,%g) [", fStartT, fEndT);
  1147. const SkTSpanBounded* testBounded = fBounded;
  1148. while (testBounded) {
  1149. const SkTSpan* span = testBounded->fBounded;
  1150. const SkTSpanBounded* next = testBounded->fNext;
  1151. span->dumpID();
  1152. if (next) {
  1153. SkDebugf(",");
  1154. }
  1155. testBounded = next;
  1156. }
  1157. SkDebugf("]");
  1158. }
  1159. void SkTSpan::dumpBounded(int id) const {
  1160. SkDEBUGCODE(fDebugSect->dumpBounded(id));
  1161. }
  1162. void SkTSpan::dumpBounds() const {
  1163. dumpID();
  1164. SkDebugf(" bounds=(%1.9g,%1.9g, %1.9g,%1.9g) boundsMax=%1.9g%s\n",
  1165. fBounds.fLeft, fBounds.fTop, fBounds.fRight, fBounds.fBottom, fBoundsMax,
  1166. fCollapsed ? " collapsed" : "");
  1167. }
  1168. void SkTSpan::dumpCoin() const {
  1169. dumpID();
  1170. SkDebugf(" coinStart ");
  1171. fCoinStart.dump();
  1172. SkDebugf(" coinEnd ");
  1173. fCoinEnd.dump();
  1174. }
  1175. void SkTSpan::dumpID() const {
  1176. char cS = fCoinStart.dumpIsCoincidentStr();
  1177. if (cS) {
  1178. SkDebugf("%c", cS);
  1179. }
  1180. SkDebugf("%d", debugID());
  1181. char cE = fCoinEnd.dumpIsCoincidentStr();
  1182. if (cE) {
  1183. SkDebugf("%c", cE);
  1184. }
  1185. }
  1186. #if DEBUG_T_SECT_DUMP > 1
  1187. int gDumpTSectNum;
  1188. #endif
  1189. // global path dumps for msvs Visual Studio 17 to use from Immediate Window
  1190. void Dump(const SkOpContour& contour) {
  1191. contour.dump();
  1192. }
  1193. void DumpAll(const SkOpContour& contour) {
  1194. contour.dumpAll();
  1195. }
  1196. void DumpAngles(const SkOpContour& contour) {
  1197. contour.dumpAngles();
  1198. }
  1199. void DumpContours(const SkOpContour& contour) {
  1200. contour.dumpContours();
  1201. }
  1202. void DumpContoursAll(const SkOpContour& contour) {
  1203. contour.dumpContoursAll();
  1204. }
  1205. void DumpContoursAngles(const SkOpContour& contour) {
  1206. contour.dumpContoursAngles();
  1207. }
  1208. void DumpContoursPts(const SkOpContour& contour) {
  1209. contour.dumpContoursPts();
  1210. }
  1211. void DumpContoursPt(const SkOpContour& contour, int segmentID) {
  1212. contour.dumpContoursPt(segmentID);
  1213. }
  1214. void DumpContoursSegment(const SkOpContour& contour, int segmentID) {
  1215. contour.dumpContoursSegment(segmentID);
  1216. }
  1217. void DumpContoursSpan(const SkOpContour& contour, int segmentID) {
  1218. contour.dumpContoursSpan(segmentID);
  1219. }
  1220. void DumpContoursSpans(const SkOpContour& contour) {
  1221. contour.dumpContoursSpans();
  1222. }
  1223. void DumpPt(const SkOpContour& contour, int pt) {
  1224. contour.dumpPt(pt);
  1225. }
  1226. void DumpPts(const SkOpContour& contour, const char* prefix) {
  1227. contour.dumpPts(prefix);
  1228. }
  1229. void DumpSegment(const SkOpContour& contour, int seg) {
  1230. contour.dumpSegment(seg);
  1231. }
  1232. void DumpSegments(const SkOpContour& contour, const char* prefix, SkPathOp op) {
  1233. contour.dumpSegments(prefix, op);
  1234. }
  1235. void DumpSpan(const SkOpContour& contour, int span) {
  1236. contour.dumpSpan(span);
  1237. }
  1238. void DumpSpans(const SkOpContour& contour ) {
  1239. contour.dumpSpans();
  1240. }
  1241. void Dump(const SkOpSegment& segment) {
  1242. segment.dump();
  1243. }
  1244. void DumpAll(const SkOpSegment& segment) {
  1245. segment.dumpAll();
  1246. }
  1247. void DumpAngles(const SkOpSegment& segment) {
  1248. segment.dumpAngles();
  1249. }
  1250. void DumpCoin(const SkOpSegment& segment) {
  1251. segment.dumpCoin();
  1252. }
  1253. void DumpPts(const SkOpSegment& segment, const char* prefix) {
  1254. segment.dumpPts(prefix);
  1255. }
  1256. void Dump(const SkOpPtT& ptT) {
  1257. ptT.dump();
  1258. }
  1259. void DumpAll(const SkOpPtT& ptT) {
  1260. ptT.dumpAll();
  1261. }
  1262. void Dump(const SkOpSpanBase& spanBase) {
  1263. spanBase.dump();
  1264. }
  1265. void DumpCoin(const SkOpSpanBase& spanBase) {
  1266. spanBase.dumpCoin();
  1267. }
  1268. void DumpAll(const SkOpSpanBase& spanBase) {
  1269. spanBase.dumpAll();
  1270. }
  1271. void DumpCoin(const SkOpSpan& span) {
  1272. span.dumpCoin();
  1273. }
  1274. bool DumpSpan(const SkOpSpan& span) {
  1275. return span.dumpSpan();
  1276. }
  1277. void Dump(const SkDConic& conic) {
  1278. conic.dump();
  1279. }
  1280. void DumpID(const SkDConic& conic, int id) {
  1281. conic.dumpID(id);
  1282. }
  1283. void Dump(const SkDCubic& cubic) {
  1284. cubic.dump();
  1285. }
  1286. void DumpID(const SkDCubic& cubic, int id) {
  1287. cubic.dumpID(id);
  1288. }
  1289. void Dump(const SkDLine& line) {
  1290. line.dump();
  1291. }
  1292. void DumpID(const SkDLine& line, int id) {
  1293. line.dumpID(id);
  1294. }
  1295. void Dump(const SkDQuad& quad) {
  1296. quad.dump();
  1297. }
  1298. void DumpID(const SkDQuad& quad, int id) {
  1299. quad.dumpID(id);
  1300. }
  1301. void Dump(const SkDPoint& point) {
  1302. point.dump();
  1303. }
  1304. void Dump(const SkOpAngle& angle) {
  1305. angle.dump();
  1306. }