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