caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 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 | |
| 8 | #include "PathOpsTSectDebug.h" |
| 9 | #include "SkOpCoincidence.h" |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 10 | #include "SkOpContour.h" |
| 11 | #include "SkIntersectionHelper.h" |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 12 | #include "SkMutex.h" |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 13 | #include "SkOpSegment.h" |
caryclark | 19eb3b2 | 2014-07-18 05:08:14 -0700 | [diff] [blame] | 14 | #include "SkString.h" |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 15 | |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 16 | extern bool FLAGS_runFail; |
| 17 | |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 18 | inline void DebugDumpDouble(double x) { |
| 19 | if (x == floor(x)) { |
| 20 | SkDebugf("%.0f", x); |
| 21 | } else { |
| 22 | SkDebugf("%1.19g", x); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | inline void DebugDumpFloat(float x) { |
| 27 | if (x == floorf(x)) { |
| 28 | SkDebugf("%.0f", x); |
| 29 | } else { |
| 30 | SkDebugf("%1.9gf", x); |
| 31 | } |
| 32 | } |
| 33 | |
caryclark | 65f5531 | 2014-11-13 06:58:52 -0800 | [diff] [blame] | 34 | inline void DebugDumpHexFloat(float x) { |
| 35 | SkDebugf("SkBits2Float(0x%08x)", SkFloat2Bits(x)); |
| 36 | } |
caryclark | 19eb3b2 | 2014-07-18 05:08:14 -0700 | [diff] [blame] | 37 | |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 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 | |
| 44 | void SkPathOpsDebug::WindingPrintf(int wind) { |
| 45 | if (wind == SK_MinS32) { |
| 46 | SkDebugf("?"); |
| 47 | } else { |
| 48 | SkDebugf("%d", wind); |
| 49 | } |
| 50 | } |
| 51 | #endif |
| 52 | |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 53 | static void DumpID(int id) { |
| 54 | SkDebugf("} "); |
| 55 | if (id >= 0) { |
| 56 | SkDebugf("id=%d", id); |
| 57 | } |
| 58 | SkDebugf("\n"); |
| 59 | } |
| 60 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 61 | void SkDConic::dump() const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 62 | dumpInner(); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 63 | SkDebugf("},\n"); |
| 64 | } |
| 65 | |
| 66 | void SkDConic::dumpID(int id) const { |
| 67 | dumpInner(); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 68 | DumpID(id); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | void SkDConic::dumpInner() const { |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 72 | SkDebugf("{"); |
| 73 | fPts.dumpInner(); |
| 74 | SkDebugf("}}, %1.9gf", fWeight); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | void SkDCubic::dump() const { |
| 78 | this->dumpInner(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 79 | SkDebugf("}},\n"); |
reed | 0dc4dd6 | 2015-03-24 13:55:33 -0700 | [diff] [blame] | 80 | } |
| 81 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 82 | void SkDCubic::dumpID(int id) const { |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 83 | this->dumpInner(); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 84 | SkDebugf("}"); |
| 85 | DumpID(id); |
reed | 0dc4dd6 | 2015-03-24 13:55:33 -0700 | [diff] [blame] | 86 | } |
| 87 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 88 | static inline bool double_is_NaN(double x) { return x != x; } |
| 89 | |
| 90 | void SkDCubic::dumpInner() const { |
| 91 | SkDebugf("{{"); |
| 92 | int index = 0; |
reed | 0dc4dd6 | 2015-03-24 13:55:33 -0700 | [diff] [blame] | 93 | do { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 94 | if (index != 0) { |
| 95 | if (double_is_NaN(fPts[index].fX) && double_is_NaN(fPts[index].fY)) { |
| 96 | return; |
reed | 0dc4dd6 | 2015-03-24 13:55:33 -0700 | [diff] [blame] | 97 | } |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 98 | SkDebugf(", "); |
reed | 0dc4dd6 | 2015-03-24 13:55:33 -0700 | [diff] [blame] | 99 | } |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 100 | fPts[index].dump(); |
| 101 | } while (++index < 3); |
| 102 | if (double_is_NaN(fPts[index].fX) && double_is_NaN(fPts[index].fY)) { |
reed | 0dc4dd6 | 2015-03-24 13:55:33 -0700 | [diff] [blame] | 103 | return; |
| 104 | } |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 105 | SkDebugf(", "); |
reed | 0dc4dd6 | 2015-03-24 13:55:33 -0700 | [diff] [blame] | 106 | fPts[index].dump(); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 107 | } |
| 108 | |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 109 | void SkDCurve::dump() const { |
| 110 | dumpID(-1); |
| 111 | } |
| 112 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 113 | void 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.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 136 | void SkDLine::dump() const { |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 137 | this->dumpInner(); |
| 138 | SkDebugf("}},\n"); |
| 139 | } |
| 140 | |
| 141 | void SkDLine::dumpID(int id) const { |
| 142 | this->dumpInner(); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 143 | SkDebugf("}"); |
| 144 | DumpID(id); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 145 | } |
| 146 | |
| 147 | void SkDLine::dumpInner() const { |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 148 | SkDebugf("{{"); |
| 149 | fPts[0].dump(); |
| 150 | SkDebugf(", "); |
| 151 | fPts[1].dump(); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | void SkDPoint::dump() const { |
| 155 | SkDebugf("{"); |
| 156 | DebugDumpDouble(fX); |
| 157 | SkDebugf(", "); |
| 158 | DebugDumpDouble(fY); |
| 159 | SkDebugf("}"); |
| 160 | } |
| 161 | |
| 162 | void SkDPoint::Dump(const SkPoint& pt) { |
| 163 | SkDebugf("{"); |
| 164 | DebugDumpFloat(pt.fX); |
| 165 | SkDebugf(", "); |
| 166 | DebugDumpFloat(pt.fY); |
| 167 | SkDebugf("}"); |
| 168 | } |
| 169 | |
caryclark | 65f5531 | 2014-11-13 06:58:52 -0800 | [diff] [blame] | 170 | void SkDPoint::DumpHex(const SkPoint& pt) { |
| 171 | SkDebugf("{"); |
| 172 | DebugDumpHexFloat(pt.fX); |
| 173 | SkDebugf(", "); |
| 174 | DebugDumpHexFloat(pt.fY); |
| 175 | SkDebugf("}"); |
| 176 | } |
| 177 | |
| 178 | void SkDQuad::dump() const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 179 | dumpInner(); |
| 180 | SkDebugf("}},\n"); |
caryclark | 65f5531 | 2014-11-13 06:58:52 -0800 | [diff] [blame] | 181 | } |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 182 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 183 | void SkDQuad::dumpID(int id) const { |
| 184 | dumpInner(); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 185 | SkDebugf("}"); |
| 186 | DumpID(id); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 187 | } |
| 188 | |
| 189 | void SkDQuad::dumpInner() const { |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 190 | SkDebugf("{{"); |
| 191 | int index = 0; |
| 192 | do { |
| 193 | fPts[index].dump(); |
| 194 | SkDebugf(", "); |
| 195 | } while (++index < 2); |
| 196 | fPts[index].dump(); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 197 | } |
| 198 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 199 | void 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.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 208 | } |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 209 | } |
| 210 | SkDebugf("\n"); |
| 211 | } |
| 212 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 213 | const SkOpAngle* SkPathOpsDebug::DebugAngleAngle(const SkOpAngle* angle, int id) { |
| 214 | return angle->debugAngle(id); |
| 215 | } |
| 216 | |
| 217 | SkOpContour* SkPathOpsDebug::DebugAngleContour(SkOpAngle* angle, int id) { |
| 218 | return angle->debugContour(id); |
| 219 | } |
| 220 | |
| 221 | const SkOpPtT* SkPathOpsDebug::DebugAnglePtT(const SkOpAngle* angle, int id) { |
| 222 | return angle->debugPtT(id); |
| 223 | } |
| 224 | |
| 225 | const SkOpSegment* SkPathOpsDebug::DebugAngleSegment(const SkOpAngle* angle, int id) { |
| 226 | return angle->debugSegment(id); |
| 227 | } |
| 228 | |
| 229 | const SkOpSpanBase* SkPathOpsDebug::DebugAngleSpan(const SkOpAngle* angle, int id) { |
| 230 | return angle->debugSpan(id); |
| 231 | } |
| 232 | |
| 233 | const SkOpAngle* SkPathOpsDebug::DebugContourAngle(SkOpContour* contour, int id) { |
| 234 | return contour->debugAngle(id); |
| 235 | } |
| 236 | |
| 237 | SkOpContour* SkPathOpsDebug::DebugContourContour(SkOpContour* contour, int id) { |
| 238 | return contour->debugContour(id); |
| 239 | } |
| 240 | |
| 241 | const SkOpPtT* SkPathOpsDebug::DebugContourPtT(SkOpContour* contour, int id) { |
| 242 | return contour->debugPtT(id); |
| 243 | } |
| 244 | |
| 245 | const SkOpSegment* SkPathOpsDebug::DebugContourSegment(SkOpContour* contour, int id) { |
| 246 | return contour->debugSegment(id); |
| 247 | } |
| 248 | |
| 249 | const SkOpSpanBase* SkPathOpsDebug::DebugContourSpan(SkOpContour* contour, int id) { |
| 250 | return contour->debugSpan(id); |
| 251 | } |
| 252 | |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 253 | const SkOpAngle* SkPathOpsDebug::DebugCoincidenceAngle(SkOpCoincidence* coin, int id) { |
| 254 | return coin->debugAngle(id); |
| 255 | } |
| 256 | |
| 257 | SkOpContour* SkPathOpsDebug::DebugCoincidenceContour(SkOpCoincidence* coin, int id) { |
| 258 | return coin->debugContour(id); |
| 259 | } |
| 260 | |
| 261 | const SkOpPtT* SkPathOpsDebug::DebugCoincidencePtT(SkOpCoincidence* coin, int id) { |
| 262 | return coin->debugPtT(id); |
| 263 | } |
| 264 | |
| 265 | const SkOpSegment* SkPathOpsDebug::DebugCoincidenceSegment(SkOpCoincidence* coin, int id) { |
| 266 | return coin->debugSegment(id); |
| 267 | } |
| 268 | |
| 269 | const SkOpSpanBase* SkPathOpsDebug::DebugCoincidenceSpan(SkOpCoincidence* coin, int id) { |
| 270 | return coin->debugSpan(id); |
| 271 | } |
| 272 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 273 | const SkOpAngle* SkPathOpsDebug::DebugPtTAngle(const SkOpPtT* ptT, int id) { |
| 274 | return ptT->debugAngle(id); |
| 275 | } |
| 276 | |
| 277 | SkOpContour* SkPathOpsDebug::DebugPtTContour(SkOpPtT* ptT, int id) { |
| 278 | return ptT->debugContour(id); |
| 279 | } |
| 280 | |
| 281 | const SkOpPtT* SkPathOpsDebug::DebugPtTPtT(const SkOpPtT* ptT, int id) { |
| 282 | return ptT->debugPtT(id); |
| 283 | } |
| 284 | |
| 285 | const SkOpSegment* SkPathOpsDebug::DebugPtTSegment(const SkOpPtT* ptT, int id) { |
| 286 | return ptT->debugSegment(id); |
| 287 | } |
| 288 | |
| 289 | const SkOpSpanBase* SkPathOpsDebug::DebugPtTSpan(const SkOpPtT* ptT, int id) { |
| 290 | return ptT->debugSpan(id); |
| 291 | } |
| 292 | |
| 293 | const SkOpAngle* SkPathOpsDebug::DebugSegmentAngle(const SkOpSegment* span, int id) { |
| 294 | return span->debugAngle(id); |
| 295 | } |
| 296 | |
| 297 | SkOpContour* SkPathOpsDebug::DebugSegmentContour(SkOpSegment* span, int id) { |
| 298 | return span->debugContour(id); |
| 299 | } |
| 300 | |
| 301 | const SkOpPtT* SkPathOpsDebug::DebugSegmentPtT(const SkOpSegment* span, int id) { |
| 302 | return span->debugPtT(id); |
| 303 | } |
| 304 | |
| 305 | const SkOpSegment* SkPathOpsDebug::DebugSegmentSegment(const SkOpSegment* span, int id) { |
| 306 | return span->debugSegment(id); |
| 307 | } |
| 308 | |
| 309 | const SkOpSpanBase* SkPathOpsDebug::DebugSegmentSpan(const SkOpSegment* span, int id) { |
| 310 | return span->debugSpan(id); |
| 311 | } |
| 312 | |
| 313 | const SkOpAngle* SkPathOpsDebug::DebugSpanAngle(const SkOpSpanBase* span, int id) { |
| 314 | return span->debugAngle(id); |
| 315 | } |
| 316 | |
| 317 | SkOpContour* SkPathOpsDebug::DebugSpanContour(SkOpSpanBase* span, int id) { |
| 318 | return span->debugContour(id); |
| 319 | } |
| 320 | |
| 321 | const SkOpPtT* SkPathOpsDebug::DebugSpanPtT(const SkOpSpanBase* span, int id) { |
| 322 | return span->debugPtT(id); |
| 323 | } |
| 324 | |
| 325 | const SkOpSegment* SkPathOpsDebug::DebugSpanSegment(const SkOpSpanBase* span, int id) { |
| 326 | return span->debugSegment(id); |
| 327 | } |
| 328 | |
| 329 | const SkOpSpanBase* SkPathOpsDebug::DebugSpanSpan(const SkOpSpanBase* span, int id) { |
| 330 | return span->debugSpan(id); |
| 331 | } |
| 332 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 333 | void SkOpContour::dumpContours() const { |
| 334 | SkOpContour* contour = this->globalState()->contourHead(); |
| 335 | do { |
| 336 | contour->dump(); |
| 337 | } while ((contour = contour->next())); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 338 | } |
| 339 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 340 | void SkOpContour::dumpContoursAll() const { |
| 341 | SkOpContour* contour = this->globalState()->contourHead(); |
| 342 | do { |
| 343 | contour->dumpAll(); |
| 344 | } while ((contour = contour->next())); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 345 | } |
| 346 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 347 | void SkOpContour::dumpContoursAngles() const { |
| 348 | SkOpContour* contour = this->globalState()->contourHead(); |
| 349 | do { |
| 350 | contour->dumpAngles(); |
| 351 | } while ((contour = contour->next())); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 352 | } |
| 353 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 354 | void SkOpContour::dumpContoursPts() const { |
| 355 | SkOpContour* contour = this->globalState()->contourHead(); |
| 356 | do { |
| 357 | contour->dumpPts(); |
| 358 | } while ((contour = contour->next())); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 359 | } |
| 360 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 361 | void 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.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 366 | } |
| 367 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 368 | void 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.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 373 | } |
| 374 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 375 | void 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.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 380 | } |
| 381 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 382 | void SkOpContour::dumpContoursSpans() const { |
| 383 | SkOpContour* contour = this->globalState()->contourHead(); |
| 384 | do { |
| 385 | contour->dumpSpans(); |
| 386 | } while ((contour = contour->next())); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 387 | } |
| 388 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 389 | template <typename TCurve, typename OppCurve> |
| 390 | const SkTSpan<TCurve, OppCurve>* DebugSpan(const SkTSect<TCurve, OppCurve>* sect, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 391 | return sect->debugSpan(id); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 392 | } |
| 393 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 394 | void DontCallDebugSpan(int id); |
| 395 | void DontCallDebugSpan(int id) { // exists to instantiate the templates |
| 396 | SkDQuad quad; |
| 397 | SkDConic conic; |
| 398 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 399 | 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)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 408 | 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.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 417 | } |
| 418 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 419 | template <typename TCurve, typename OppCurve> |
| 420 | const SkTSpan<TCurve, OppCurve>* DebugT(const SkTSect<TCurve, OppCurve>* sect, double t) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 421 | return sect->debugT(t); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 422 | } |
| 423 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 424 | void DontCallDebugT(double t); |
| 425 | void DontCallDebugT(double t) { // exists to instantiate the templates |
| 426 | SkDQuad quad; |
| 427 | SkDConic conic; |
| 428 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 429 | 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)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 438 | 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); |
caryclark | dac1d17 | 2014-06-17 05:15:38 -0700 | [diff] [blame] | 447 | } |
| 448 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 449 | template <typename TCurve, typename OppCurve> |
| 450 | void Dump(const SkTSect<TCurve, OppCurve>* sect) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 451 | sect->dump(); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 452 | } |
| 453 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 454 | void DontCallDumpTSect(); |
| 455 | void DontCallDumpTSect() { // exists to instantiate the templates |
| 456 | SkDQuad quad; |
| 457 | SkDConic conic; |
| 458 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 459 | 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)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 468 | 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.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 477 | } |
| 478 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 479 | template <typename TCurve, typename OppCurve> |
| 480 | void DumpBoth(SkTSect<TCurve, OppCurve>* sect1, SkTSect<OppCurve, TCurve>* sect2) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 481 | sect1->dumpBoth(sect2); |
caryclark | dac1d17 | 2014-06-17 05:15:38 -0700 | [diff] [blame] | 482 | } |
| 483 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 484 | void DontCallDumpBoth(); |
| 485 | void DontCallDumpBoth() { // exists to instantiate the templates |
| 486 | SkDQuad quad; |
| 487 | SkDConic conic; |
| 488 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 489 | 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)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 498 | 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); |
caryclark | dac1d17 | 2014-06-17 05:15:38 -0700 | [diff] [blame] | 507 | } |
| 508 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 509 | template <typename TCurve, typename OppCurve> |
| 510 | void DumpBounded(SkTSect<TCurve, OppCurve>* sect1, int id) { |
| 511 | sect1->dumpBounded(id); |
| 512 | } |
| 513 | |
| 514 | void DontCallDumpBounded(); |
| 515 | void DontCallDumpBounded() { |
| 516 | SkDQuad quad; |
| 517 | SkDConic conic; |
| 518 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 519 | 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)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 528 | 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 | |
| 539 | template <typename TCurve, typename OppCurve> |
| 540 | void DumpBounds(SkTSect<TCurve, OppCurve>* sect1) { |
| 541 | sect1->dumpBounds(); |
| 542 | } |
| 543 | |
| 544 | void DontCallDumpBounds(); |
| 545 | void DontCallDumpBounds() { |
| 546 | SkDQuad quad; |
| 547 | SkDConic conic; |
| 548 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 549 | 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)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 558 | 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 | |
| 569 | template <typename TCurve, typename OppCurve> |
| 570 | void DumpCoin(SkTSect<TCurve, OppCurve>* sect1) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 571 | sect1->dumpCoin(); |
caryclark | dac1d17 | 2014-06-17 05:15:38 -0700 | [diff] [blame] | 572 | } |
| 573 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 574 | void DontCallDumpCoin(); |
| 575 | void DontCallDumpCoin() { // exists to instantiate the templates |
| 576 | SkDQuad quad; |
| 577 | SkDConic conic; |
| 578 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 579 | 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)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 588 | 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.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 597 | } |
| 598 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 599 | template <typename TCurve, typename OppCurve> |
| 600 | void DumpCoinCurves(SkTSect<TCurve, OppCurve>* sect1) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 601 | sect1->dumpCoinCurves(); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 602 | } |
| 603 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 604 | void DontCallDumpCoinCurves(); |
| 605 | void DontCallDumpCoinCurves() { // exists to instantiate the templates |
| 606 | SkDQuad quad; |
| 607 | SkDConic conic; |
| 608 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 609 | 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)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 618 | 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.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 627 | } |
| 628 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 629 | template <typename TCurve, typename OppCurve> |
| 630 | void DumpCurves(const SkTSect<TCurve, OppCurve>* sect) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 631 | sect->dumpCurves(); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 632 | } |
| 633 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 634 | void DontCallDumpCurves(); |
| 635 | void DontCallDumpCurves() { // exists to instantiate the templates |
| 636 | SkDQuad quad; |
| 637 | SkDConic conic; |
| 638 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 639 | 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)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 648 | 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 | |
| 659 | template <typename TCurve, typename OppCurve> |
| 660 | void Dump(const SkTSpan<TCurve, OppCurve>* span) { |
| 661 | span->dump(); |
| 662 | } |
| 663 | |
| 664 | void DontCallDumpTSpan(); |
| 665 | void 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 | |
| 686 | template <typename TCurve, typename OppCurve> |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 687 | void DumpAll(const SkTSpan<TCurve, OppCurve>* span) { |
| 688 | span->dumpAll(); |
| 689 | } |
| 690 | |
| 691 | void DontCallDumpSpanAll(); |
| 692 | void 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 | |
| 713 | template <typename TCurve, typename OppCurve> |
| 714 | void DumpBounded(const SkTSpan<TCurve, OppCurve>* span) { |
| 715 | span->dumpBounded(0); |
| 716 | } |
| 717 | |
| 718 | void DontCallDumpSpanBounded(); |
| 719 | void 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 | |
| 740 | template <typename TCurve, typename OppCurve> |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 741 | void DumpCoin(const SkTSpan<TCurve, OppCurve>* span) { |
| 742 | span->dumpCoin(); |
| 743 | } |
| 744 | |
| 745 | void DontCallDumpSpanCoin(); |
| 746 | void 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); |
caryclark | dac1d17 | 2014-06-17 05:15:38 -0700 | [diff] [blame] | 765 | } |
| 766 | |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 767 | static void dumpTestCase(const SkDQuad& quad1, const SkDQuad& quad2, int testNo) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 768 | SkDebugf("\n<div id=\"quad%d\">\n", testNo); |
| 769 | quad1.dumpInner(); |
| 770 | SkDebugf("}}, "); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 771 | quad2.dump(); |
| 772 | SkDebugf("</div>\n\n"); |
| 773 | } |
| 774 | |
| 775 | static void dumpTestTrailer() { |
| 776 | SkDebugf("</div>\n\n<script type=\"text/javascript\">\n\n"); |
| 777 | SkDebugf(" var testDivs = [\n"); |
| 778 | } |
| 779 | |
| 780 | static 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 | |
| 788 | void 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 | |
| 796 | void DumpT(const SkDQuad& quad, double t) { |
| 797 | SkDLine line = {{quad.ptAtT(t), quad[0]}}; |
| 798 | line.dump(); |
| 799 | } |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 800 | |
| 801 | const SkOpAngle* SkOpAngle::debugAngle(int id) const { |
| 802 | return this->segment()->debugAngle(id); |
| 803 | } |
| 804 | |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 805 | const SkOpCoincidence* SkOpAngle::debugCoincidence() const { |
| 806 | return this->segment()->debugCoincidence(); |
| 807 | } |
| 808 | |
caryclark | 30b9fdd | 2016-08-31 14:36:29 -0700 | [diff] [blame^] | 809 | SkOpContour* SkOpAngle::debugContour(int id) const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 810 | return this->segment()->debugContour(id); |
| 811 | } |
| 812 | |
| 813 | const SkOpPtT* SkOpAngle::debugPtT(int id) const { |
| 814 | return this->segment()->debugPtT(id); |
| 815 | } |
| 816 | |
| 817 | const SkOpSegment* SkOpAngle::debugSegment(int id) const { |
| 818 | return this->segment()->debugSegment(id); |
| 819 | } |
| 820 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 821 | int SkOpAngle::debugSign() const { |
| 822 | SkASSERT(fStart->t() != fEnd->t()); |
| 823 | return fStart->t() < fEnd->t() ? -1 : 1; |
| 824 | } |
| 825 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 826 | const SkOpSpanBase* SkOpAngle::debugSpan(int id) const { |
| 827 | return this->segment()->debugSpan(id); |
| 828 | } |
| 829 | |
| 830 | void SkOpAngle::dump() const { |
| 831 | dumpOne(true); |
| 832 | SkDebugf("\n"); |
| 833 | } |
| 834 | |
| 835 | void 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()); |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 854 | SkDebugf(" sgn=%d windVal=%d", this->debugSign(), mSpan.windValue()); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 855 | |
| 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 | } |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 872 | } |
| 873 | |
| 874 | void 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 | |
| 895 | void 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 | |
| 904 | void 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 | |
| 914 | void 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 | |
| 927 | bool 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 | |
| 939 | const SkOpAngle* SkOpPtT::debugAngle(int id) const { |
| 940 | return this->span()->debugAngle(id); |
| 941 | } |
| 942 | |
caryclark | 30b9fdd | 2016-08-31 14:36:29 -0700 | [diff] [blame^] | 943 | SkOpContour* SkOpPtT::debugContour(int id) const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 944 | return this->span()->debugContour(id); |
| 945 | } |
| 946 | |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 947 | const SkOpCoincidence* SkOpPtT::debugCoincidence() const { |
| 948 | return this->span()->debugCoincidence(); |
| 949 | } |
| 950 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 951 | const SkOpPtT* SkOpPtT::debugPtT(int id) const { |
| 952 | return this->span()->debugPtT(id); |
| 953 | } |
| 954 | |
| 955 | const SkOpSegment* SkOpPtT::debugSegment(int id) const { |
| 956 | return this->span()->debugSegment(id); |
| 957 | } |
| 958 | |
| 959 | const SkOpSpanBase* SkOpPtT::debugSpan(int id) const { |
| 960 | return this->span()->debugSpan(id); |
| 961 | } |
| 962 | |
| 963 | void 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 | |
| 970 | void 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 | |
| 989 | void SkOpPtT::dumpBase() const { |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 990 | SkDebugf(" t=%1.9g pt=(%1.9g,%1.9g)%s%s%s", this->fT, this->fPt.fX, this->fPt.fY, |
| 991 | this->fCoincident ? " coin" : "", |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 992 | this->fDuplicatePt ? " dup" : "", this->fDeleted ? " deleted" : ""); |
| 993 | } |
| 994 | |
| 995 | const SkOpAngle* SkOpSpanBase::debugAngle(int id) const { |
| 996 | return this->segment()->debugAngle(id); |
| 997 | } |
| 998 | |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 999 | const SkOpCoincidence* SkOpSpanBase::debugCoincidence() const { |
| 1000 | return this->segment()->debugCoincidence(); |
| 1001 | } |
| 1002 | |
caryclark | 30b9fdd | 2016-08-31 14:36:29 -0700 | [diff] [blame^] | 1003 | SkOpContour* SkOpSpanBase::debugContour(int id) const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1004 | return this->segment()->debugContour(id); |
| 1005 | } |
| 1006 | |
| 1007 | const SkOpPtT* SkOpSpanBase::debugPtT(int id) const { |
| 1008 | return this->segment()->debugPtT(id); |
| 1009 | } |
| 1010 | |
| 1011 | const SkOpSegment* SkOpSpanBase::debugSegment(int id) const { |
| 1012 | return this->segment()->debugSegment(id); |
| 1013 | } |
| 1014 | |
| 1015 | const SkOpSpanBase* SkOpSpanBase::debugSpan(int id) const { |
| 1016 | return this->segment()->debugSpan(id); |
| 1017 | } |
| 1018 | |
| 1019 | void SkOpSpanBase::dump() const { |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1020 | this->dumpHead(); |
| 1021 | this->fPtT.dump(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1022 | } |
| 1023 | |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1024 | void SkOpSpanBase::dumpHead() const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1025 | SkDebugf("%.*s", contour()->debugIndent(), " "); |
| 1026 | SkDebugf("seg=%d span=%d", this->segment()->debugID(), this->debugID()); |
| 1027 | this->dumpBase(); |
| 1028 | SkDebugf("\n"); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1029 | } |
| 1030 | |
| 1031 | void SkOpSpanBase::dumpAll() const { |
| 1032 | this->dumpHead(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1033 | this->fPtT.dumpAll(); |
| 1034 | } |
| 1035 | |
| 1036 | void SkOpSpanBase::dumpBase() const { |
| 1037 | if (this->fAligned) { |
| 1038 | SkDebugf(" aligned"); |
| 1039 | } |
| 1040 | if (this->fChased) { |
| 1041 | SkDebugf(" chased"); |
| 1042 | } |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1043 | #ifdef SK_DEBUG |
caryclark | 30b9fdd | 2016-08-31 14:36:29 -0700 | [diff] [blame^] | 1044 | if (this->fDebugDeleted) { |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1045 | SkDebugf(" deleted"); |
| 1046 | } |
| 1047 | #endif |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1048 | 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 | } |
caryclark | 08bc848 | 2015-04-24 09:08:57 -0700 | [diff] [blame] | 1058 | SkDebugf(" adds=%d", fSpanAdds); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1059 | } |
| 1060 | |
| 1061 | void 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 | |
| 1072 | void 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 | |
| 1086 | bool 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 | |
| 1105 | const SkOpAngle* SkOpSegment::debugAngle(int id) const { |
| 1106 | return this->contour()->debugAngle(id); |
| 1107 | } |
| 1108 | |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1109 | |
| 1110 | const SkOpCoincidence* SkOpSegment::debugCoincidence() const { |
| 1111 | return this->contour()->debugCoincidence(); |
| 1112 | } |
| 1113 | |
caryclark | 30b9fdd | 2016-08-31 14:36:29 -0700 | [diff] [blame^] | 1114 | SkOpContour* SkOpSegment::debugContour(int id) const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1115 | return this->contour()->debugContour(id); |
| 1116 | } |
| 1117 | |
| 1118 | const SkOpPtT* SkOpSegment::debugPtT(int id) const { |
| 1119 | return this->contour()->debugPtT(id); |
| 1120 | } |
| 1121 | |
| 1122 | const SkOpSegment* SkOpSegment::debugSegment(int id) const { |
| 1123 | return this->contour()->debugSegment(id); |
| 1124 | } |
| 1125 | |
| 1126 | const SkOpSpanBase* SkOpSegment::debugSpan(int id) const { |
| 1127 | return this->contour()->debugSpan(id); |
| 1128 | } |
| 1129 | |
| 1130 | void 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 | |
| 1144 | void 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 | |
| 1155 | void SkOpSegment::dumpAngles() const { |
| 1156 | SkDebugf("seg=%d\n", debugID()); |
| 1157 | const SkOpSpanBase* span = &fHead; |
| 1158 | do { |
| 1159 | const SkOpAngle* fAngle = span->fromAngle(); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 1160 | const SkOpAngle* tAngle = span->final() ? nullptr : span->upCast()->toAngle(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1161 | 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 | |
| 1172 | void SkOpSegment::dumpCoin() const { |
| 1173 | const SkOpSpan* span = &fHead; |
| 1174 | do { |
| 1175 | span->dumpCoin(); |
| 1176 | } while ((span = span->next()->upCastable())); |
| 1177 | } |
| 1178 | |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1179 | void SkOpSegment::dumpPtsInner(const char* prefix) const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1180 | int last = SkPathOpsVerbToPoints(fVerb); |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1181 | SkDebugf("%s=%d {{", prefix, this->debugID()); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 1182 | if (fVerb == SkPath::kConic_Verb) { |
| 1183 | SkDebugf("{"); |
| 1184 | } |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1185 | int index = 0; |
| 1186 | do { |
| 1187 | SkDPoint::Dump(fPts[index]); |
| 1188 | SkDebugf(", "); |
| 1189 | } while (++index < last); |
| 1190 | SkDPoint::Dump(fPts[index]); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 1191 | SkDebugf("}}"); |
| 1192 | if (fVerb == SkPath::kConic_Verb) { |
| 1193 | SkDebugf(", %1.9gf}", fWeight); |
| 1194 | } |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1195 | } |
| 1196 | |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1197 | void SkOpSegment::dumpPts(const char* prefix) const { |
| 1198 | dumpPtsInner(prefix); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 1199 | SkDebugf("\n"); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1200 | } |
| 1201 | |
| 1202 | void 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 | |
| 1229 | void SkOpCoincidence::dump() const { |
| 1230 | SkCoincidentSpans* span = fHead; |
| 1231 | while (span) { |
| 1232 | span->dump(); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1233 | span = span->next(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1234 | } |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1235 | if (!fTop || fHead == fTop) { |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 1236 | return; |
| 1237 | } |
| 1238 | SkDebugf("top:\n"); |
| 1239 | span = fTop; |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1240 | int count = 0; |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 1241 | while (span) { |
| 1242 | span->dump(); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1243 | 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 | } |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 1253 | } |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1254 | } |
| 1255 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1256 | void SkOpContour::dump() const { |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 1257 | SkDebugf("contour=%d count=%d op=%d xor=%d\n", this->debugID(), fCount, fOperand, fXor); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1258 | if (!fCount) { |
| 1259 | return; |
| 1260 | } |
| 1261 | const SkOpSegment* segment = &fHead; |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1262 | SkDEBUGCODE(fDebugIndent = 0); |
| 1263 | this->indentDump(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1264 | do { |
| 1265 | segment->dump(); |
| 1266 | } while ((segment = segment->next())); |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1267 | this->outdentDump(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1268 | } |
| 1269 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1270 | void SkOpContour::dumpAll() const { |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 1271 | SkDebugf("contour=%d count=%d op=%d xor=%d\n", this->debugID(), fCount, fOperand, fXor); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1272 | if (!fCount) { |
| 1273 | return; |
| 1274 | } |
| 1275 | const SkOpSegment* segment = &fHead; |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1276 | SkDEBUGCODE(fDebugIndent = 0); |
| 1277 | this->indentDump(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1278 | do { |
| 1279 | segment->dumpAll(); |
| 1280 | } while ((segment = segment->next())); |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1281 | this->outdentDump(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1282 | } |
| 1283 | |
| 1284 | |
| 1285 | void 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 | |
| 1294 | void 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 | |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1303 | void SkOpContour::dumpPts(const char* prefix) const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1304 | SkDebugf("contour=%d\n", this->debugID()); |
| 1305 | const SkOpSegment* segment = &fHead; |
| 1306 | do { |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1307 | SkDebugf(" %s=%d ", prefix, segment->debugID()); |
| 1308 | segment->dumpPts(prefix); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1309 | } while ((segment = segment->next())); |
| 1310 | } |
| 1311 | |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1312 | void SkOpContour::dumpPtsX(const char* prefix) const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1313 | if (!this->fCount) { |
| 1314 | SkDebugf("<empty>\n"); |
| 1315 | return; |
| 1316 | } |
| 1317 | const SkOpSegment* segment = &fHead; |
| 1318 | do { |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1319 | segment->dumpPts(prefix); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1320 | } while ((segment = segment->next())); |
| 1321 | } |
| 1322 | |
| 1323 | void SkOpContour::dumpSegment(int index) const { |
| 1324 | debugSegment(index)->dump(); |
| 1325 | } |
| 1326 | |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1327 | void SkOpContour::dumpSegments(const char* prefix, SkPathOp op) const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1328 | bool firstOp = false; |
| 1329 | const SkOpContour* c = this; |
| 1330 | do { |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1331 | if (!firstOp && c->operand() && op >= 0) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1332 | #if DEBUG_ACTIVE_OP |
| 1333 | SkDebugf("op %s\n", SkPathOpsDebug::kPathOpStr[op]); |
| 1334 | #endif |
| 1335 | firstOp = true; |
| 1336 | } |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1337 | c->dumpPtsX(prefix); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1338 | } while ((c = c->next())); |
| 1339 | } |
| 1340 | |
| 1341 | void SkOpContour::dumpSpan(int index) const { |
| 1342 | debugSpan(index)->dump(); |
| 1343 | } |
| 1344 | |
| 1345 | void 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 | |
caryclark | 03b03ca | 2015-04-23 09:13:37 -0700 | [diff] [blame] | 1354 | void 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 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1364 | #ifdef SK_DEBUG |
| 1365 | const SkOpAngle* SkOpGlobalState::debugAngle(int id) const { |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1366 | const SkOpContour* contour = fContourHead; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1367 | 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())); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 1389 | return nullptr; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1390 | } |
| 1391 | |
caryclark | 30b9fdd | 2016-08-31 14:36:29 -0700 | [diff] [blame^] | 1392 | SkOpContour* SkOpGlobalState::debugContour(int id) const { |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1393 | SkOpContour* contour = fContourHead; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1394 | do { |
| 1395 | if (contour->debugID() == id) { |
| 1396 | return contour; |
| 1397 | } |
| 1398 | } while ((contour = contour->next())); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 1399 | return nullptr; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1400 | } |
| 1401 | |
| 1402 | const SkOpPtT* SkOpGlobalState::debugPtT(int id) const { |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1403 | const SkOpContour* contour = fContourHead; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1404 | 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())); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 1422 | return nullptr; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1423 | } |
| 1424 | |
| 1425 | const SkOpSegment* SkOpGlobalState::debugSegment(int id) const { |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1426 | const SkOpContour* contour = fContourHead; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1427 | 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())); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 1436 | return nullptr; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1437 | } |
| 1438 | |
| 1439 | const SkOpSpanBase* SkOpGlobalState::debugSpan(int id) const { |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1440 | const SkOpContour* contour = fContourHead; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1441 | 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())); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 1457 | return nullptr; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1458 | } |
| 1459 | #endif |
| 1460 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1461 | #if DEBUG_T_SECT_DUMP > 1 |
| 1462 | int gDumpTSectNum; |
| 1463 | #endif |