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 | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 51 | static void DumpID(int id) { |
| 52 | SkDebugf("} "); |
| 53 | if (id >= 0) { |
| 54 | SkDebugf("id=%d", id); |
| 55 | } |
| 56 | SkDebugf("\n"); |
| 57 | } |
| 58 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 59 | void SkDConic::dump() const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 60 | dumpInner(); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 61 | SkDebugf("},\n"); |
| 62 | } |
| 63 | |
| 64 | void SkDConic::dumpID(int id) const { |
| 65 | dumpInner(); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 66 | DumpID(id); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | void SkDConic::dumpInner() const { |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 70 | SkDebugf("{"); |
| 71 | fPts.dumpInner(); |
| 72 | SkDebugf("}}, %1.9gf", fWeight); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | void SkDCubic::dump() const { |
| 76 | this->dumpInner(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 77 | SkDebugf("}},\n"); |
reed | 0dc4dd6 | 2015-03-24 13:55:33 -0700 | [diff] [blame] | 78 | } |
| 79 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 80 | void SkDCubic::dumpID(int id) const { |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 81 | this->dumpInner(); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 82 | SkDebugf("}"); |
| 83 | DumpID(id); |
reed | 0dc4dd6 | 2015-03-24 13:55:33 -0700 | [diff] [blame] | 84 | } |
| 85 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 86 | static inline bool double_is_NaN(double x) { return x != x; } |
| 87 | |
| 88 | void SkDCubic::dumpInner() const { |
| 89 | SkDebugf("{{"); |
| 90 | int index = 0; |
reed | 0dc4dd6 | 2015-03-24 13:55:33 -0700 | [diff] [blame] | 91 | do { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 92 | if (index != 0) { |
| 93 | if (double_is_NaN(fPts[index].fX) && double_is_NaN(fPts[index].fY)) { |
| 94 | return; |
reed | 0dc4dd6 | 2015-03-24 13:55:33 -0700 | [diff] [blame] | 95 | } |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 96 | SkDebugf(", "); |
reed | 0dc4dd6 | 2015-03-24 13:55:33 -0700 | [diff] [blame] | 97 | } |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 98 | fPts[index].dump(); |
| 99 | } while (++index < 3); |
| 100 | if (double_is_NaN(fPts[index].fX) && double_is_NaN(fPts[index].fY)) { |
reed | 0dc4dd6 | 2015-03-24 13:55:33 -0700 | [diff] [blame] | 101 | return; |
| 102 | } |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 103 | SkDebugf(", "); |
reed | 0dc4dd6 | 2015-03-24 13:55:33 -0700 | [diff] [blame] | 104 | fPts[index].dump(); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 105 | } |
| 106 | |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 107 | void SkDCurve::dump() const { |
| 108 | dumpID(-1); |
| 109 | } |
| 110 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 111 | void SkDCurve::dumpID(int id) const { |
| 112 | #ifndef SK_RELEASE |
| 113 | switch(fVerb) { |
| 114 | case SkPath::kLine_Verb: |
| 115 | fLine.dumpID(id); |
| 116 | break; |
| 117 | case SkPath::kQuad_Verb: |
| 118 | fQuad.dumpID(id); |
| 119 | break; |
| 120 | case SkPath::kConic_Verb: |
| 121 | fConic.dumpID(id); |
| 122 | break; |
| 123 | case SkPath::kCubic_Verb: |
| 124 | fCubic.dumpID(id); |
| 125 | break; |
| 126 | default: |
| 127 | SkASSERT(0); |
| 128 | } |
| 129 | #else |
| 130 | fCubic.dumpID(id); |
| 131 | #endif |
| 132 | } |
| 133 | |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 134 | void SkDLine::dump() const { |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 135 | this->dumpInner(); |
| 136 | SkDebugf("}},\n"); |
| 137 | } |
| 138 | |
| 139 | void SkDLine::dumpID(int id) const { |
| 140 | this->dumpInner(); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 141 | SkDebugf("}"); |
| 142 | DumpID(id); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | void SkDLine::dumpInner() const { |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 146 | SkDebugf("{{"); |
| 147 | fPts[0].dump(); |
| 148 | SkDebugf(", "); |
| 149 | fPts[1].dump(); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | void SkDPoint::dump() const { |
| 153 | SkDebugf("{"); |
| 154 | DebugDumpDouble(fX); |
| 155 | SkDebugf(", "); |
| 156 | DebugDumpDouble(fY); |
| 157 | SkDebugf("}"); |
| 158 | } |
| 159 | |
| 160 | void SkDPoint::Dump(const SkPoint& pt) { |
| 161 | SkDebugf("{"); |
| 162 | DebugDumpFloat(pt.fX); |
| 163 | SkDebugf(", "); |
| 164 | DebugDumpFloat(pt.fY); |
| 165 | SkDebugf("}"); |
| 166 | } |
| 167 | |
caryclark | 65f5531 | 2014-11-13 06:58:52 -0800 | [diff] [blame] | 168 | void SkDPoint::DumpHex(const SkPoint& pt) { |
| 169 | SkDebugf("{"); |
| 170 | DebugDumpHexFloat(pt.fX); |
| 171 | SkDebugf(", "); |
| 172 | DebugDumpHexFloat(pt.fY); |
| 173 | SkDebugf("}"); |
| 174 | } |
| 175 | |
| 176 | void SkDQuad::dump() const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 177 | dumpInner(); |
| 178 | SkDebugf("}},\n"); |
caryclark | 65f5531 | 2014-11-13 06:58:52 -0800 | [diff] [blame] | 179 | } |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 180 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 181 | void SkDQuad::dumpID(int id) const { |
| 182 | dumpInner(); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 183 | SkDebugf("}"); |
| 184 | DumpID(id); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 185 | } |
| 186 | |
| 187 | void SkDQuad::dumpInner() const { |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 188 | SkDebugf("{{"); |
| 189 | int index = 0; |
| 190 | do { |
| 191 | fPts[index].dump(); |
| 192 | SkDebugf(", "); |
| 193 | } while (++index < 2); |
| 194 | fPts[index].dump(); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 195 | } |
| 196 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 197 | void SkIntersections::dump() const { |
| 198 | SkDebugf("used=%d of %d", fUsed, fMax); |
| 199 | for (int index = 0; index < fUsed; ++index) { |
| 200 | SkDebugf(" t=(%s%1.9g,%s%1.9g) pt=(%1.9g,%1.9g)", |
| 201 | fIsCoincident[0] & (1 << index) ? "*" : "", fT[0][index], |
| 202 | fIsCoincident[1] & (1 << index) ? "*" : "", fT[1][index], |
| 203 | fPt[index].fX, fPt[index].fY); |
| 204 | if (index < 2 && fNearlySame[index]) { |
| 205 | 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] | 206 | } |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 207 | } |
| 208 | SkDebugf("\n"); |
| 209 | } |
| 210 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 211 | namespace SkOpDebug { |
| 212 | |
| 213 | const ::SkOpAngle* AngleAngle(const ::SkOpAngle* angle, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 214 | return angle->debugAngle(id); |
| 215 | } |
| 216 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 217 | ::SkOpContour* AngleContour(::SkOpAngle* angle, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 218 | return angle->debugContour(id); |
| 219 | } |
| 220 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 221 | const ::SkOpPtT* AnglePtT(const ::SkOpAngle* angle, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 222 | return angle->debugPtT(id); |
| 223 | } |
| 224 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 225 | const ::SkOpSegment* AngleSegment(const ::SkOpAngle* angle, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 226 | return angle->debugSegment(id); |
| 227 | } |
| 228 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 229 | const ::SkOpSpanBase* AngleSpan(const ::SkOpAngle* angle, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 230 | return angle->debugSpan(id); |
| 231 | } |
| 232 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 233 | const ::SkOpAngle* ContourAngle(::SkOpContour* contour, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 234 | return contour->debugAngle(id); |
| 235 | } |
| 236 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 237 | ::SkOpContour* ContourContour(::SkOpContour* contour, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 238 | return contour->debugContour(id); |
| 239 | } |
| 240 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 241 | const ::SkOpPtT* ContourPtT(::SkOpContour* contour, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 242 | return contour->debugPtT(id); |
| 243 | } |
| 244 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 245 | const ::SkOpSegment* ContourSegment(::SkOpContour* contour, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 246 | return contour->debugSegment(id); |
| 247 | } |
| 248 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 249 | const ::SkOpSpanBase* ContourSpan(::SkOpContour* contour, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 250 | return contour->debugSpan(id); |
| 251 | } |
| 252 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 253 | const ::SkOpAngle* CoincidenceAngle(::SkOpCoincidence* coin, int id) { |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 254 | return coin->debugAngle(id); |
| 255 | } |
| 256 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 257 | ::SkOpContour* CoincidenceContour(::SkOpCoincidence* coin, int id) { |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 258 | return coin->debugContour(id); |
| 259 | } |
| 260 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 261 | const ::SkOpPtT* CoincidencePtT(::SkOpCoincidence* coin, int id) { |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 262 | return coin->debugPtT(id); |
| 263 | } |
| 264 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 265 | const ::SkOpSegment* CoincidenceSegment(::SkOpCoincidence* coin, int id) { |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 266 | return coin->debugSegment(id); |
| 267 | } |
| 268 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 269 | const ::SkOpSpanBase* CoincidenceSpan(::SkOpCoincidence* coin, int id) { |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 270 | return coin->debugSpan(id); |
| 271 | } |
| 272 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 273 | const ::SkOpAngle* PtTAngle(const ::SkOpPtT* ptT, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 274 | return ptT->debugAngle(id); |
| 275 | } |
| 276 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 277 | ::SkOpContour* PtTContour(::SkOpPtT* ptT, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 278 | return ptT->debugContour(id); |
| 279 | } |
| 280 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 281 | const ::SkOpPtT* PtTPtT(const ::SkOpPtT* ptT, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 282 | return ptT->debugPtT(id); |
| 283 | } |
| 284 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 285 | const ::SkOpSegment* PtTSegment(const ::SkOpPtT* ptT, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 286 | return ptT->debugSegment(id); |
| 287 | } |
| 288 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 289 | const ::SkOpSpanBase* PtTSpan(const ::SkOpPtT* ptT, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 290 | return ptT->debugSpan(id); |
| 291 | } |
| 292 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 293 | const ::SkOpAngle* SegmentAngle(const ::SkOpSegment* span, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 294 | return span->debugAngle(id); |
| 295 | } |
| 296 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 297 | ::SkOpContour* SegmentContour(::SkOpSegment* span, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 298 | return span->debugContour(id); |
| 299 | } |
| 300 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 301 | const ::SkOpPtT* SegmentPtT(const ::SkOpSegment* span, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 302 | return span->debugPtT(id); |
| 303 | } |
| 304 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 305 | const ::SkOpSegment* SegmentSegment(const ::SkOpSegment* span, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 306 | return span->debugSegment(id); |
| 307 | } |
| 308 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 309 | const ::SkOpSpanBase* SegmentSpan(const ::SkOpSegment* span, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 310 | return span->debugSpan(id); |
| 311 | } |
| 312 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 313 | const ::SkOpAngle* SpanAngle(const ::SkOpSpanBase* span, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 314 | return span->debugAngle(id); |
| 315 | } |
| 316 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 317 | ::SkOpContour* SpanContour(::SkOpSpanBase* span, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 318 | return span->debugContour(id); |
| 319 | } |
| 320 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 321 | const ::SkOpPtT* SpanPtT(const ::SkOpSpanBase* span, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 322 | return span->debugPtT(id); |
| 323 | } |
| 324 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 325 | const ::SkOpSegment* SpanSegment(const ::SkOpSpanBase* span, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 326 | return span->debugSegment(id); |
| 327 | } |
| 328 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 329 | const ::SkOpSpanBase* SpanSpan(const ::SkOpSpanBase* span, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 330 | return span->debugSpan(id); |
| 331 | } |
| 332 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 333 | } // namespace SkPathOpsDebug |
| 334 | |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 335 | #if DEBUG_COIN |
| 336 | void SkPathOpsDebug::DumpCoinDict() { |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 337 | SkPathOpsDebug::gCoinSumChangedDict.dump("unused coin algorithm", false); |
| 338 | SkPathOpsDebug::gCoinSumVisitedDict.dump("visited coin function", true); |
Cary Clark | ab87d7a | 2016-10-04 10:01:04 -0400 | [diff] [blame] | 339 | } |
| 340 | |
| 341 | void SkPathOpsDebug::CoinDict::dump(const char* str, bool visitCheck) const { |
| 342 | int count = fDict.count(); |
| 343 | for (int index = 0; index < count; ++index) { |
| 344 | const auto& entry = fDict[index]; |
| 345 | if (visitCheck || entry.fGlitchType == kUninitialized_Glitch) { |
| 346 | SkDebugf("%s %s : line %d iteration %d", str, entry.fFunctionName, |
| 347 | entry.fLineNumber, entry.fIteration); |
| 348 | DumpGlitchType(entry.fGlitchType); |
| 349 | SkDebugf("\n"); |
| 350 | } |
| 351 | } |
| 352 | } |
| 353 | #endif |
| 354 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 355 | void SkOpContour::dumpContours() const { |
| 356 | SkOpContour* contour = this->globalState()->contourHead(); |
| 357 | do { |
| 358 | contour->dump(); |
| 359 | } while ((contour = contour->next())); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 360 | } |
| 361 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 362 | void SkOpContour::dumpContoursAll() const { |
| 363 | SkOpContour* contour = this->globalState()->contourHead(); |
| 364 | do { |
| 365 | contour->dumpAll(); |
| 366 | } while ((contour = contour->next())); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 367 | } |
| 368 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 369 | void SkOpContour::dumpContoursAngles() const { |
| 370 | SkOpContour* contour = this->globalState()->contourHead(); |
| 371 | do { |
| 372 | contour->dumpAngles(); |
| 373 | } while ((contour = contour->next())); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 374 | } |
| 375 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 376 | void SkOpContour::dumpContoursPts() const { |
| 377 | SkOpContour* contour = this->globalState()->contourHead(); |
| 378 | do { |
| 379 | contour->dumpPts(); |
| 380 | } while ((contour = contour->next())); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 381 | } |
| 382 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 383 | void SkOpContour::dumpContoursPt(int segmentID) const { |
| 384 | SkOpContour* contour = this->globalState()->contourHead(); |
| 385 | do { |
| 386 | contour->dumpPt(segmentID); |
| 387 | } while ((contour = contour->next())); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 388 | } |
| 389 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 390 | void SkOpContour::dumpContoursSegment(int segmentID) const { |
| 391 | SkOpContour* contour = this->globalState()->contourHead(); |
| 392 | do { |
| 393 | contour->dumpSegment(segmentID); |
| 394 | } while ((contour = contour->next())); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 395 | } |
| 396 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 397 | void SkOpContour::dumpContoursSpan(int spanID) const { |
| 398 | SkOpContour* contour = this->globalState()->contourHead(); |
| 399 | do { |
| 400 | contour->dumpSpan(spanID); |
| 401 | } while ((contour = contour->next())); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 402 | } |
| 403 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 404 | void SkOpContour::dumpContoursSpans() const { |
| 405 | SkOpContour* contour = this->globalState()->contourHead(); |
| 406 | do { |
| 407 | contour->dumpSpans(); |
| 408 | } while ((contour = contour->next())); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 409 | } |
| 410 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 411 | template <typename TCurve, typename OppCurve> |
| 412 | const SkTSpan<TCurve, OppCurve>* DebugSpan(const SkTSect<TCurve, OppCurve>* sect, int id) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 413 | return sect->debugSpan(id); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 414 | } |
| 415 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 416 | void DontCallDebugSpan(int id); |
| 417 | void DontCallDebugSpan(int id) { // exists to instantiate the templates |
| 418 | SkDQuad quad; |
| 419 | SkDConic conic; |
| 420 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 421 | SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 422 | SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 423 | SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 424 | SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 425 | SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 426 | SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 427 | SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 428 | SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 429 | SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 430 | DebugSpan(&q1q2, id); |
| 431 | DebugSpan(&q1k2, id); |
| 432 | DebugSpan(&q1c2, id); |
| 433 | DebugSpan(&k1q2, id); |
| 434 | DebugSpan(&k1k2, id); |
| 435 | DebugSpan(&k1c2, id); |
| 436 | DebugSpan(&c1q2, id); |
| 437 | DebugSpan(&c1k2, id); |
| 438 | DebugSpan(&c1c2, id); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 439 | } |
| 440 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 441 | template <typename TCurve, typename OppCurve> |
| 442 | const SkTSpan<TCurve, OppCurve>* DebugT(const SkTSect<TCurve, OppCurve>* sect, double t) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 443 | return sect->debugT(t); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 444 | } |
| 445 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 446 | void DontCallDebugT(double t); |
| 447 | void DontCallDebugT(double t) { // exists to instantiate the templates |
| 448 | SkDQuad quad; |
| 449 | SkDConic conic; |
| 450 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 451 | SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 452 | SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 453 | SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 454 | SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 455 | SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 456 | SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 457 | SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 458 | SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 459 | SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 460 | DebugT(&q1q2, t); |
| 461 | DebugT(&q1k2, t); |
| 462 | DebugT(&q1c2, t); |
| 463 | DebugT(&k1q2, t); |
| 464 | DebugT(&k1k2, t); |
| 465 | DebugT(&k1c2, t); |
| 466 | DebugT(&c1q2, t); |
| 467 | DebugT(&c1k2, t); |
| 468 | DebugT(&c1c2, t); |
caryclark | dac1d17 | 2014-06-17 05:15:38 -0700 | [diff] [blame] | 469 | } |
| 470 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 471 | template <typename TCurve, typename OppCurve> |
| 472 | void Dump(const SkTSect<TCurve, OppCurve>* sect) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 473 | sect->dump(); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 474 | } |
| 475 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 476 | void DontCallDumpTSect(); |
| 477 | void DontCallDumpTSect() { // exists to instantiate the templates |
| 478 | SkDQuad quad; |
| 479 | SkDConic conic; |
| 480 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 481 | SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 482 | SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 483 | SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 484 | SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 485 | SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 486 | SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 487 | SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 488 | SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 489 | SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 490 | Dump(&q1q2); |
| 491 | Dump(&q1k2); |
| 492 | Dump(&q1c2); |
| 493 | Dump(&k1q2); |
| 494 | Dump(&k1k2); |
| 495 | Dump(&k1c2); |
| 496 | Dump(&c1q2); |
| 497 | Dump(&c1k2); |
| 498 | Dump(&c1c2); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 499 | } |
| 500 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 501 | template <typename TCurve, typename OppCurve> |
| 502 | void DumpBoth(SkTSect<TCurve, OppCurve>* sect1, SkTSect<OppCurve, TCurve>* sect2) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 503 | sect1->dumpBoth(sect2); |
caryclark | dac1d17 | 2014-06-17 05:15:38 -0700 | [diff] [blame] | 504 | } |
| 505 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 506 | void DontCallDumpBoth(); |
| 507 | void DontCallDumpBoth() { // exists to instantiate the templates |
| 508 | SkDQuad quad; |
| 509 | SkDConic conic; |
| 510 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 511 | SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 512 | SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 513 | SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 514 | SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 515 | SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 516 | SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 517 | SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 518 | SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 519 | SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 520 | DumpBoth(&q1q2, &q1q2); |
| 521 | DumpBoth(&q1k2, &k1q2); |
| 522 | DumpBoth(&q1c2, &c1q2); |
| 523 | DumpBoth(&k1q2, &q1k2); |
| 524 | DumpBoth(&k1k2, &k1k2); |
| 525 | DumpBoth(&k1c2, &c1k2); |
| 526 | DumpBoth(&c1q2, &q1c2); |
| 527 | DumpBoth(&c1k2, &k1c2); |
| 528 | DumpBoth(&c1c2, &c1c2); |
caryclark | dac1d17 | 2014-06-17 05:15:38 -0700 | [diff] [blame] | 529 | } |
| 530 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 531 | template <typename TCurve, typename OppCurve> |
| 532 | void DumpBounded(SkTSect<TCurve, OppCurve>* sect1, int id) { |
| 533 | sect1->dumpBounded(id); |
| 534 | } |
| 535 | |
| 536 | void DontCallDumpBounded(); |
| 537 | void DontCallDumpBounded() { |
| 538 | SkDQuad quad; |
| 539 | SkDConic conic; |
| 540 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 541 | SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 542 | SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 543 | SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 544 | SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 545 | SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 546 | SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 547 | SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 548 | SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 549 | SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 550 | DumpBounded(&q1q2, 0); |
| 551 | DumpBounded(&q1k2, 0); |
| 552 | DumpBounded(&q1c2, 0); |
| 553 | DumpBounded(&k1q2, 0); |
| 554 | DumpBounded(&k1k2, 0); |
| 555 | DumpBounded(&k1c2, 0); |
| 556 | DumpBounded(&c1q2, 0); |
| 557 | DumpBounded(&c1k2, 0); |
| 558 | DumpBounded(&c1c2, 0); |
| 559 | } |
| 560 | |
| 561 | template <typename TCurve, typename OppCurve> |
| 562 | void DumpBounds(SkTSect<TCurve, OppCurve>* sect1) { |
| 563 | sect1->dumpBounds(); |
| 564 | } |
| 565 | |
| 566 | void DontCallDumpBounds(); |
| 567 | void DontCallDumpBounds() { |
| 568 | SkDQuad quad; |
| 569 | SkDConic conic; |
| 570 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 571 | SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 572 | SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 573 | SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 574 | SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 575 | SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 576 | SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 577 | SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 578 | SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 579 | SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 580 | DumpBounds(&q1q2); |
| 581 | DumpBounds(&q1k2); |
| 582 | DumpBounds(&q1c2); |
| 583 | DumpBounds(&k1q2); |
| 584 | DumpBounds(&k1k2); |
| 585 | DumpBounds(&k1c2); |
| 586 | DumpBounds(&c1q2); |
| 587 | DumpBounds(&c1k2); |
| 588 | DumpBounds(&c1c2); |
| 589 | } |
| 590 | |
| 591 | template <typename TCurve, typename OppCurve> |
| 592 | void DumpCoin(SkTSect<TCurve, OppCurve>* sect1) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 593 | sect1->dumpCoin(); |
caryclark | dac1d17 | 2014-06-17 05:15:38 -0700 | [diff] [blame] | 594 | } |
| 595 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 596 | void DontCallDumpCoin(); |
| 597 | void DontCallDumpCoin() { // exists to instantiate the templates |
| 598 | SkDQuad quad; |
| 599 | SkDConic conic; |
| 600 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 601 | SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 602 | SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 603 | SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 604 | SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 605 | SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 606 | SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 607 | SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 608 | SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 609 | SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 610 | DumpCoin(&q1q2); |
| 611 | DumpCoin(&q1k2); |
| 612 | DumpCoin(&q1c2); |
| 613 | DumpCoin(&k1q2); |
| 614 | DumpCoin(&k1k2); |
| 615 | DumpCoin(&k1c2); |
| 616 | DumpCoin(&c1q2); |
| 617 | DumpCoin(&c1k2); |
| 618 | DumpCoin(&c1c2); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 619 | } |
| 620 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 621 | template <typename TCurve, typename OppCurve> |
| 622 | void DumpCoinCurves(SkTSect<TCurve, OppCurve>* sect1) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 623 | sect1->dumpCoinCurves(); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 624 | } |
| 625 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 626 | void DontCallDumpCoinCurves(); |
| 627 | void DontCallDumpCoinCurves() { // exists to instantiate the templates |
| 628 | SkDQuad quad; |
| 629 | SkDConic conic; |
| 630 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 631 | SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 632 | SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 633 | SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 634 | SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 635 | SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 636 | SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 637 | SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 638 | SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 639 | SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 640 | DumpCoinCurves(&q1q2); |
| 641 | DumpCoinCurves(&q1k2); |
| 642 | DumpCoinCurves(&q1c2); |
| 643 | DumpCoinCurves(&k1q2); |
| 644 | DumpCoinCurves(&k1k2); |
| 645 | DumpCoinCurves(&k1c2); |
| 646 | DumpCoinCurves(&c1q2); |
| 647 | DumpCoinCurves(&c1k2); |
| 648 | DumpCoinCurves(&c1c2); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 649 | } |
| 650 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 651 | template <typename TCurve, typename OppCurve> |
| 652 | void DumpCurves(const SkTSect<TCurve, OppCurve>* sect) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 653 | sect->dumpCurves(); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 654 | } |
| 655 | |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 656 | void DontCallDumpCurves(); |
| 657 | void DontCallDumpCurves() { // exists to instantiate the templates |
| 658 | SkDQuad quad; |
| 659 | SkDConic conic; |
| 660 | SkDCubic cubic; |
caryclark | e25a4f6 | 2016-07-26 09:26:29 -0700 | [diff] [blame] | 661 | SkTSect<SkDQuad, SkDQuad> q1q2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 662 | SkTSect<SkDQuad, SkDConic> q1k2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 663 | SkTSect<SkDQuad, SkDCubic> q1c2(quad SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 664 | SkTSect<SkDConic, SkDQuad> k1q2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 665 | SkTSect<SkDConic, SkDConic> k1k2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 666 | SkTSect<SkDConic, SkDCubic> k1c2(conic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 667 | SkTSect<SkDCubic, SkDQuad> c1q2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 668 | SkTSect<SkDCubic, SkDConic> c1k2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
| 669 | SkTSect<SkDCubic, SkDCubic> c1c2(cubic SkDEBUGPARAMS(nullptr) PATH_OPS_DEBUG_T_SECT_PARAMS(1)); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 670 | DumpCurves(&q1q2); |
| 671 | DumpCurves(&q1k2); |
| 672 | DumpCurves(&q1c2); |
| 673 | DumpCurves(&k1q2); |
| 674 | DumpCurves(&k1k2); |
| 675 | DumpCurves(&k1c2); |
| 676 | DumpCurves(&c1q2); |
| 677 | DumpCurves(&c1k2); |
| 678 | DumpCurves(&c1c2); |
| 679 | } |
| 680 | |
| 681 | template <typename TCurve, typename OppCurve> |
| 682 | void Dump(const SkTSpan<TCurve, OppCurve>* span) { |
| 683 | span->dump(); |
| 684 | } |
| 685 | |
| 686 | void DontCallDumpTSpan(); |
| 687 | void DontCallDumpTSpan() { // exists to instantiate the templates |
| 688 | SkTSpan<SkDQuad, SkDQuad> q1q2; q1q2.debugInit(); |
| 689 | SkTSpan<SkDQuad, SkDConic> q1k2; q1k2.debugInit(); |
| 690 | SkTSpan<SkDQuad, SkDCubic> q1c2; q1c2.debugInit(); |
| 691 | SkTSpan<SkDConic, SkDQuad> k1q2; k1q2.debugInit(); |
| 692 | SkTSpan<SkDConic, SkDConic> k1k2; k1k2.debugInit(); |
| 693 | SkTSpan<SkDConic, SkDCubic> k1c2; k1c2.debugInit(); |
| 694 | SkTSpan<SkDCubic, SkDQuad> c1q2; c1q2.debugInit(); |
| 695 | SkTSpan<SkDCubic, SkDConic> c1k2; c1k2.debugInit(); |
| 696 | SkTSpan<SkDCubic, SkDCubic> c1c2; c1c2.debugInit(); |
| 697 | Dump(&q1q2); |
| 698 | Dump(&q1k2); |
| 699 | Dump(&q1c2); |
| 700 | Dump(&k1q2); |
| 701 | Dump(&k1k2); |
| 702 | Dump(&k1c2); |
| 703 | Dump(&c1q2); |
| 704 | Dump(&c1k2); |
| 705 | Dump(&c1c2); |
| 706 | } |
| 707 | |
| 708 | template <typename TCurve, typename OppCurve> |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 709 | void DumpAll(const SkTSpan<TCurve, OppCurve>* span) { |
| 710 | span->dumpAll(); |
| 711 | } |
| 712 | |
| 713 | void DontCallDumpSpanAll(); |
| 714 | void DontCallDumpSpanAll() { // exists to instantiate the templates |
| 715 | SkTSpan<SkDQuad, SkDQuad> q1q2; q1q2.debugInit(); |
| 716 | SkTSpan<SkDQuad, SkDConic> q1k2; q1k2.debugInit(); |
| 717 | SkTSpan<SkDQuad, SkDCubic> q1c2; q1c2.debugInit(); |
| 718 | SkTSpan<SkDConic, SkDQuad> k1q2; k1q2.debugInit(); |
| 719 | SkTSpan<SkDConic, SkDConic> k1k2; k1k2.debugInit(); |
| 720 | SkTSpan<SkDConic, SkDCubic> k1c2; k1c2.debugInit(); |
| 721 | SkTSpan<SkDCubic, SkDQuad> c1q2; c1q2.debugInit(); |
| 722 | SkTSpan<SkDCubic, SkDConic> c1k2; c1k2.debugInit(); |
| 723 | SkTSpan<SkDCubic, SkDCubic> c1c2; c1c2.debugInit(); |
| 724 | DumpAll(&q1q2); |
| 725 | DumpAll(&q1k2); |
| 726 | DumpAll(&q1c2); |
| 727 | DumpAll(&k1q2); |
| 728 | DumpAll(&k1k2); |
| 729 | DumpAll(&k1c2); |
| 730 | DumpAll(&c1q2); |
| 731 | DumpAll(&c1k2); |
| 732 | DumpAll(&c1c2); |
| 733 | } |
| 734 | |
| 735 | template <typename TCurve, typename OppCurve> |
| 736 | void DumpBounded(const SkTSpan<TCurve, OppCurve>* span) { |
| 737 | span->dumpBounded(0); |
| 738 | } |
| 739 | |
| 740 | void DontCallDumpSpanBounded(); |
| 741 | void DontCallDumpSpanBounded() { // exists to instantiate the templates |
| 742 | SkTSpan<SkDQuad, SkDQuad> q1q2; q1q2.debugInit(); |
| 743 | SkTSpan<SkDQuad, SkDConic> q1k2; q1k2.debugInit(); |
| 744 | SkTSpan<SkDQuad, SkDCubic> q1c2; q1c2.debugInit(); |
| 745 | SkTSpan<SkDConic, SkDQuad> k1q2; k1q2.debugInit(); |
| 746 | SkTSpan<SkDConic, SkDConic> k1k2; k1k2.debugInit(); |
| 747 | SkTSpan<SkDConic, SkDCubic> k1c2; k1c2.debugInit(); |
| 748 | SkTSpan<SkDCubic, SkDQuad> c1q2; c1q2.debugInit(); |
| 749 | SkTSpan<SkDCubic, SkDConic> c1k2; c1k2.debugInit(); |
| 750 | SkTSpan<SkDCubic, SkDCubic> c1c2; c1c2.debugInit(); |
| 751 | DumpBounded(&q1q2); |
| 752 | DumpBounded(&q1k2); |
| 753 | DumpBounded(&q1c2); |
| 754 | DumpBounded(&k1q2); |
| 755 | DumpBounded(&k1k2); |
| 756 | DumpBounded(&k1c2); |
| 757 | DumpBounded(&c1q2); |
| 758 | DumpBounded(&c1k2); |
| 759 | DumpBounded(&c1c2); |
| 760 | } |
| 761 | |
| 762 | template <typename TCurve, typename OppCurve> |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 763 | void DumpCoin(const SkTSpan<TCurve, OppCurve>* span) { |
| 764 | span->dumpCoin(); |
| 765 | } |
| 766 | |
| 767 | void DontCallDumpSpanCoin(); |
| 768 | void DontCallDumpSpanCoin() { // exists to instantiate the templates |
| 769 | SkTSpan<SkDQuad, SkDQuad> q1q2; q1q2.debugInit(); |
| 770 | SkTSpan<SkDQuad, SkDConic> q1k2; q1k2.debugInit(); |
| 771 | SkTSpan<SkDQuad, SkDCubic> q1c2; q1c2.debugInit(); |
| 772 | SkTSpan<SkDConic, SkDQuad> k1q2; k1q2.debugInit(); |
| 773 | SkTSpan<SkDConic, SkDConic> k1k2; k1k2.debugInit(); |
| 774 | SkTSpan<SkDConic, SkDCubic> k1c2; k1c2.debugInit(); |
| 775 | SkTSpan<SkDCubic, SkDQuad> c1q2; c1q2.debugInit(); |
| 776 | SkTSpan<SkDCubic, SkDConic> c1k2; c1k2.debugInit(); |
| 777 | SkTSpan<SkDCubic, SkDCubic> c1c2; c1c2.debugInit(); |
| 778 | DumpCoin(&q1q2); |
| 779 | DumpCoin(&q1k2); |
| 780 | DumpCoin(&q1c2); |
| 781 | DumpCoin(&k1q2); |
| 782 | DumpCoin(&k1k2); |
| 783 | DumpCoin(&k1c2); |
| 784 | DumpCoin(&c1q2); |
| 785 | DumpCoin(&c1k2); |
| 786 | DumpCoin(&c1c2); |
caryclark | dac1d17 | 2014-06-17 05:15:38 -0700 | [diff] [blame] | 787 | } |
| 788 | |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 789 | static void dumpTestCase(const SkDQuad& quad1, const SkDQuad& quad2, int testNo) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 790 | SkDebugf("\n<div id=\"quad%d\">\n", testNo); |
| 791 | quad1.dumpInner(); |
| 792 | SkDebugf("}}, "); |
commit-bot@chromium.org | 4431e77 | 2014-04-14 17:08:59 +0000 | [diff] [blame] | 793 | quad2.dump(); |
| 794 | SkDebugf("</div>\n\n"); |
| 795 | } |
| 796 | |
| 797 | static void dumpTestTrailer() { |
| 798 | SkDebugf("</div>\n\n<script type=\"text/javascript\">\n\n"); |
| 799 | SkDebugf(" var testDivs = [\n"); |
| 800 | } |
| 801 | |
| 802 | static void dumpTestList(int testNo, double min) { |
| 803 | SkDebugf(" quad%d,", testNo); |
| 804 | if (min > 0) { |
| 805 | SkDebugf(" // %1.9g", min); |
| 806 | } |
| 807 | SkDebugf("\n"); |
| 808 | } |
| 809 | |
| 810 | void DumpQ(const SkDQuad& quad1, const SkDQuad& quad2, int testNo) { |
| 811 | SkDebugf("\n"); |
| 812 | dumpTestCase(quad1, quad2, testNo); |
| 813 | dumpTestTrailer(); |
| 814 | dumpTestList(testNo, 0); |
| 815 | SkDebugf("\n"); |
| 816 | } |
| 817 | |
| 818 | void DumpT(const SkDQuad& quad, double t) { |
| 819 | SkDLine line = {{quad.ptAtT(t), quad[0]}}; |
| 820 | line.dump(); |
| 821 | } |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 822 | |
| 823 | const SkOpAngle* SkOpAngle::debugAngle(int id) const { |
| 824 | return this->segment()->debugAngle(id); |
| 825 | } |
| 826 | |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 827 | const SkOpCoincidence* SkOpAngle::debugCoincidence() const { |
| 828 | return this->segment()->debugCoincidence(); |
| 829 | } |
| 830 | |
caryclark | 30b9fdd | 2016-08-31 14:36:29 -0700 | [diff] [blame] | 831 | SkOpContour* SkOpAngle::debugContour(int id) const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 832 | return this->segment()->debugContour(id); |
| 833 | } |
| 834 | |
| 835 | const SkOpPtT* SkOpAngle::debugPtT(int id) const { |
| 836 | return this->segment()->debugPtT(id); |
| 837 | } |
| 838 | |
| 839 | const SkOpSegment* SkOpAngle::debugSegment(int id) const { |
| 840 | return this->segment()->debugSegment(id); |
| 841 | } |
| 842 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 843 | int SkOpAngle::debugSign() const { |
| 844 | SkASSERT(fStart->t() != fEnd->t()); |
| 845 | return fStart->t() < fEnd->t() ? -1 : 1; |
| 846 | } |
| 847 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 848 | const SkOpSpanBase* SkOpAngle::debugSpan(int id) const { |
| 849 | return this->segment()->debugSpan(id); |
| 850 | } |
| 851 | |
| 852 | void SkOpAngle::dump() const { |
| 853 | dumpOne(true); |
| 854 | SkDebugf("\n"); |
| 855 | } |
| 856 | |
| 857 | void SkOpAngle::dumpOne(bool functionHeader) const { |
| 858 | // fSegment->debugValidate(); |
| 859 | const SkOpSegment* segment = this->segment(); |
| 860 | const SkOpSpan& mSpan = *fStart->starter(fEnd); |
| 861 | if (functionHeader) { |
| 862 | SkDebugf("%s ", __FUNCTION__); |
| 863 | } |
| 864 | SkDebugf("[%d", segment->debugID()); |
| 865 | SkDebugf("/%d", debugID()); |
| 866 | SkDebugf("] next="); |
| 867 | if (fNext) { |
| 868 | SkDebugf("%d", fNext->fStart->segment()->debugID()); |
| 869 | SkDebugf("/%d", fNext->debugID()); |
| 870 | } else { |
| 871 | SkDebugf("?"); |
| 872 | } |
| 873 | SkDebugf(" sect=%d/%d ", fSectorStart, fSectorEnd); |
| 874 | SkDebugf(" s=%1.9g [%d] e=%1.9g [%d]", fStart->t(), fStart->debugID(), |
| 875 | fEnd->t(), fEnd->debugID()); |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 876 | SkDebugf(" sgn=%d windVal=%d", this->debugSign(), mSpan.windValue()); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 877 | |
| 878 | SkDebugf(" windSum="); |
| 879 | SkPathOpsDebug::WindingPrintf(mSpan.windSum()); |
| 880 | if (mSpan.oppValue() != 0 || mSpan.oppSum() != SK_MinS32) { |
| 881 | SkDebugf(" oppVal=%d", mSpan.oppValue()); |
| 882 | SkDebugf(" oppSum="); |
| 883 | SkPathOpsDebug::WindingPrintf(mSpan.oppSum()); |
| 884 | } |
| 885 | if (mSpan.done()) { |
| 886 | SkDebugf(" done"); |
| 887 | } |
| 888 | if (unorderable()) { |
| 889 | SkDebugf(" unorderable"); |
| 890 | } |
| 891 | if (segment->operand()) { |
| 892 | SkDebugf(" operand"); |
| 893 | } |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 894 | } |
| 895 | |
| 896 | void SkOpAngle::dumpTo(const SkOpSegment* segment, const SkOpAngle* to) const { |
| 897 | const SkOpAngle* first = this; |
| 898 | const SkOpAngle* next = this; |
| 899 | const char* indent = ""; |
| 900 | do { |
| 901 | SkDebugf("%s", indent); |
| 902 | next->dumpOne(false); |
| 903 | if (segment == next->fStart->segment()) { |
| 904 | if (this == fNext) { |
| 905 | SkDebugf(" << from"); |
| 906 | } |
| 907 | if (to == fNext) { |
| 908 | SkDebugf(" << to"); |
| 909 | } |
| 910 | } |
| 911 | SkDebugf("\n"); |
| 912 | indent = " "; |
| 913 | next = next->fNext; |
| 914 | } while (next && next != first); |
| 915 | } |
| 916 | |
| 917 | void SkOpAngle::dumpCurves() const { |
| 918 | const SkOpAngle* first = this; |
| 919 | const SkOpAngle* next = this; |
| 920 | do { |
caryclark | eed356d | 2016-09-14 07:18:20 -0700 | [diff] [blame] | 921 | next->fPart.fCurve.dumpID(next->segment()->debugID()); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 922 | next = next->fNext; |
| 923 | } while (next && next != first); |
| 924 | } |
| 925 | |
| 926 | void SkOpAngle::dumpLoop() const { |
| 927 | const SkOpAngle* first = this; |
| 928 | const SkOpAngle* next = this; |
| 929 | do { |
| 930 | next->dumpOne(false); |
| 931 | SkDebugf("\n"); |
| 932 | next = next->fNext; |
| 933 | } while (next && next != first); |
| 934 | } |
| 935 | |
| 936 | void SkOpAngle::dumpTest() const { |
| 937 | const SkOpAngle* first = this; |
| 938 | const SkOpAngle* next = this; |
| 939 | do { |
| 940 | SkDebugf("{ "); |
| 941 | SkOpSegment* segment = next->segment(); |
| 942 | segment->dumpPts(); |
| 943 | SkDebugf(", %d, %1.9g, %1.9g, {} },\n", SkPathOpsVerbToPoints(segment->verb()) + 1, |
| 944 | next->start()->t(), next->end()->t()); |
| 945 | next = next->fNext; |
| 946 | } while (next && next != first); |
| 947 | } |
| 948 | |
| 949 | bool SkOpPtT::debugMatchID(int id) const { |
| 950 | int limit = this->debugLoopLimit(false); |
| 951 | int loop = 0; |
| 952 | const SkOpPtT* ptT = this; |
| 953 | do { |
| 954 | if (ptT->debugID() == id) { |
| 955 | return true; |
| 956 | } |
| 957 | } while ((!limit || ++loop <= limit) && (ptT = ptT->next()) && ptT != this); |
| 958 | return false; |
| 959 | } |
| 960 | |
| 961 | const SkOpAngle* SkOpPtT::debugAngle(int id) const { |
| 962 | return this->span()->debugAngle(id); |
| 963 | } |
| 964 | |
caryclark | 30b9fdd | 2016-08-31 14:36:29 -0700 | [diff] [blame] | 965 | SkOpContour* SkOpPtT::debugContour(int id) const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 966 | return this->span()->debugContour(id); |
| 967 | } |
| 968 | |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 969 | const SkOpCoincidence* SkOpPtT::debugCoincidence() const { |
| 970 | return this->span()->debugCoincidence(); |
| 971 | } |
| 972 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 973 | const SkOpPtT* SkOpPtT::debugPtT(int id) const { |
| 974 | return this->span()->debugPtT(id); |
| 975 | } |
| 976 | |
| 977 | const SkOpSegment* SkOpPtT::debugSegment(int id) const { |
| 978 | return this->span()->debugSegment(id); |
| 979 | } |
| 980 | |
| 981 | const SkOpSpanBase* SkOpPtT::debugSpan(int id) const { |
| 982 | return this->span()->debugSpan(id); |
| 983 | } |
| 984 | |
| 985 | void SkOpPtT::dump() const { |
| 986 | SkDebugf("seg=%d span=%d ptT=%d", |
| 987 | this->segment()->debugID(), this->span()->debugID(), this->debugID()); |
| 988 | this->dumpBase(); |
| 989 | SkDebugf("\n"); |
| 990 | } |
| 991 | |
| 992 | void SkOpPtT::dumpAll() const { |
| 993 | contour()->indentDump(); |
| 994 | const SkOpPtT* next = this; |
| 995 | int limit = debugLoopLimit(true); |
| 996 | int loop = 0; |
| 997 | do { |
| 998 | SkDebugf("%.*s", contour()->debugIndent(), " "); |
| 999 | SkDebugf("seg=%d span=%d ptT=%d", |
| 1000 | next->segment()->debugID(), next->span()->debugID(), next->debugID()); |
| 1001 | next->dumpBase(); |
| 1002 | SkDebugf("\n"); |
| 1003 | if (limit && ++loop >= limit) { |
| 1004 | SkDebugf("*** abort loop ***\n"); |
| 1005 | break; |
| 1006 | } |
| 1007 | } while ((next = next->fNext) && next != this); |
| 1008 | contour()->outdentDump(); |
| 1009 | } |
| 1010 | |
| 1011 | void SkOpPtT::dumpBase() const { |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1012 | SkDebugf(" t=%1.9g pt=(%1.9g,%1.9g)%s%s%s", this->fT, this->fPt.fX, this->fPt.fY, |
| 1013 | this->fCoincident ? " coin" : "", |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1014 | this->fDuplicatePt ? " dup" : "", this->fDeleted ? " deleted" : ""); |
| 1015 | } |
| 1016 | |
| 1017 | const SkOpAngle* SkOpSpanBase::debugAngle(int id) const { |
| 1018 | return this->segment()->debugAngle(id); |
| 1019 | } |
| 1020 | |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1021 | const SkOpCoincidence* SkOpSpanBase::debugCoincidence() const { |
| 1022 | return this->segment()->debugCoincidence(); |
| 1023 | } |
| 1024 | |
caryclark | 30b9fdd | 2016-08-31 14:36:29 -0700 | [diff] [blame] | 1025 | SkOpContour* SkOpSpanBase::debugContour(int id) const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1026 | return this->segment()->debugContour(id); |
| 1027 | } |
| 1028 | |
| 1029 | const SkOpPtT* SkOpSpanBase::debugPtT(int id) const { |
| 1030 | return this->segment()->debugPtT(id); |
| 1031 | } |
| 1032 | |
| 1033 | const SkOpSegment* SkOpSpanBase::debugSegment(int id) const { |
| 1034 | return this->segment()->debugSegment(id); |
| 1035 | } |
| 1036 | |
| 1037 | const SkOpSpanBase* SkOpSpanBase::debugSpan(int id) const { |
| 1038 | return this->segment()->debugSpan(id); |
| 1039 | } |
| 1040 | |
| 1041 | void SkOpSpanBase::dump() const { |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1042 | this->dumpHead(); |
| 1043 | this->fPtT.dump(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1044 | } |
| 1045 | |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1046 | void SkOpSpanBase::dumpHead() const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1047 | SkDebugf("%.*s", contour()->debugIndent(), " "); |
| 1048 | SkDebugf("seg=%d span=%d", this->segment()->debugID(), this->debugID()); |
| 1049 | this->dumpBase(); |
| 1050 | SkDebugf("\n"); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1051 | } |
| 1052 | |
| 1053 | void SkOpSpanBase::dumpAll() const { |
| 1054 | this->dumpHead(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1055 | this->fPtT.dumpAll(); |
| 1056 | } |
| 1057 | |
| 1058 | void SkOpSpanBase::dumpBase() const { |
| 1059 | if (this->fAligned) { |
| 1060 | SkDebugf(" aligned"); |
| 1061 | } |
| 1062 | if (this->fChased) { |
| 1063 | SkDebugf(" chased"); |
| 1064 | } |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1065 | #ifdef SK_DEBUG |
caryclark | 30b9fdd | 2016-08-31 14:36:29 -0700 | [diff] [blame] | 1066 | if (this->fDebugDeleted) { |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1067 | SkDebugf(" deleted"); |
| 1068 | } |
| 1069 | #endif |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1070 | if (!this->final()) { |
| 1071 | this->upCast()->dumpSpan(); |
| 1072 | } |
| 1073 | const SkOpSpanBase* coin = this->coinEnd(); |
| 1074 | if (this != coin) { |
| 1075 | SkDebugf(" coinEnd seg/span=%d/%d", coin->segment()->debugID(), coin->debugID()); |
| 1076 | } else if (this->final() || !this->upCast()->isCoincident()) { |
| 1077 | const SkOpPtT* oPt = this->ptT()->next(); |
| 1078 | SkDebugf(" seg/span=%d/%d", oPt->segment()->debugID(), oPt->span()->debugID()); |
| 1079 | } |
caryclark | 08bc848 | 2015-04-24 09:08:57 -0700 | [diff] [blame] | 1080 | SkDebugf(" adds=%d", fSpanAdds); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1081 | } |
| 1082 | |
| 1083 | void SkOpSpanBase::dumpCoin() const { |
| 1084 | const SkOpSpan* span = this->upCastable(); |
| 1085 | if (!span) { |
| 1086 | return; |
| 1087 | } |
| 1088 | if (!span->isCoincident()) { |
| 1089 | return; |
| 1090 | } |
| 1091 | span->dumpCoin(); |
| 1092 | } |
| 1093 | |
| 1094 | void SkOpSpan::dumpCoin() const { |
| 1095 | const SkOpSpan* coincident = fCoincident; |
| 1096 | bool ok = debugCoinLoopCheck(); |
| 1097 | this->dump(); |
| 1098 | int loop = 0; |
| 1099 | do { |
| 1100 | coincident->dump(); |
| 1101 | if (!ok && ++loop > 10) { |
| 1102 | SkDebugf("*** abort loop ***\n"); |
| 1103 | break; |
| 1104 | } |
| 1105 | } while ((coincident = coincident->fCoincident) != this); |
| 1106 | } |
| 1107 | |
| 1108 | bool SkOpSpan::dumpSpan() const { |
| 1109 | SkOpSpan* coin = fCoincident; |
| 1110 | if (this != coin) { |
| 1111 | SkDebugf(" coinStart seg/span=%d/%d", coin->segment()->debugID(), coin->debugID()); |
| 1112 | } |
| 1113 | SkDebugf(" windVal=%d", this->windValue()); |
| 1114 | SkDebugf(" windSum="); |
| 1115 | SkPathOpsDebug::WindingPrintf(this->windSum()); |
| 1116 | if (this->oppValue() != 0 || this->oppSum() != SK_MinS32) { |
| 1117 | SkDebugf(" oppVal=%d", this->oppValue()); |
| 1118 | SkDebugf(" oppSum="); |
| 1119 | SkPathOpsDebug::WindingPrintf(this->oppSum()); |
| 1120 | } |
| 1121 | if (this->done()) { |
| 1122 | SkDebugf(" done"); |
| 1123 | } |
| 1124 | return this != coin; |
| 1125 | } |
| 1126 | |
| 1127 | const SkOpAngle* SkOpSegment::debugAngle(int id) const { |
| 1128 | return this->contour()->debugAngle(id); |
| 1129 | } |
| 1130 | |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1131 | |
| 1132 | const SkOpCoincidence* SkOpSegment::debugCoincidence() const { |
| 1133 | return this->contour()->debugCoincidence(); |
| 1134 | } |
| 1135 | |
caryclark | 30b9fdd | 2016-08-31 14:36:29 -0700 | [diff] [blame] | 1136 | SkOpContour* SkOpSegment::debugContour(int id) const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1137 | return this->contour()->debugContour(id); |
| 1138 | } |
| 1139 | |
| 1140 | const SkOpPtT* SkOpSegment::debugPtT(int id) const { |
| 1141 | return this->contour()->debugPtT(id); |
| 1142 | } |
| 1143 | |
| 1144 | const SkOpSegment* SkOpSegment::debugSegment(int id) const { |
| 1145 | return this->contour()->debugSegment(id); |
| 1146 | } |
| 1147 | |
| 1148 | const SkOpSpanBase* SkOpSegment::debugSpan(int id) const { |
| 1149 | return this->contour()->debugSpan(id); |
| 1150 | } |
| 1151 | |
| 1152 | void SkOpSegment::dump() const { |
| 1153 | SkDebugf("%.*s", contour()->debugIndent(), " "); |
| 1154 | this->dumpPts(); |
| 1155 | const SkOpSpanBase* span = &fHead; |
| 1156 | contour()->indentDump(); |
| 1157 | do { |
| 1158 | SkDebugf("%.*s span=%d ", contour()->debugIndent(), " ", span->debugID()); |
| 1159 | span->ptT()->dumpBase(); |
| 1160 | span->dumpBase(); |
| 1161 | SkDebugf("\n"); |
| 1162 | } while (!span->final() && (span = span->upCast()->next())); |
| 1163 | contour()->outdentDump(); |
| 1164 | } |
| 1165 | |
| 1166 | void SkOpSegment::dumpAll() const { |
| 1167 | SkDebugf("%.*s", contour()->debugIndent(), " "); |
| 1168 | this->dumpPts(); |
| 1169 | const SkOpSpanBase* span = &fHead; |
| 1170 | contour()->indentDump(); |
| 1171 | do { |
| 1172 | span->dumpAll(); |
| 1173 | } while (!span->final() && (span = span->upCast()->next())); |
| 1174 | contour()->outdentDump(); |
| 1175 | } |
| 1176 | |
| 1177 | void SkOpSegment::dumpAngles() const { |
| 1178 | SkDebugf("seg=%d\n", debugID()); |
| 1179 | const SkOpSpanBase* span = &fHead; |
| 1180 | do { |
| 1181 | const SkOpAngle* fAngle = span->fromAngle(); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 1182 | const SkOpAngle* tAngle = span->final() ? nullptr : span->upCast()->toAngle(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1183 | if (fAngle) { |
| 1184 | SkDebugf(" span=%d from=%d ", span->debugID(), fAngle->debugID()); |
| 1185 | fAngle->dumpTo(this, tAngle); |
| 1186 | } |
| 1187 | if (tAngle) { |
| 1188 | SkDebugf(" span=%d to=%d ", span->debugID(), tAngle->debugID()); |
| 1189 | tAngle->dumpTo(this, fAngle); |
| 1190 | } |
| 1191 | } while (!span->final() && (span = span->upCast()->next())); |
| 1192 | } |
| 1193 | |
| 1194 | void SkOpSegment::dumpCoin() const { |
| 1195 | const SkOpSpan* span = &fHead; |
| 1196 | do { |
| 1197 | span->dumpCoin(); |
| 1198 | } while ((span = span->next()->upCastable())); |
| 1199 | } |
| 1200 | |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1201 | void SkOpSegment::dumpPtsInner(const char* prefix) const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1202 | int last = SkPathOpsVerbToPoints(fVerb); |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1203 | SkDebugf("%s=%d {{", prefix, this->debugID()); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 1204 | if (fVerb == SkPath::kConic_Verb) { |
| 1205 | SkDebugf("{"); |
| 1206 | } |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1207 | int index = 0; |
| 1208 | do { |
| 1209 | SkDPoint::Dump(fPts[index]); |
| 1210 | SkDebugf(", "); |
| 1211 | } while (++index < last); |
| 1212 | SkDPoint::Dump(fPts[index]); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 1213 | SkDebugf("}}"); |
| 1214 | if (fVerb == SkPath::kConic_Verb) { |
| 1215 | SkDebugf(", %1.9gf}", fWeight); |
| 1216 | } |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1217 | } |
| 1218 | |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1219 | void SkOpSegment::dumpPts(const char* prefix) const { |
| 1220 | dumpPtsInner(prefix); |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 1221 | SkDebugf("\n"); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1222 | } |
| 1223 | |
| 1224 | void SkCoincidentSpans::dump() const { |
| 1225 | SkDebugf("- seg=%d span=%d ptT=%d ", fCoinPtTStart->segment()->debugID(), |
| 1226 | fCoinPtTStart->span()->debugID(), fCoinPtTStart->debugID()); |
| 1227 | fCoinPtTStart->dumpBase(); |
| 1228 | SkDebugf(" span=%d ptT=%d ", fCoinPtTEnd->span()->debugID(), fCoinPtTEnd->debugID()); |
| 1229 | fCoinPtTEnd->dumpBase(); |
| 1230 | if (fCoinPtTStart->segment()->operand()) { |
| 1231 | SkDebugf(" operand"); |
| 1232 | } |
| 1233 | if (fCoinPtTStart->segment()->isXor()) { |
| 1234 | SkDebugf(" xor"); |
| 1235 | } |
| 1236 | SkDebugf("\n"); |
| 1237 | SkDebugf("+ seg=%d span=%d ptT=%d ", fOppPtTStart->segment()->debugID(), |
| 1238 | fOppPtTStart->span()->debugID(), fOppPtTStart->debugID()); |
| 1239 | fOppPtTStart->dumpBase(); |
| 1240 | SkDebugf(" span=%d ptT=%d ", fOppPtTEnd->span()->debugID(), fOppPtTEnd->debugID()); |
| 1241 | fOppPtTEnd->dumpBase(); |
| 1242 | if (fOppPtTStart->segment()->operand()) { |
| 1243 | SkDebugf(" operand"); |
| 1244 | } |
| 1245 | if (fOppPtTStart->segment()->isXor()) { |
| 1246 | SkDebugf(" xor"); |
| 1247 | } |
| 1248 | SkDebugf("\n"); |
| 1249 | } |
| 1250 | |
| 1251 | void SkOpCoincidence::dump() const { |
| 1252 | SkCoincidentSpans* span = fHead; |
| 1253 | while (span) { |
| 1254 | span->dump(); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1255 | span = span->next(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1256 | } |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1257 | if (!fTop || fHead == fTop) { |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 1258 | return; |
| 1259 | } |
| 1260 | SkDebugf("top:\n"); |
| 1261 | span = fTop; |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1262 | int count = 0; |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 1263 | while (span) { |
| 1264 | span->dump(); |
caryclark | 55888e4 | 2016-07-18 10:01:36 -0700 | [diff] [blame] | 1265 | span = span->next(); |
| 1266 | SkCoincidentSpans* check = fTop; |
| 1267 | ++count; |
| 1268 | for (int index = 0; index < count; ++index) { |
| 1269 | if (span == check) { |
| 1270 | SkDebugf("(loops to #%d)\n", index); |
| 1271 | return; |
| 1272 | } |
| 1273 | check = check->next(); |
| 1274 | } |
caryclark | 27c8eb8 | 2015-07-06 11:38:33 -0700 | [diff] [blame] | 1275 | } |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1276 | } |
| 1277 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1278 | void SkOpContour::dump() const { |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 1279 | 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] | 1280 | if (!fCount) { |
| 1281 | return; |
| 1282 | } |
| 1283 | const SkOpSegment* segment = &fHead; |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1284 | SkDEBUGCODE(fDebugIndent = 0); |
| 1285 | this->indentDump(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1286 | do { |
| 1287 | segment->dump(); |
| 1288 | } while ((segment = segment->next())); |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1289 | this->outdentDump(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1290 | } |
| 1291 | |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1292 | void SkOpContour::dumpAll() const { |
caryclark | 1049f12 | 2015-04-20 08:31:59 -0700 | [diff] [blame] | 1293 | 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] | 1294 | if (!fCount) { |
| 1295 | return; |
| 1296 | } |
| 1297 | const SkOpSegment* segment = &fHead; |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1298 | SkDEBUGCODE(fDebugIndent = 0); |
| 1299 | this->indentDump(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1300 | do { |
| 1301 | segment->dumpAll(); |
| 1302 | } while ((segment = segment->next())); |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1303 | this->outdentDump(); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1304 | } |
| 1305 | |
| 1306 | |
| 1307 | void SkOpContour::dumpAngles() const { |
| 1308 | SkDebugf("contour=%d\n", this->debugID()); |
| 1309 | const SkOpSegment* segment = &fHead; |
| 1310 | do { |
| 1311 | SkDebugf(" seg=%d ", segment->debugID()); |
| 1312 | segment->dumpAngles(); |
| 1313 | } while ((segment = segment->next())); |
| 1314 | } |
| 1315 | |
| 1316 | void SkOpContour::dumpPt(int index) const { |
| 1317 | const SkOpSegment* segment = &fHead; |
| 1318 | do { |
| 1319 | if (segment->debugID() == index) { |
| 1320 | segment->dumpPts(); |
| 1321 | } |
| 1322 | } while ((segment = segment->next())); |
| 1323 | } |
| 1324 | |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1325 | void SkOpContour::dumpPts(const char* prefix) const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1326 | SkDebugf("contour=%d\n", this->debugID()); |
| 1327 | const SkOpSegment* segment = &fHead; |
| 1328 | do { |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1329 | SkDebugf(" %s=%d ", prefix, segment->debugID()); |
| 1330 | segment->dumpPts(prefix); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1331 | } while ((segment = segment->next())); |
| 1332 | } |
| 1333 | |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1334 | void SkOpContour::dumpPtsX(const char* prefix) const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1335 | if (!this->fCount) { |
| 1336 | SkDebugf("<empty>\n"); |
| 1337 | return; |
| 1338 | } |
| 1339 | const SkOpSegment* segment = &fHead; |
| 1340 | do { |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1341 | segment->dumpPts(prefix); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1342 | } while ((segment = segment->next())); |
| 1343 | } |
| 1344 | |
| 1345 | void SkOpContour::dumpSegment(int index) const { |
| 1346 | debugSegment(index)->dump(); |
| 1347 | } |
| 1348 | |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1349 | void SkOpContour::dumpSegments(const char* prefix, SkPathOp op) const { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1350 | bool firstOp = false; |
| 1351 | const SkOpContour* c = this; |
| 1352 | do { |
Ben Wagner | 3f98552 | 2017-10-09 10:47:47 -0400 | [diff] [blame] | 1353 | if (!firstOp && c->operand()) { |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1354 | #if DEBUG_ACTIVE_OP |
| 1355 | SkDebugf("op %s\n", SkPathOpsDebug::kPathOpStr[op]); |
| 1356 | #endif |
| 1357 | firstOp = true; |
| 1358 | } |
caryclark | 26ad22a | 2015-10-16 09:03:38 -0700 | [diff] [blame] | 1359 | c->dumpPtsX(prefix); |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1360 | } while ((c = c->next())); |
| 1361 | } |
| 1362 | |
| 1363 | void SkOpContour::dumpSpan(int index) const { |
| 1364 | debugSpan(index)->dump(); |
| 1365 | } |
| 1366 | |
| 1367 | void SkOpContour::dumpSpans() const { |
| 1368 | SkDebugf("contour=%d\n", this->debugID()); |
| 1369 | const SkOpSegment* segment = &fHead; |
| 1370 | do { |
| 1371 | SkDebugf(" seg=%d ", segment->debugID()); |
| 1372 | segment->dump(); |
| 1373 | } while ((segment = segment->next())); |
| 1374 | } |
| 1375 | |
caryclark | 03b03ca | 2015-04-23 09:13:37 -0700 | [diff] [blame] | 1376 | void SkOpCurve::dump() const { |
| 1377 | int count = SkPathOpsVerbToPoints(SkDEBUGRELEASE(fVerb, SkPath::kCubic_Verb)); |
| 1378 | SkDebugf("{{"); |
| 1379 | int index; |
| 1380 | for (index = 0; index <= count - 1; ++index) { |
| 1381 | SkDebugf("{%1.9gf,%1.9gf}, ", fPts[index].fX, fPts[index].fY); |
| 1382 | } |
| 1383 | SkDebugf("{%1.9gf,%1.9gf}}}\n", fPts[index].fX, fPts[index].fY); |
| 1384 | } |
| 1385 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1386 | #ifdef SK_DEBUG |
| 1387 | const SkOpAngle* SkOpGlobalState::debugAngle(int id) const { |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1388 | const SkOpContour* contour = fContourHead; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1389 | do { |
| 1390 | const SkOpSegment* segment = contour->first(); |
| 1391 | while (segment) { |
| 1392 | const SkOpSpan* span = segment->head(); |
| 1393 | do { |
| 1394 | SkOpAngle* angle = span->fromAngle(); |
| 1395 | if (angle && angle->debugID() == id) { |
| 1396 | return angle; |
| 1397 | } |
| 1398 | angle = span->toAngle(); |
| 1399 | if (angle && angle->debugID() == id) { |
| 1400 | return angle; |
| 1401 | } |
| 1402 | } while ((span = span->next()->upCastable())); |
| 1403 | const SkOpSpanBase* tail = segment->tail(); |
| 1404 | SkOpAngle* angle = tail->fromAngle(); |
| 1405 | if (angle && angle->debugID() == id) { |
| 1406 | return angle; |
| 1407 | } |
| 1408 | segment = segment->next(); |
| 1409 | } |
| 1410 | } while ((contour = contour->next())); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 1411 | return nullptr; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1412 | } |
| 1413 | |
caryclark | 30b9fdd | 2016-08-31 14:36:29 -0700 | [diff] [blame] | 1414 | SkOpContour* SkOpGlobalState::debugContour(int id) const { |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1415 | SkOpContour* contour = fContourHead; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1416 | do { |
| 1417 | if (contour->debugID() == id) { |
| 1418 | return contour; |
| 1419 | } |
| 1420 | } while ((contour = contour->next())); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 1421 | return nullptr; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1422 | } |
| 1423 | |
| 1424 | const SkOpPtT* SkOpGlobalState::debugPtT(int id) const { |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1425 | const SkOpContour* contour = fContourHead; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1426 | do { |
| 1427 | const SkOpSegment* segment = contour->first(); |
| 1428 | while (segment) { |
| 1429 | const SkOpSpan* span = segment->head(); |
| 1430 | do { |
| 1431 | const SkOpPtT* ptT = span->ptT(); |
| 1432 | if (ptT->debugMatchID(id)) { |
| 1433 | return ptT; |
| 1434 | } |
| 1435 | } while ((span = span->next()->upCastable())); |
| 1436 | const SkOpSpanBase* tail = segment->tail(); |
| 1437 | const SkOpPtT* ptT = tail->ptT(); |
| 1438 | if (ptT->debugMatchID(id)) { |
| 1439 | return ptT; |
| 1440 | } |
| 1441 | segment = segment->next(); |
| 1442 | } |
| 1443 | } while ((contour = contour->next())); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 1444 | return nullptr; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1445 | } |
| 1446 | |
| 1447 | const SkOpSegment* SkOpGlobalState::debugSegment(int id) const { |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1448 | const SkOpContour* contour = fContourHead; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1449 | do { |
| 1450 | const SkOpSegment* segment = contour->first(); |
| 1451 | while (segment) { |
| 1452 | if (segment->debugID() == id) { |
| 1453 | return segment; |
| 1454 | } |
| 1455 | segment = segment->next(); |
| 1456 | } |
| 1457 | } while ((contour = contour->next())); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 1458 | return nullptr; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1459 | } |
| 1460 | |
| 1461 | const SkOpSpanBase* SkOpGlobalState::debugSpan(int id) const { |
caryclark | 624637c | 2015-05-11 07:21:27 -0700 | [diff] [blame] | 1462 | const SkOpContour* contour = fContourHead; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1463 | do { |
| 1464 | const SkOpSegment* segment = contour->first(); |
| 1465 | while (segment) { |
| 1466 | const SkOpSpan* span = segment->head(); |
| 1467 | do { |
| 1468 | if (span->debugID() == id) { |
| 1469 | return span; |
| 1470 | } |
| 1471 | } while ((span = span->next()->upCastable())); |
| 1472 | const SkOpSpanBase* tail = segment->tail(); |
| 1473 | if (tail->debugID() == id) { |
| 1474 | return tail; |
| 1475 | } |
| 1476 | segment = segment->next(); |
| 1477 | } |
| 1478 | } while ((contour = contour->next())); |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 1479 | return nullptr; |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1480 | } |
| 1481 | #endif |
| 1482 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 1483 | #if DEBUG_T_SECT_DUMP > 1 |
| 1484 | int gDumpTSectNum; |
| 1485 | #endif |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 1486 | |
| 1487 | // global path dumps for msvs Visual Studio 17 to use from Immediate Window |
| 1488 | namespace SkOpDebug { |
| 1489 | |
| 1490 | void Dump(const SkOpContour& contour) { |
| 1491 | contour.dump(); |
| 1492 | } |
| 1493 | |
| 1494 | void DumpAll(const SkOpContour& contour) { |
| 1495 | contour.dumpAll(); |
| 1496 | } |
| 1497 | |
| 1498 | void DumpAngles(const SkOpContour& contour) { |
| 1499 | contour.dumpAngles(); |
| 1500 | } |
| 1501 | |
| 1502 | void DumpContours(const SkOpContour& contour) { |
| 1503 | contour.dumpContours(); |
| 1504 | } |
| 1505 | |
| 1506 | void DumpContoursAll(const SkOpContour& contour) { |
| 1507 | contour.dumpContoursAll(); |
| 1508 | } |
| 1509 | |
| 1510 | void DumpContoursAngles(const SkOpContour& contour) { |
| 1511 | contour.dumpContoursAngles(); |
| 1512 | } |
| 1513 | |
| 1514 | void DumpContoursPts(const SkOpContour& contour) { |
| 1515 | contour.dumpContoursPts(); |
| 1516 | } |
| 1517 | |
| 1518 | void DumpContoursPt(const SkOpContour& contour, int segmentID) { |
| 1519 | contour.dumpContoursPt(segmentID); |
| 1520 | } |
| 1521 | |
| 1522 | void DumpContoursSegment(const SkOpContour& contour, int segmentID) { |
| 1523 | contour.dumpContoursSegment(segmentID); |
| 1524 | } |
| 1525 | |
| 1526 | void DumpContoursSpan(const SkOpContour& contour, int segmentID) { |
| 1527 | contour.dumpContoursSpan(segmentID); |
| 1528 | } |
| 1529 | |
| 1530 | void DumpContoursSpans(const SkOpContour& contour) { |
| 1531 | contour.dumpContoursSpans(); |
| 1532 | } |
| 1533 | |
| 1534 | void DumpPt(const SkOpContour& contour, int pt) { |
| 1535 | contour.dumpPt(pt); |
| 1536 | } |
| 1537 | |
| 1538 | void DumpPts(const SkOpContour& contour, const char* prefix) { |
| 1539 | contour.dumpPts(prefix); |
| 1540 | } |
| 1541 | |
| 1542 | void DumpSegment(const SkOpContour& contour, int seg) { |
| 1543 | contour.dumpSegment(seg); |
| 1544 | } |
| 1545 | |
| 1546 | void DumpSegments(const SkOpContour& contour, const char* prefix, SkPathOp op) { |
| 1547 | contour.dumpSegments(prefix, op); |
| 1548 | } |
| 1549 | |
| 1550 | void DumpSpan(const SkOpContour& contour, int span) { |
| 1551 | contour.dumpSpan(span); |
| 1552 | } |
| 1553 | |
| 1554 | void DumpSpans(const SkOpContour& contour ) { |
| 1555 | contour.dumpSpans(); |
| 1556 | } |
| 1557 | |
| 1558 | void Dump(const SkOpSegment& segment) { |
| 1559 | segment.dump(); |
| 1560 | } |
| 1561 | |
| 1562 | void DumpAll(const SkOpSegment& segment) { |
| 1563 | segment.dumpAll(); |
| 1564 | } |
| 1565 | |
| 1566 | void DumpAngles(const SkOpSegment& segment) { |
| 1567 | segment.dumpAngles(); |
| 1568 | } |
| 1569 | |
| 1570 | void DumpCoin(const SkOpSegment& segment) { |
| 1571 | segment.dumpCoin(); |
| 1572 | } |
| 1573 | |
| 1574 | void DumpPts(const SkOpSegment& segment, const char* prefix) { |
| 1575 | segment.dumpPts(prefix); |
| 1576 | } |
| 1577 | |
| 1578 | void Dump(const SkOpPtT& ptT) { |
| 1579 | ptT.dump(); |
| 1580 | } |
| 1581 | |
| 1582 | void DumpAll(const SkOpPtT& ptT) { |
| 1583 | ptT.dumpAll(); |
| 1584 | } |
| 1585 | |
| 1586 | void Dump(const SkOpSpanBase& spanBase) { |
| 1587 | spanBase.dump(); |
| 1588 | } |
| 1589 | |
| 1590 | void DumpCoin(const SkOpSpanBase& spanBase) { |
| 1591 | spanBase.dumpCoin(); |
| 1592 | } |
| 1593 | |
| 1594 | void DumpAll(const SkOpSpanBase& spanBase) { |
| 1595 | spanBase.dumpAll(); |
| 1596 | } |
| 1597 | |
| 1598 | void DumpCoin(const SkOpSpan& span) { |
| 1599 | span.dumpCoin(); |
| 1600 | } |
| 1601 | |
| 1602 | bool DumpSpan(const SkOpSpan& span) { |
| 1603 | return span.dumpSpan(); |
| 1604 | } |
| 1605 | |
| 1606 | void Dump(const SkDConic& conic) { |
| 1607 | conic.dump(); |
| 1608 | } |
| 1609 | |
| 1610 | void DumpID(const SkDConic& conic, int id) { |
| 1611 | conic.dumpID(id); |
| 1612 | } |
| 1613 | |
| 1614 | void Dump(const SkDCubic& cubic) { |
| 1615 | cubic.dump(); |
| 1616 | } |
| 1617 | |
| 1618 | void DumpID(const SkDCubic& cubic, int id) { |
| 1619 | cubic.dumpID(id); |
| 1620 | } |
| 1621 | |
| 1622 | void Dump(const SkDLine& line) { |
| 1623 | line.dump(); |
| 1624 | } |
| 1625 | |
| 1626 | void DumpID(const SkDLine& line, int id) { |
| 1627 | line.dumpID(id); |
| 1628 | } |
| 1629 | |
| 1630 | void Dump(const SkDQuad& quad) { |
| 1631 | quad.dump(); |
| 1632 | } |
| 1633 | |
| 1634 | void DumpID(const SkDQuad& quad, int id) { |
| 1635 | quad.dumpID(id); |
| 1636 | } |
| 1637 | |
| 1638 | void Dump(const SkDPoint& point) { |
| 1639 | point.dump(); |
| 1640 | } |
| 1641 | |
Cary Clark | 1857ddb | 2018-07-11 11:01:43 -0400 | [diff] [blame] | 1642 | void Dump(const SkOpAngle& angle) { |
| 1643 | angle.dump(); |
| 1644 | } |
| 1645 | |
Cary Clark | b8421ed | 2018-03-14 15:55:02 -0400 | [diff] [blame] | 1646 | // dummy definitions to fool msvs Visual Studio 2018 Immediate Window |
| 1647 | #define DummyDefinitions(a, b) \ |
| 1648 | \ |
| 1649 | void Dump(const SkDebugTCoincident##a##b& curve) { \ |
| 1650 | ((const SkTCoincident<SkD##a, SkD##b>& ) curve).dump(); \ |
| 1651 | } \ |
| 1652 | \ |
| 1653 | void Dump(const SkDebugTSect##a##b& curve) { \ |
| 1654 | ((const SkTSect<SkD##a, SkD##b>& ) curve).dump(); \ |
| 1655 | } \ |
| 1656 | \ |
| 1657 | void DumpBoth(const SkDebugTSect##a##b& curve, SkDebugTSect##a##b* opp) { \ |
| 1658 | ((const SkTSect<SkD##a, SkD##b>& ) curve).dumpBoth((SkTSect<SkD##b, SkD##a>* ) opp); \ |
| 1659 | } \ |
| 1660 | \ |
| 1661 | void DumpBounded(const SkDebugTSect##a##b& curve, int id) { \ |
| 1662 | ((const SkTSect<SkD##a, SkD##b>& ) curve).dumpBounded(id); \ |
| 1663 | } \ |
| 1664 | \ |
| 1665 | void DumpBounds(const SkDebugTSect##a##b& curve) { \ |
| 1666 | ((const SkTSect<SkD##a, SkD##b>& ) curve).dumpBounds(); \ |
| 1667 | } \ |
| 1668 | \ |
| 1669 | void DumpCoin(const SkDebugTSect##a##b& curve) { \ |
| 1670 | ((const SkTSect<SkD##a, SkD##b>& ) curve).dumpCoin(); \ |
| 1671 | } \ |
| 1672 | \ |
| 1673 | void DumpCoinCurves(const SkDebugTSect##a##b& curve) { \ |
| 1674 | ((const SkTSect<SkD##a, SkD##b>& ) curve).dumpCoinCurves(); \ |
| 1675 | } \ |
| 1676 | \ |
| 1677 | void DumpCurves(const SkDebugTSect##a##b& curve) { \ |
| 1678 | ((const SkTSect<SkD##a, SkD##b>& ) curve).dumpCurves(); \ |
| 1679 | } \ |
| 1680 | \ |
| 1681 | void Dump(const SkDebugTSpan##a##b& curve) { \ |
| 1682 | ((const SkTSpan<SkD##a, SkD##b>& ) curve).dump(); \ |
| 1683 | } \ |
| 1684 | \ |
| 1685 | void DumpAll(const SkDebugTSpan##a##b& curve) { \ |
| 1686 | ((const SkTSpan<SkD##a, SkD##b>& ) curve).dumpAll(); \ |
| 1687 | } \ |
| 1688 | \ |
| 1689 | void DumpBounded(const SkDebugTSpan##a##b& curve, int id) { \ |
| 1690 | ((const SkTSpan<SkD##a, SkD##b>& ) curve).dumpBounded(id); \ |
| 1691 | } \ |
| 1692 | \ |
| 1693 | void DumpBounds(const SkDebugTSpan##a##b& curve) { \ |
| 1694 | ((const SkTSpan<SkD##a, SkD##b>& ) curve).dumpBounds(); \ |
| 1695 | } \ |
| 1696 | \ |
| 1697 | void DumpCoin(const SkDebugTSpan##a##b& curve) { \ |
| 1698 | ((const SkTSpan<SkD##a, SkD##b>& ) curve).dumpCoin(); \ |
| 1699 | } |
| 1700 | |
| 1701 | DummyDefinitions(Quad, Quad); |
| 1702 | DummyDefinitions(Conic, Quad); |
| 1703 | DummyDefinitions(Conic, Conic); |
| 1704 | DummyDefinitions(Cubic, Quad); |
| 1705 | DummyDefinitions(Cubic, Conic); |
| 1706 | DummyDefinitions(Cubic, Cubic); |
| 1707 | |
| 1708 | #undef DummyDefinitions |
| 1709 | } |