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