OLD | NEW |
| 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" |
1 #include "SkOpContour.h" | 10 #include "SkOpContour.h" |
2 #include "SkIntersectionHelper.h" | 11 #include "SkIntersectionHelper.h" |
3 #include "SkOpSegment.h" | 12 #include "SkOpSegment.h" |
4 #include "SkString.h" | 13 #include "SkString.h" |
5 | 14 |
6 inline void DebugDumpDouble(double x) { | 15 inline void DebugDumpDouble(double x) { |
7 if (x == floor(x)) { | 16 if (x == floor(x)) { |
8 SkDebugf("%.0f", x); | 17 SkDebugf("%.0f", x); |
9 } else { | 18 } else { |
10 SkDebugf("%1.19g", x); | 19 SkDebugf("%1.19g", x); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 52 |
44 static void output_points(const SkPoint* pts, int count) { | 53 static void output_points(const SkPoint* pts, int count) { |
45 for (int index = 0; index < count; ++index) { | 54 for (int index = 0; index < count; ++index) { |
46 output_scalar(pts[index].fX); | 55 output_scalar(pts[index].fX); |
47 SkDebugf(", "); | 56 SkDebugf(", "); |
48 output_scalar(pts[index].fY); | 57 output_scalar(pts[index].fY); |
49 if (index + 1 < count) { | 58 if (index + 1 < count) { |
50 SkDebugf(", "); | 59 SkDebugf(", "); |
51 } | 60 } |
52 } | 61 } |
53 SkDebugf(");\n"); | |
54 } | 62 } |
55 | 63 |
56 static void showPathContours(SkPath::RawIter& iter, const char* pathName) { | 64 static void showPathContours(SkPath::RawIter& iter, const char* pathName) { |
57 uint8_t verb; | 65 uint8_t verb; |
58 SkPoint pts[4]; | 66 SkPoint pts[4]; |
59 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { | 67 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { |
60 switch (verb) { | 68 switch (verb) { |
61 case SkPath::kMove_Verb: | 69 case SkPath::kMove_Verb: |
62 SkDebugf(" %s.moveTo(", pathName); | 70 SkDebugf(" %s.moveTo(", pathName); |
63 output_points(&pts[0], 1); | 71 output_points(&pts[0], 1); |
| 72 SkDebugf(");\n"); |
64 continue; | 73 continue; |
65 case SkPath::kLine_Verb: | 74 case SkPath::kLine_Verb: |
66 SkDebugf(" %s.lineTo(", pathName); | 75 SkDebugf(" %s.lineTo(", pathName); |
67 output_points(&pts[1], 1); | 76 output_points(&pts[1], 1); |
| 77 SkDebugf(");\n"); |
68 break; | 78 break; |
69 case SkPath::kQuad_Verb: | 79 case SkPath::kQuad_Verb: |
70 SkDebugf(" %s.quadTo(", pathName); | 80 SkDebugf(" %s.quadTo(", pathName); |
71 output_points(&pts[1], 2); | 81 output_points(&pts[1], 2); |
| 82 SkDebugf(");\n"); |
| 83 break; |
| 84 case SkPath::kConic_Verb: |
| 85 SkDebugf(" %s.conicTo(", pathName); |
| 86 output_points(&pts[1], 2); |
| 87 SkDebugf(", %1.9gf);\n", iter.conicWeight()); |
72 break; | 88 break; |
73 case SkPath::kCubic_Verb: | 89 case SkPath::kCubic_Verb: |
74 SkDebugf(" %s.cubicTo(", pathName); | 90 SkDebugf(" %s.cubicTo(", pathName); |
75 output_points(&pts[1], 3); | 91 output_points(&pts[1], 3); |
| 92 SkDebugf(");\n"); |
76 break; | 93 break; |
77 case SkPath::kClose_Verb: | 94 case SkPath::kClose_Verb: |
78 SkDebugf(" %s.close();\n", pathName); | 95 SkDebugf(" %s.close();\n", pathName); |
79 break; | 96 break; |
80 default: | 97 default: |
81 SkDEBUGFAIL("bad verb"); | 98 SkDEBUGFAIL("bad verb"); |
82 return; | 99 return; |
83 } | 100 } |
84 } | 101 } |
85 } | 102 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 } | 139 } |
123 | 140 |
124 static void show_function_header(const char* functionName) { | 141 static void show_function_header(const char* functionName) { |
125 SkDebugf("\nstatic void %s(skiatest::Reporter* reporter, const char* filenam
e) {\n", functionName); | 142 SkDebugf("\nstatic void %s(skiatest::Reporter* reporter, const char* filenam
e) {\n", functionName); |
126 if (strcmp("skphealth_com76", functionName) == 0) { | 143 if (strcmp("skphealth_com76", functionName) == 0) { |
127 SkDebugf("found it\n"); | 144 SkDebugf("found it\n"); |
128 } | 145 } |
129 } | 146 } |
130 | 147 |
131 static const char* gOpStrs[] = { | 148 static const char* gOpStrs[] = { |
132 "kDifference_PathOp", | 149 "kDifference_SkPathOp", |
133 "kIntersect_PathOp", | 150 "kIntersect_SkPathOp", |
134 "kUnion_PathOp", | 151 "kUnion_SkPathOp", |
135 "kXor_PathOp", | 152 "kXor_PathOp", |
136 "kReverseDifference_PathOp", | 153 "kReverseDifference_SkPathOp", |
137 }; | 154 }; |
138 | 155 |
139 static void show_op(SkPathOp op, const char* pathOne, const char* pathTwo) { | 156 static void show_op(SkPathOp op, const char* pathOne, const char* pathTwo) { |
140 SkDebugf(" testPathOp(reporter, %s, %s, %s, filename);\n", pathOne, pathT
wo, gOpStrs[op]); | 157 SkDebugf(" testPathOp(reporter, %s, %s, %s, filename);\n", pathOne, pathT
wo, gOpStrs[op]); |
141 SkDebugf("}\n"); | 158 SkDebugf("}\n"); |
142 } | 159 } |
143 | 160 |
144 SK_DECLARE_STATIC_MUTEX(gTestMutex); | 161 SK_DECLARE_STATIC_MUTEX(gTestMutex); |
145 | 162 |
146 void SkPathOpsDebug::ShowPath(const SkPath& a, const SkPath& b, SkPathOp shapeOp
, | 163 void SkPathOpsDebug::ShowPath(const SkPath& a, const SkPath& b, SkPathOp shapeOp
, |
(...skipping 14 matching lines...) Expand all Loading... |
161 | 178 |
162 void SkPathOpsDebug::WindingPrintf(int wind) { | 179 void SkPathOpsDebug::WindingPrintf(int wind) { |
163 if (wind == SK_MinS32) { | 180 if (wind == SK_MinS32) { |
164 SkDebugf("?"); | 181 SkDebugf("?"); |
165 } else { | 182 } else { |
166 SkDebugf("%d", wind); | 183 SkDebugf("%d", wind); |
167 } | 184 } |
168 } | 185 } |
169 #endif | 186 #endif |
170 | 187 |
171 void SkOpAngle::dump() const { | 188 void SkDCubic::dump() const { |
172 dumpOne(true); | 189 dumpInner(); |
173 SkDebugf("\n"); | 190 SkDebugf("}},\n"); |
174 } | 191 } |
175 | 192 |
176 void SkOpAngle::dumpOne(bool functionHeader) const { | 193 void SkDCubic::dumpID(int id) const { |
177 // fSegment->debugValidate(); | 194 dumpInner(); |
178 const SkOpSpan& mSpan = fSegment->span(SkMin32(fStart, fEnd)); | 195 SkDebugf("}} id=%d\n", id); |
179 if (functionHeader) { | |
180 SkDebugf("%s ", __FUNCTION__); | |
181 } | |
182 SkDebugf("[%d", fSegment->debugID()); | |
183 SkDebugf("/%d", debugID()); | |
184 SkDebugf("] next="); | |
185 if (fNext) { | |
186 SkDebugf("%d", fNext->fSegment->debugID()); | |
187 SkDebugf("/%d", fNext->debugID()); | |
188 } else { | |
189 SkDebugf("?"); | |
190 } | |
191 SkDebugf(" sect=%d/%d ", fSectorStart, fSectorEnd); | |
192 SkDebugf(" s=%1.9g [%d] e=%1.9g [%d]", fSegment->span(fStart).fT, fStart, | |
193 fSegment->span(fEnd).fT, fEnd); | |
194 SkDebugf(" sgn=%d windVal=%d", sign(), mSpan.fWindValue); | |
195 | |
196 SkDebugf(" windSum="); | |
197 SkPathOpsDebug::WindingPrintf(mSpan.fWindSum); | |
198 if (mSpan.fOppValue != 0 || mSpan.fOppSum != SK_MinS32) { | |
199 SkDebugf(" oppVal=%d", mSpan.fOppValue); | |
200 SkDebugf(" oppSum="); | |
201 SkPathOpsDebug::WindingPrintf(mSpan.fOppSum); | |
202 } | |
203 if (mSpan.fDone) { | |
204 SkDebugf(" done"); | |
205 } | |
206 if (unorderable()) { | |
207 SkDebugf(" unorderable"); | |
208 } | |
209 if (small()) { | |
210 SkDebugf(" small"); | |
211 } | |
212 if (mSpan.fTiny) { | |
213 SkDebugf(" tiny"); | |
214 } | |
215 if (fSegment->operand()) { | |
216 SkDebugf(" operand"); | |
217 } | |
218 if (fStop) { | |
219 SkDebugf(" stop"); | |
220 } | |
221 } | 196 } |
222 | 197 |
223 void SkOpAngle::dumpTo(const SkOpSegment* segment, const SkOpAngle* to) const { | 198 static inline bool double_is_NaN(double x) { return x != x; } |
224 const SkOpAngle* first = this; | |
225 const SkOpAngle* next = this; | |
226 const char* indent = ""; | |
227 do { | |
228 SkDebugf("%s", indent); | |
229 next->dumpOne(false); | |
230 if (segment == next->fSegment) { | |
231 if (this == fNext) { | |
232 SkDebugf(" << from"); | |
233 } | |
234 if (to == fNext) { | |
235 SkDebugf(" << to"); | |
236 } | |
237 } | |
238 SkDebugf("\n"); | |
239 indent = " "; | |
240 next = next->fNext; | |
241 } while (next && next != first); | |
242 } | |
243 | 199 |
244 void SkOpAngle::dumpLoop() const { | 200 void SkDCubic::dumpInner() const { |
245 const SkOpAngle* first = this; | |
246 const SkOpAngle* next = this; | |
247 do { | |
248 next->dumpOne(false); | |
249 SkDebugf("\n"); | |
250 next = next->fNext; | |
251 } while (next && next != first); | |
252 } | |
253 | |
254 void SkOpAngle::dumpPartials() const { | |
255 const SkOpAngle* first = this; | |
256 const SkOpAngle* next = this; | |
257 do { | |
258 next->fCurvePart.dumpNumber(); | |
259 next = next->fNext; | |
260 } while (next && next != first); | |
261 } | |
262 | |
263 void SkOpAngleSet::dump() const { | |
264 // FIXME: unimplemented | |
265 /* This requires access to the internal SkChunkAlloc data | |
266 Defer implementing this until it is needed for debugging | |
267 */ | |
268 SkASSERT(0); | |
269 } | |
270 | |
271 void SkOpContour::dump() const { | |
272 int segmentCount = fSegments.count(); | |
273 SkDebugf("((SkOpContour*) 0x%p) [%d]\n", this, debugID()); | |
274 for (int test = 0; test < segmentCount; ++test) { | |
275 SkDebugf(" [%d] ((SkOpSegment*) 0x%p) [%d]\n", test, &fSegments[test], | |
276 fSegments[test].debugID()); | |
277 } | |
278 } | |
279 | |
280 void SkOpContour::dumpAngles() const { | |
281 int segmentCount = fSegments.count(); | |
282 SkDebugf("((SkOpContour*) 0x%p) [%d]\n", this, debugID()); | |
283 for (int test = 0; test < segmentCount; ++test) { | |
284 SkDebugf(" [%d] ", test); | |
285 fSegments[test].dumpAngles(); | |
286 } | |
287 } | |
288 | |
289 void SkOpContour::dumpCoincidence(const SkCoincidence& coin) const { | |
290 int thisIndex = coin.fSegments[0]; | |
291 const SkOpSegment& s1 = fSegments[thisIndex]; | |
292 int otherIndex = coin.fSegments[1]; | |
293 const SkOpSegment& s2 = coin.fOther->fSegments[otherIndex]; | |
294 SkDebugf("((SkOpSegment*) 0x%p) [%d] ((SkOpSegment*) 0x%p) [%d]\n", &s1, s1
.debugID(), | |
295 &s2, s2.debugID()); | |
296 for (int index = 0; index < 2; ++index) { | |
297 SkDebugf(" {%1.9gf, %1.9gf}", coin.fPts[0][index].fX, coin.fPts[0][in
dex].fY); | |
298 if (coin.fNearly[index]) { | |
299 SkDebugf(" {%1.9gf, %1.9gf}", coin.fPts[1][index].fX, coin.fPts[1
][index].fY); | |
300 } | |
301 SkDebugf(" seg1t=%1.9g seg2t=%1.9g\n", coin.fTs[0][index], coin.fTs[1][
index]); | |
302 } | |
303 } | |
304 | |
305 void SkOpContour::dumpCoincidences() const { | |
306 int count = fCoincidences.count(); | |
307 if (count > 0) { | |
308 SkDebugf("fCoincidences count=%d\n", count); | |
309 for (int test = 0; test < count; ++test) { | |
310 dumpCoincidence(fCoincidences[test]); | |
311 } | |
312 } | |
313 count = fPartialCoincidences.count(); | |
314 if (count == 0) { | |
315 return; | |
316 } | |
317 SkDebugf("fPartialCoincidences count=%d\n", count); | |
318 for (int test = 0; test < count; ++test) { | |
319 dumpCoincidence(fPartialCoincidences[test]); | |
320 } | |
321 } | |
322 | |
323 void SkOpContour::dumpPt(int index) const { | |
324 int segmentCount = fSegments.count(); | |
325 for (int test = 0; test < segmentCount; ++test) { | |
326 const SkOpSegment& segment = fSegments[test]; | |
327 if (segment.debugID() == index) { | |
328 fSegments[test].dumpPts(); | |
329 } | |
330 } | |
331 } | |
332 | |
333 void SkOpContour::dumpPts() const { | |
334 int segmentCount = fSegments.count(); | |
335 SkDebugf("((SkOpContour*) 0x%p) [%d]\n", this, debugID()); | |
336 for (int test = 0; test < segmentCount; ++test) { | |
337 SkDebugf(" [%d] ", test); | |
338 fSegments[test].dumpPts(); | |
339 } | |
340 } | |
341 | |
342 void SkOpContour::dumpSpan(int index) const { | |
343 int segmentCount = fSegments.count(); | |
344 for (int test = 0; test < segmentCount; ++test) { | |
345 const SkOpSegment& segment = fSegments[test]; | |
346 if (segment.debugID() == index) { | |
347 fSegments[test].dumpSpans(); | |
348 } | |
349 } | |
350 } | |
351 | |
352 void SkOpContour::dumpSpans() const { | |
353 int segmentCount = fSegments.count(); | |
354 SkDebugf("((SkOpContour*) 0x%p) [%d]\n", this, debugID()); | |
355 for (int test = 0; test < segmentCount; ++test) { | |
356 SkDebugf(" [%d] ", test); | |
357 fSegments[test].dumpSpans(); | |
358 } | |
359 } | |
360 | |
361 void SkDCubic::dump() const { | |
362 SkDebugf("{{"); | 201 SkDebugf("{{"); |
363 int index = 0; | 202 int index = 0; |
364 do { | 203 do { |
365 fPts[index].dump(); | 204 if (index != 0) { |
366 SkDebugf(", "); | 205 if (double_is_NaN(fPts[index].fX) && double_is_NaN(fPts[index].fY))
{ |
367 } while (++index < 3); | 206 return; |
368 fPts[index].dump(); | 207 } |
369 SkDebugf("}}\n"); | |
370 } | |
371 | |
372 void SkDCubic::dumpNumber() const { | |
373 SkDebugf("{{"); | |
374 int index = 0; | |
375 bool dumpedOne = false; | |
376 do { | |
377 if (!(fPts[index].fX == fPts[index].fX && fPts[index].fY == fPts[index].
fY)) { | |
378 continue; | |
379 } | |
380 if (dumpedOne) { | |
381 SkDebugf(", "); | 208 SkDebugf(", "); |
382 } | 209 } |
383 fPts[index].dump(); | 210 fPts[index].dump(); |
384 dumpedOne = true; | |
385 } while (++index < 3); | 211 } while (++index < 3); |
386 if (fPts[index].fX == fPts[index].fX && fPts[index].fY == fPts[index].fY) { | 212 if (double_is_NaN(fPts[index].fX) && double_is_NaN(fPts[index].fY)) { |
387 if (dumpedOne) { | 213 return; |
388 SkDebugf(", "); | |
389 } | |
390 fPts[index].dump(); | |
391 } | 214 } |
392 SkDebugf("}}\n"); | 215 SkDebugf(", "); |
| 216 fPts[index].dump(); |
393 } | 217 } |
394 | 218 |
395 void SkDLine::dump() const { | 219 void SkDLine::dump() const { |
396 SkDebugf("{{"); | 220 SkDebugf("{{"); |
397 fPts[0].dump(); | 221 fPts[0].dump(); |
398 SkDebugf(", "); | 222 SkDebugf(", "); |
399 fPts[1].dump(); | 223 fPts[1].dump(); |
400 SkDebugf("}}\n"); | 224 SkDebugf("}},\n"); |
401 } | 225 } |
402 | 226 |
403 void SkDPoint::dump() const { | 227 void SkDPoint::dump() const { |
404 SkDebugf("{"); | 228 SkDebugf("{"); |
405 DebugDumpDouble(fX); | 229 DebugDumpDouble(fX); |
406 SkDebugf(", "); | 230 SkDebugf(", "); |
407 DebugDumpDouble(fY); | 231 DebugDumpDouble(fY); |
408 SkDebugf("}"); | 232 SkDebugf("}"); |
409 } | 233 } |
410 | 234 |
411 void SkDPoint::Dump(const SkPoint& pt) { | 235 void SkDPoint::Dump(const SkPoint& pt) { |
412 SkDebugf("{"); | 236 SkDebugf("{"); |
413 DebugDumpFloat(pt.fX); | 237 DebugDumpFloat(pt.fX); |
414 SkDebugf(", "); | 238 SkDebugf(", "); |
415 DebugDumpFloat(pt.fY); | 239 DebugDumpFloat(pt.fY); |
416 SkDebugf("}"); | 240 SkDebugf("}"); |
417 } | 241 } |
418 | 242 |
419 void SkDPoint::DumpHex(const SkPoint& pt) { | 243 void SkDPoint::DumpHex(const SkPoint& pt) { |
420 SkDebugf("{"); | 244 SkDebugf("{"); |
421 DebugDumpHexFloat(pt.fX); | 245 DebugDumpHexFloat(pt.fX); |
422 SkDebugf(", "); | 246 SkDebugf(", "); |
423 DebugDumpHexFloat(pt.fY); | 247 DebugDumpHexFloat(pt.fY); |
424 SkDebugf("}"); | 248 SkDebugf("}"); |
425 } | 249 } |
426 | 250 |
427 void SkDQuad::dump() const { | 251 void SkDQuad::dump() const { |
428 dumpComma(""); | 252 dumpInner(); |
| 253 SkDebugf("}},\n"); |
429 } | 254 } |
430 | 255 |
431 void SkDQuad::dumpComma(const char* comma) const { | 256 void SkDQuad::dumpID(int id) const { |
| 257 dumpInner(); |
| 258 SkDebugf("}} id=%d\n", id); |
| 259 } |
| 260 |
| 261 void SkDQuad::dumpInner() const { |
432 SkDebugf("{{"); | 262 SkDebugf("{{"); |
433 int index = 0; | 263 int index = 0; |
434 do { | 264 do { |
435 fPts[index].dump(); | 265 fPts[index].dump(); |
436 SkDebugf(", "); | 266 SkDebugf(", "); |
437 } while (++index < 2); | 267 } while (++index < 2); |
438 fPts[index].dump(); | 268 fPts[index].dump(); |
439 SkDebugf("}}%s\n", comma ? comma : ""); | 269 } |
440 } | 270 |
441 | 271 void SkIntersections::dump() const { |
442 void SkIntersectionHelper::dump() const { | 272 SkDebugf("used=%d of %d", fUsed, fMax); |
443 SkDPoint::Dump(pts()[0]); | 273 for (int index = 0; index < fUsed; ++index) { |
444 SkDPoint::Dump(pts()[1]); | 274 SkDebugf(" t=(%s%1.9g,%s%1.9g) pt=(%1.9g,%1.9g)", |
445 if (verb() >= SkPath::kQuad_Verb) { | 275 fIsCoincident[0] & (1 << index) ? "*" : "", fT[0][index], |
446 SkDPoint::Dump(pts()[2]); | 276 fIsCoincident[1] & (1 << index) ? "*" : "", fT[1][index], |
447 } | 277 fPt[index].fX, fPt[index].fY); |
448 if (verb() >= SkPath::kCubic_Verb) { | 278 if (index < 2 && fNearlySame[index]) { |
449 SkDPoint::Dump(pts()[3]); | 279 SkDebugf(" pt2=(%1.9g,%1.9g)",fPt2[index].fX, fPt2[index].fY); |
450 } | |
451 } | |
452 | |
453 const SkTDArray<SkOpSpan>& SkOpSegment::debugSpans() const { | |
454 return fTs; | |
455 } | |
456 | |
457 void SkOpSegment::dumpAngles() const { | |
458 SkDebugf("((SkOpSegment*) 0x%p) [%d]\n", this, debugID()); | |
459 const SkOpAngle* fromAngle = NULL; | |
460 const SkOpAngle* toAngle = NULL; | |
461 for (int index = 0; index < count(); ++index) { | |
462 const SkOpAngle* fAngle = fTs[index].fFromAngle; | |
463 const SkOpAngle* tAngle = fTs[index].fToAngle; | |
464 if (fromAngle == fAngle && toAngle == tAngle) { | |
465 continue; | |
466 } | 280 } |
467 if (fAngle) { | |
468 SkDebugf(" [%d] from=%d ", index, fAngle->debugID()); | |
469 fAngle->dumpTo(this, tAngle); | |
470 } | |
471 if (tAngle) { | |
472 SkDebugf(" [%d] to=%d ", index, tAngle->debugID()); | |
473 tAngle->dumpTo(this, fAngle); | |
474 } | |
475 fromAngle = fAngle; | |
476 toAngle = tAngle; | |
477 } | |
478 } | |
479 | |
480 void SkOpSegment::dumpContour(int firstID, int lastID) const { | |
481 if (debugID() < 0) { | |
482 return; | |
483 } | |
484 const SkOpSegment* test = this - (debugID() - 1); | |
485 test += (firstID - 1); | |
486 const SkOpSegment* last = test + (lastID - firstID); | |
487 while (test <= last) { | |
488 test->dumpSpans(); | |
489 ++test; | |
490 } | |
491 } | |
492 | |
493 void SkOpSegment::dumpPts() const { | |
494 int last = SkPathOpsVerbToPoints(fVerb); | |
495 SkDebugf("((SkOpSegment*) 0x%p) [%d] {{", this, debugID()); | |
496 int index = 0; | |
497 do { | |
498 SkDPoint::Dump(fPts[index]); | |
499 SkDebugf(", "); | |
500 } while (++index < last); | |
501 SkDPoint::Dump(fPts[index]); | |
502 SkDebugf("}}\n"); | |
503 } | |
504 | |
505 void SkOpSegment::dumpHexPts() const { | |
506 int last = SkPathOpsVerbToPoints(fVerb); | |
507 SkDebugf("((SkOpSegment*) 0x%p) [%d] {{", this, debugID()); | |
508 int index = 0; | |
509 do { | |
510 SkDPoint::DumpHex(fPts[index]); | |
511 SkDebugf(", "); | |
512 } while (++index < last); | |
513 SkDPoint::DumpHex(fPts[index]); | |
514 SkDebugf("}}\n"); | |
515 } | |
516 | |
517 void SkOpSegment::dumpDPts() const { | |
518 int count = SkPathOpsVerbToPoints(fVerb); | |
519 SkDebugf("((SkOpSegment*) 0x%p) [%d] {{", this, debugID()); | |
520 int index = 0; | |
521 do { | |
522 SkDPoint dPt = {fPts[index].fX, fPts[index].fY}; | |
523 dPt.dump(); | |
524 if (index != count) { | |
525 SkDebugf(", "); | |
526 } | |
527 } while (++index <= count); | |
528 SkDebugf("}}\n"); | |
529 } | |
530 | |
531 void SkOpSegment::dumpSpans() const { | |
532 int count = this->count(); | |
533 SkDebugf("((SkOpSegment*) 0x%p) [%d]\n", this, debugID()); | |
534 for (int index = 0; index < count; ++index) { | |
535 const SkOpSpan& span = this->span(index); | |
536 SkDebugf(" [%d] ", index); | |
537 span.dumpOne(); | |
538 } | |
539 } | |
540 | |
541 void SkPathOpsDebug::DumpCoincidence(const SkTArray<SkOpContour, true>& contours
) { | |
542 int count = contours.count(); | |
543 for (int index = 0; index < count; ++index) { | |
544 contours[index].dumpCoincidences(); | |
545 } | |
546 } | |
547 | |
548 void SkPathOpsDebug::DumpCoincidence(const SkTArray<SkOpContour* , true>& contou
rs) { | |
549 int count = contours.count(); | |
550 for (int index = 0; index < count; ++index) { | |
551 contours[index]->dumpCoincidences(); | |
552 } | |
553 } | |
554 | |
555 void SkPathOpsDebug::DumpContours(const SkTArray<SkOpContour, true>& contours) { | |
556 int count = contours.count(); | |
557 for (int index = 0; index < count; ++index) { | |
558 contours[index].dump(); | |
559 } | |
560 } | |
561 | |
562 void SkPathOpsDebug::DumpContours(const SkTArray<SkOpContour* , true>& contours)
{ | |
563 int count = contours.count(); | |
564 for (int index = 0; index < count; ++index) { | |
565 contours[index]->dump(); | |
566 } | |
567 } | |
568 | |
569 void SkPathOpsDebug::DumpContourAngles(const SkTArray<SkOpContour, true>& contou
rs) { | |
570 int count = contours.count(); | |
571 for (int index = 0; index < count; ++index) { | |
572 contours[index].dumpAngles(); | |
573 } | |
574 } | |
575 | |
576 void SkPathOpsDebug::DumpContourAngles(const SkTArray<SkOpContour* , true>& cont
ours) { | |
577 int count = contours.count(); | |
578 for (int index = 0; index < count; ++index) { | |
579 contours[index]->dumpAngles(); | |
580 } | |
581 } | |
582 | |
583 void SkPathOpsDebug::DumpContourPts(const SkTArray<SkOpContour, true>& contours)
{ | |
584 int count = contours.count(); | |
585 for (int index = 0; index < count; ++index) { | |
586 contours[index].dumpPts(); | |
587 } | |
588 } | |
589 | |
590 void SkPathOpsDebug::DumpContourPts(const SkTArray<SkOpContour* , true>& contour
s) { | |
591 int count = contours.count(); | |
592 for (int index = 0; index < count; ++index) { | |
593 contours[index]->dumpPts(); | |
594 } | |
595 } | |
596 | |
597 void SkPathOpsDebug::DumpContourPt(const SkTArray<SkOpContour, true>& contours,
int segmentID) { | |
598 int count = contours.count(); | |
599 for (int index = 0; index < count; ++index) { | |
600 contours[index].dumpPt(segmentID); | |
601 } | |
602 } | |
603 | |
604 void SkPathOpsDebug::DumpContourPt(const SkTArray<SkOpContour* , true>& contours
, int segmentID) { | |
605 int count = contours.count(); | |
606 for (int index = 0; index < count; ++index) { | |
607 contours[index]->dumpPt(segmentID); | |
608 } | |
609 } | |
610 | |
611 void SkPathOpsDebug::DumpContourSpans(const SkTArray<SkOpContour, true>& contour
s) { | |
612 int count = contours.count(); | |
613 for (int index = 0; index < count; ++index) { | |
614 contours[index].dumpSpans(); | |
615 } | |
616 } | |
617 | |
618 void SkPathOpsDebug::DumpContourSpans(const SkTArray<SkOpContour* , true>& conto
urs) { | |
619 int count = contours.count(); | |
620 for (int index = 0; index < count; ++index) { | |
621 contours[index]->dumpSpans(); | |
622 } | |
623 } | |
624 | |
625 void SkPathOpsDebug::DumpContourSpan(const SkTArray<SkOpContour, true>& contours
, int segmentID) { | |
626 int count = contours.count(); | |
627 for (int index = 0; index < count; ++index) { | |
628 contours[index].dumpSpan(segmentID); | |
629 } | |
630 } | |
631 | |
632 void SkPathOpsDebug::DumpContourSpan(const SkTArray<SkOpContour* , true>& contou
rs, int segmentID) { | |
633 int count = contours.count(); | |
634 for (int index = 0; index < count; ++index) { | |
635 contours[index]->dumpSpan(segmentID); | |
636 } | |
637 } | |
638 | |
639 void SkPathOpsDebug::DumpSpans(const SkTDArray<SkOpSpan *>& spans) { | |
640 int count = spans.count(); | |
641 for (int index = 0; index < count; ++index) { | |
642 const SkOpSpan* span = spans[index]; | |
643 const SkOpSpan& oSpan = span->fOther->span(span->fOtherIndex); | |
644 const SkOpSegment* segment = oSpan.fOther; | |
645 SkDebugf("((SkOpSegment*) 0x%p) [%d] ", segment, segment->debugID()); | |
646 SkDebugf("spanIndex:%d ", oSpan.fOtherIndex); | |
647 span->dumpOne(); | |
648 } | |
649 } | |
650 | |
651 // this does not require that other T index is initialized or correct | |
652 const SkOpSegment* SkOpSpan::debugToSegment(ptrdiff_t* spanIndex) const { | |
653 if (!fOther) { | |
654 return NULL; | |
655 } | |
656 int oppCount = fOther->count(); | |
657 for (int index = 0; index < oppCount; ++index) { | |
658 const SkOpSpan& otherSpan = fOther->span(index); | |
659 double otherTestT = otherSpan.fT; | |
660 if (otherTestT < fOtherT) { | |
661 continue; | |
662 } | |
663 SkASSERT(otherTestT == fOtherT); | |
664 const SkOpSegment* candidate = otherSpan.fOther; | |
665 const SkOpSpan* first = candidate->debugSpans().begin(); | |
666 const SkOpSpan* last = candidate->debugSpans().end() - 1; | |
667 if (first <= this && this <= last) { | |
668 if (spanIndex) { | |
669 *spanIndex = this - first; | |
670 } | |
671 return candidate; | |
672 } | |
673 } | |
674 SkASSERT(0); | |
675 return NULL; | |
676 } | |
677 | |
678 void SkOpSpan::dumpOne() const { | |
679 SkDebugf("t="); | |
680 DebugDumpDouble(fT); | |
681 SkDebugf(" pt="); | |
682 SkDPoint::Dump(fPt); | |
683 if (fOther) { | |
684 SkDebugf(" other.fID=%d", fOther->debugID()); | |
685 SkDebugf(" [%d] otherT=", fOtherIndex); | |
686 DebugDumpDouble(fOtherT); | |
687 } else { | |
688 SkDebugf(" other.fID=? [?] otherT=?"); | |
689 } | |
690 if (fWindSum != SK_MinS32) { | |
691 SkDebugf(" windSum=%d", fWindSum); | |
692 } | |
693 if (fOppSum != SK_MinS32 && (SkPathOpsDebug::ValidWind(fOppSum) || fOppValue
!= 0)) { | |
694 SkDebugf(" oppSum=%d", fOppSum); | |
695 } | |
696 SkDebugf(" windValue=%d", fWindValue); | |
697 if (SkPathOpsDebug::ValidWind(fOppSum) || fOppValue != 0) { | |
698 SkDebugf(" oppValue=%d", fOppValue); | |
699 } | |
700 if (fFromAngle && fFromAngle->debugID()) { | |
701 SkDebugf(" from=%d", fFromAngle->debugID()); | |
702 } | |
703 if (fToAngle && fToAngle->debugID()) { | |
704 SkDebugf(" to=%d", fToAngle->debugID()); | |
705 } | |
706 if (fChased) { | |
707 SkDebugf(" chased"); | |
708 } | |
709 if (fCoincident) { | |
710 SkDebugf(" coincident"); | |
711 } | |
712 if (fDone) { | |
713 SkDebugf(" done"); | |
714 } | |
715 if (fLoop) { | |
716 SkDebugf(" loop"); | |
717 } | |
718 if (fMultiple) { | |
719 SkDebugf(" multiple"); | |
720 } | |
721 if (fNear) { | |
722 SkDebugf(" near"); | |
723 } | |
724 if (fSmall) { | |
725 SkDebugf(" small"); | |
726 } | |
727 if (fTiny) { | |
728 SkDebugf(" tiny"); | |
729 } | 281 } |
730 SkDebugf("\n"); | 282 SkDebugf("\n"); |
731 } | 283 } |
732 | 284 |
733 void SkOpSpan::dump() const { | 285 const SkOpAngle* SkPathOpsDebug::DebugAngleAngle(const SkOpAngle* angle, int id)
{ |
734 ptrdiff_t spanIndex; | 286 return angle->debugAngle(id); |
735 const SkOpSegment* segment = debugToSegment(&spanIndex); | 287 } |
736 if (segment) { | 288 |
737 SkDebugf("((SkOpSegment*) 0x%p) [%d]\n", segment, segment->debugID()); | 289 SkOpContour* SkPathOpsDebug::DebugAngleContour(SkOpAngle* angle, int id) { |
738 SkDebugf(" [%d] ", spanIndex); | 290 return angle->debugContour(id); |
739 } else { | 291 } |
740 SkDebugf("((SkOpSegment*) ?) [?]\n"); | 292 |
741 SkDebugf(" [?] "); | 293 const SkOpPtT* SkPathOpsDebug::DebugAnglePtT(const SkOpAngle* angle, int id) { |
742 } | 294 return angle->debugPtT(id); |
743 dumpOne(); | 295 } |
744 } | 296 |
745 | 297 const SkOpSegment* SkPathOpsDebug::DebugAngleSegment(const SkOpAngle* angle, int
id) { |
746 void Dump(const SkTArray<class SkOpContour, true>& contours) { | 298 return angle->debugSegment(id); |
747 SkPathOpsDebug::DumpContours(contours); | 299 } |
748 } | 300 |
749 | 301 const SkOpSpanBase* SkPathOpsDebug::DebugAngleSpan(const SkOpAngle* angle, int i
d) { |
750 void Dump(const SkTArray<class SkOpContour* , true>& contours) { | 302 return angle->debugSpan(id); |
751 SkPathOpsDebug::DumpContours(contours); | 303 } |
752 } | 304 |
753 | 305 const SkOpAngle* SkPathOpsDebug::DebugContourAngle(SkOpContour* contour, int id)
{ |
754 void Dump(const SkTArray<class SkOpContour, true>* contours) { | 306 return contour->debugAngle(id); |
755 SkPathOpsDebug::DumpContours(*contours); | 307 } |
756 } | 308 |
757 | 309 SkOpContour* SkPathOpsDebug::DebugContourContour(SkOpContour* contour, int id) { |
758 void Dump(const SkTArray<class SkOpContour* , true>* contours) { | 310 return contour->debugContour(id); |
759 SkPathOpsDebug::DumpContours(*contours); | 311 } |
760 } | 312 |
761 | 313 const SkOpPtT* SkPathOpsDebug::DebugContourPtT(SkOpContour* contour, int id) { |
762 void Dump(const SkTDArray<SkOpSpan *>& chase) { | 314 return contour->debugPtT(id); |
763 SkPathOpsDebug::DumpSpans(chase); | 315 } |
764 } | 316 |
765 | 317 const SkOpSegment* SkPathOpsDebug::DebugContourSegment(SkOpContour* contour, int
id) { |
766 void Dump(const SkTDArray<SkOpSpan *>* chase) { | 318 return contour->debugSegment(id); |
767 SkPathOpsDebug::DumpSpans(*chase); | 319 } |
768 } | 320 |
769 | 321 const SkOpSpanBase* SkPathOpsDebug::DebugContourSpan(SkOpContour* contour, int i
d) { |
770 void DumpAngles(const SkTArray<class SkOpContour, true>& contours) { | 322 return contour->debugSpan(id); |
771 SkPathOpsDebug::DumpContourAngles(contours); | 323 } |
772 } | 324 |
773 | 325 const SkOpAngle* SkPathOpsDebug::DebugPtTAngle(const SkOpPtT* ptT, int id) { |
774 void DumpAngles(const SkTArray<class SkOpContour* , true>& contours) { | 326 return ptT->debugAngle(id); |
775 SkPathOpsDebug::DumpContourAngles(contours); | 327 } |
776 } | 328 |
777 | 329 SkOpContour* SkPathOpsDebug::DebugPtTContour(SkOpPtT* ptT, int id) { |
778 void DumpAngles(const SkTArray<class SkOpContour, true>* contours) { | 330 return ptT->debugContour(id); |
779 SkPathOpsDebug::DumpContourAngles(*contours); | 331 } |
780 } | 332 |
781 | 333 const SkOpPtT* SkPathOpsDebug::DebugPtTPtT(const SkOpPtT* ptT, int id) { |
782 void DumpAngles(const SkTArray<class SkOpContour* , true>* contours) { | 334 return ptT->debugPtT(id); |
783 SkPathOpsDebug::DumpContourAngles(*contours); | 335 } |
784 } | 336 |
785 | 337 const SkOpSegment* SkPathOpsDebug::DebugPtTSegment(const SkOpPtT* ptT, int id) { |
786 void DumpCoin(const SkTArray<class SkOpContour, true>& contours) { | 338 return ptT->debugSegment(id); |
787 SkPathOpsDebug::DumpCoincidence(contours); | 339 } |
788 } | 340 |
789 | 341 const SkOpSpanBase* SkPathOpsDebug::DebugPtTSpan(const SkOpPtT* ptT, int id) { |
790 void DumpCoin(const SkTArray<class SkOpContour* , true>& contours) { | 342 return ptT->debugSpan(id); |
791 SkPathOpsDebug::DumpCoincidence(contours); | 343 } |
792 } | 344 |
793 | 345 const SkOpAngle* SkPathOpsDebug::DebugSegmentAngle(const SkOpSegment* span, int
id) { |
794 void DumpCoin(const SkTArray<class SkOpContour, true>* contours) { | 346 return span->debugAngle(id); |
795 SkPathOpsDebug::DumpCoincidence(*contours); | 347 } |
796 } | 348 |
797 | 349 SkOpContour* SkPathOpsDebug::DebugSegmentContour(SkOpSegment* span, int id) { |
798 void DumpCoin(const SkTArray<class SkOpContour* , true>* contours) { | 350 return span->debugContour(id); |
799 SkPathOpsDebug::DumpCoincidence(*contours); | 351 } |
800 } | 352 |
801 | 353 const SkOpPtT* SkPathOpsDebug::DebugSegmentPtT(const SkOpSegment* span, int id)
{ |
802 void DumpSpans(const SkTArray<class SkOpContour, true>& contours) { | 354 return span->debugPtT(id); |
803 SkPathOpsDebug::DumpContourSpans(contours); | 355 } |
804 } | 356 |
805 | 357 const SkOpSegment* SkPathOpsDebug::DebugSegmentSegment(const SkOpSegment* span,
int id) { |
806 void DumpSpans(const SkTArray<class SkOpContour* , true>& contours) { | 358 return span->debugSegment(id); |
807 SkPathOpsDebug::DumpContourSpans(contours); | 359 } |
808 } | 360 |
809 | 361 const SkOpSpanBase* SkPathOpsDebug::DebugSegmentSpan(const SkOpSegment* span, in
t id) { |
810 void DumpSpans(const SkTArray<class SkOpContour, true>* contours) { | 362 return span->debugSpan(id); |
811 SkPathOpsDebug::DumpContourSpans(*contours); | 363 } |
812 } | 364 |
813 | 365 const SkOpAngle* SkPathOpsDebug::DebugSpanAngle(const SkOpSpanBase* span, int id
) { |
814 void DumpSpans(const SkTArray<class SkOpContour* , true>* contours) { | 366 return span->debugAngle(id); |
815 SkPathOpsDebug::DumpContourSpans(*contours); | 367 } |
816 } | 368 |
817 | 369 SkOpContour* SkPathOpsDebug::DebugSpanContour(SkOpSpanBase* span, int id) { |
818 void DumpSpan(const SkTArray<class SkOpContour, true>& contours, int segmentID)
{ | 370 return span->debugContour(id); |
819 SkPathOpsDebug::DumpContourSpan(contours, segmentID); | 371 } |
820 } | 372 |
821 | 373 const SkOpPtT* SkPathOpsDebug::DebugSpanPtT(const SkOpSpanBase* span, int id) { |
822 void DumpSpan(const SkTArray<class SkOpContour* , true>& contours, int segmentID
) { | 374 return span->debugPtT(id); |
823 SkPathOpsDebug::DumpContourSpan(contours, segmentID); | 375 } |
824 } | 376 |
825 | 377 const SkOpSegment* SkPathOpsDebug::DebugSpanSegment(const SkOpSpanBase* span, in
t id) { |
826 void DumpSpan(const SkTArray<class SkOpContour, true>* contours, int segmentID)
{ | 378 return span->debugSegment(id); |
827 SkPathOpsDebug::DumpContourSpan(*contours, segmentID); | 379 } |
828 } | 380 |
829 | 381 const SkOpSpanBase* SkPathOpsDebug::DebugSpanSpan(const SkOpSpanBase* span, int
id) { |
830 void DumpSpan(const SkTArray<class SkOpContour* , true>* contours, int segmentID
) { | 382 return span->debugSpan(id); |
831 SkPathOpsDebug::DumpContourSpan(*contours, segmentID); | 383 } |
832 } | 384 |
833 | 385 void SkPathOpsDebug::DumpContours(SkTDArray<SkOpContour* >* contours) { |
834 void DumpPts(const SkTArray<class SkOpContour, true>& contours) { | 386 int count = contours->count(); |
835 SkPathOpsDebug::DumpContourPts(contours); | 387 for (int index = 0; index < count; ++index) { |
836 } | 388 (*contours)[index]->dump(); |
837 | 389 } |
838 void DumpPts(const SkTArray<class SkOpContour* , true>& contours) { | 390 } |
839 SkPathOpsDebug::DumpContourPts(contours); | 391 |
840 } | 392 void SkPathOpsDebug::DumpContoursAll(SkTDArray<SkOpContour* >* contours) { |
841 | 393 int count = contours->count(); |
842 void DumpPts(const SkTArray<class SkOpContour, true>* contours) { | 394 for (int index = 0; index < count; ++index) { |
843 SkPathOpsDebug::DumpContourPts(*contours); | 395 (*contours)[index]->dumpAll(); |
844 } | 396 } |
845 | 397 } |
846 void DumpPts(const SkTArray<class SkOpContour* , true>* contours) { | 398 |
847 SkPathOpsDebug::DumpContourPts(*contours); | 399 void SkPathOpsDebug::DumpContoursAngles(const SkTDArray<SkOpContour* >* contours
) { |
848 } | 400 int count = contours->count(); |
849 | 401 for (int index = 0; index < count; ++index) { |
850 void DumpPt(const SkTArray<class SkOpContour, true>& contours, int segmentID) { | 402 (*contours)[index]->dumpAngles(); |
851 SkPathOpsDebug::DumpContourPt(contours, segmentID); | 403 } |
852 } | 404 } |
853 | 405 |
854 void DumpPt(const SkTArray<class SkOpContour* , true>& contours, int segmentID)
{ | 406 void SkPathOpsDebug::DumpContoursPts(const SkTDArray<SkOpContour* >* contours) { |
855 SkPathOpsDebug::DumpContourPt(contours, segmentID); | 407 int count = contours->count(); |
856 } | 408 for (int index = 0; index < count; ++index) { |
857 | 409 (*contours)[index]->dumpPts(); |
858 void DumpPt(const SkTArray<class SkOpContour, true>* contours, int segmentID) { | 410 } |
859 SkPathOpsDebug::DumpContourPt(*contours, segmentID); | 411 } |
860 } | 412 |
861 | 413 void SkPathOpsDebug::DumpContoursPt(const SkTDArray<SkOpContour* >* contours, in
t segmentID) { |
862 void DumpPt(const SkTArray<class SkOpContour* , true>* contours, int segmentID)
{ | 414 int count = contours->count(); |
863 SkPathOpsDebug::DumpContourPt(*contours, segmentID); | 415 for (int index = 0; index < count; ++index) { |
| 416 (*contours)[index]->dumpPt(segmentID); |
| 417 } |
| 418 } |
| 419 |
| 420 void SkPathOpsDebug::DumpContoursSegment(const SkTDArray<SkOpContour* >* contour
s, |
| 421 int segmentID) { |
| 422 if (contours->count()) { |
| 423 (*contours)[0]->dumpSegment(segmentID); |
| 424 } |
| 425 } |
| 426 |
| 427 void SkPathOpsDebug::DumpContoursSpan(const SkTDArray<SkOpContour* >* contours, |
| 428 int spanID) { |
| 429 if (contours->count()) { |
| 430 (*contours)[0]->dumpSpan(spanID); |
| 431 } |
| 432 } |
| 433 |
| 434 void SkPathOpsDebug::DumpContoursSpans(const SkTDArray<SkOpContour* >* contours)
{ |
| 435 int count = contours->count(); |
| 436 for (int index = 0; index < count; ++index) { |
| 437 (*contours)[index]->dumpSpans(); |
| 438 } |
| 439 } |
| 440 |
| 441 const SkTSpan<SkDCubic>* DebugSpan(const SkTSect<SkDCubic>* sect, int id) { |
| 442 return sect->debugSpan(id); |
| 443 } |
| 444 |
| 445 const SkTSpan<SkDQuad>* DebugSpan(const SkTSect<SkDQuad>* sect, int id) { |
| 446 return sect->debugSpan(id); |
| 447 } |
| 448 |
| 449 const SkTSpan<SkDCubic>* DebugT(const SkTSect<SkDCubic>* sect, double t) { |
| 450 return sect->debugT(t); |
| 451 } |
| 452 |
| 453 const SkTSpan<SkDQuad>* DebugT(const SkTSect<SkDQuad>* sect, double t) { |
| 454 return sect->debugT(t); |
| 455 } |
| 456 |
| 457 const SkTSpan<SkDCubic>* DebugSpan(const SkTSpan<SkDCubic>* span, int id) { |
| 458 return span->debugSpan(id); |
| 459 } |
| 460 |
| 461 const SkTSpan<SkDQuad>* DebugSpan(const SkTSpan<SkDQuad>* span, int id) { |
| 462 return span->debugSpan(id); |
| 463 } |
| 464 |
| 465 const SkTSpan<SkDCubic>* DebugT(const SkTSpan<SkDCubic>* span, double t) { |
| 466 return span->debugT(t); |
| 467 } |
| 468 |
| 469 const SkTSpan<SkDQuad>* DebugT(const SkTSpan<SkDQuad>* span, double t) { |
| 470 return span->debugT(t); |
| 471 } |
| 472 |
| 473 void Dump(const SkTSect<SkDCubic>* sect) { |
| 474 sect->dump(); |
| 475 } |
| 476 |
| 477 void Dump(const SkTSect<SkDQuad>* sect) { |
| 478 sect->dump(); |
| 479 } |
| 480 |
| 481 void Dump(const SkTSpan<SkDCubic>* span) { |
| 482 span->dump(); |
| 483 } |
| 484 |
| 485 void Dump(const SkTSpan<SkDQuad>* span) { |
| 486 span->dump(); |
| 487 } |
| 488 |
| 489 void DumpBoth(SkTSect<SkDCubic>* sect1, SkTSect<SkDCubic>* sect2) { |
| 490 sect1->dumpBoth(sect2); |
| 491 } |
| 492 |
| 493 void DumpBoth(SkTSect<SkDQuad>* sect1, SkTSect<SkDQuad>* sect2) { |
| 494 sect1->dumpBoth(sect2); |
| 495 } |
| 496 |
| 497 void DumpCoin(SkTSect<SkDCubic>* sect1) { |
| 498 sect1->dumpCoin(); |
| 499 } |
| 500 |
| 501 void DumpCoin(SkTSect<SkDQuad>* sect1) { |
| 502 sect1->dumpCoin(); |
| 503 } |
| 504 |
| 505 void DumpCoinCurves(SkTSect<SkDCubic>* sect1) { |
| 506 sect1->dumpCoinCurves(); |
| 507 } |
| 508 |
| 509 void DumpCoinCurves(SkTSect<SkDQuad>* sect1) { |
| 510 sect1->dumpCoinCurves(); |
| 511 } |
| 512 |
| 513 void DumpCurves(const SkTSect<SkDQuad>* sect) { |
| 514 sect->dumpCurves(); |
| 515 } |
| 516 |
| 517 void DumpCurves(const SkTSect<SkDCubic>* sect) { |
| 518 sect->dumpCurves(); |
864 } | 519 } |
865 | 520 |
866 static void dumpTestCase(const SkDQuad& quad1, const SkDQuad& quad2, int testNo)
{ | 521 static void dumpTestCase(const SkDQuad& quad1, const SkDQuad& quad2, int testNo)
{ |
867 SkDebugf("<div id=\"quad%d\">\n", testNo); | 522 SkDebugf("\n<div id=\"quad%d\">\n", testNo); |
868 quad1.dumpComma(","); | 523 quad1.dumpInner(); |
| 524 SkDebugf("}}, "); |
869 quad2.dump(); | 525 quad2.dump(); |
870 SkDebugf("</div>\n\n"); | 526 SkDebugf("</div>\n\n"); |
871 } | 527 } |
872 | 528 |
873 static void dumpTestTrailer() { | 529 static void dumpTestTrailer() { |
874 SkDebugf("</div>\n\n<script type=\"text/javascript\">\n\n"); | 530 SkDebugf("</div>\n\n<script type=\"text/javascript\">\n\n"); |
875 SkDebugf(" var testDivs = [\n"); | 531 SkDebugf(" var testDivs = [\n"); |
876 } | 532 } |
877 | 533 |
878 static void dumpTestList(int testNo, double min) { | 534 static void dumpTestList(int testNo, double min) { |
879 SkDebugf(" quad%d,", testNo); | 535 SkDebugf(" quad%d,", testNo); |
880 if (min > 0) { | 536 if (min > 0) { |
881 SkDebugf(" // %1.9g", min); | 537 SkDebugf(" // %1.9g", min); |
882 } | 538 } |
883 SkDebugf("\n"); | 539 SkDebugf("\n"); |
884 } | 540 } |
885 | 541 |
886 void DumpQ(const SkDQuad& quad1, const SkDQuad& quad2, int testNo) { | 542 void DumpQ(const SkDQuad& quad1, const SkDQuad& quad2, int testNo) { |
887 SkDebugf("\n"); | 543 SkDebugf("\n"); |
888 dumpTestCase(quad1, quad2, testNo); | 544 dumpTestCase(quad1, quad2, testNo); |
889 dumpTestTrailer(); | 545 dumpTestTrailer(); |
890 dumpTestList(testNo, 0); | 546 dumpTestList(testNo, 0); |
891 SkDebugf("\n"); | 547 SkDebugf("\n"); |
892 } | 548 } |
893 | 549 |
894 void DumpT(const SkDQuad& quad, double t) { | 550 void DumpT(const SkDQuad& quad, double t) { |
895 SkDLine line = {{quad.ptAtT(t), quad[0]}}; | 551 SkDLine line = {{quad.ptAtT(t), quad[0]}}; |
896 line.dump(); | 552 line.dump(); |
897 } | 553 } |
| 554 |
| 555 const SkOpAngle* SkOpAngle::debugAngle(int id) const { |
| 556 return this->segment()->debugAngle(id); |
| 557 } |
| 558 |
| 559 SkOpContour* SkOpAngle::debugContour(int id) { |
| 560 return this->segment()->debugContour(id); |
| 561 } |
| 562 |
| 563 const SkOpPtT* SkOpAngle::debugPtT(int id) const { |
| 564 return this->segment()->debugPtT(id); |
| 565 } |
| 566 |
| 567 const SkOpSegment* SkOpAngle::debugSegment(int id) const { |
| 568 return this->segment()->debugSegment(id); |
| 569 } |
| 570 |
| 571 const SkOpSpanBase* SkOpAngle::debugSpan(int id) const { |
| 572 return this->segment()->debugSpan(id); |
| 573 } |
| 574 |
| 575 void SkOpAngle::dump() const { |
| 576 dumpOne(true); |
| 577 SkDebugf("\n"); |
| 578 } |
| 579 |
| 580 void SkOpAngle::dumpOne(bool functionHeader) const { |
| 581 // fSegment->debugValidate(); |
| 582 const SkOpSegment* segment = this->segment(); |
| 583 const SkOpSpan& mSpan = *fStart->starter(fEnd); |
| 584 if (functionHeader) { |
| 585 SkDebugf("%s ", __FUNCTION__); |
| 586 } |
| 587 SkDebugf("[%d", segment->debugID()); |
| 588 SkDebugf("/%d", debugID()); |
| 589 SkDebugf("] next="); |
| 590 if (fNext) { |
| 591 SkDebugf("%d", fNext->fStart->segment()->debugID()); |
| 592 SkDebugf("/%d", fNext->debugID()); |
| 593 } else { |
| 594 SkDebugf("?"); |
| 595 } |
| 596 SkDebugf(" sect=%d/%d ", fSectorStart, fSectorEnd); |
| 597 SkDebugf(" s=%1.9g [%d] e=%1.9g [%d]", fStart->t(), fStart->debugID(), |
| 598 fEnd->t(), fEnd->debugID()); |
| 599 SkDebugf(" sgn=%d windVal=%d", this->sign(), mSpan.windValue()); |
| 600 |
| 601 SkDebugf(" windSum="); |
| 602 SkPathOpsDebug::WindingPrintf(mSpan.windSum()); |
| 603 if (mSpan.oppValue() != 0 || mSpan.oppSum() != SK_MinS32) { |
| 604 SkDebugf(" oppVal=%d", mSpan.oppValue()); |
| 605 SkDebugf(" oppSum="); |
| 606 SkPathOpsDebug::WindingPrintf(mSpan.oppSum()); |
| 607 } |
| 608 if (mSpan.done()) { |
| 609 SkDebugf(" done"); |
| 610 } |
| 611 if (unorderable()) { |
| 612 SkDebugf(" unorderable"); |
| 613 } |
| 614 if (segment->operand()) { |
| 615 SkDebugf(" operand"); |
| 616 } |
| 617 if (fStop) { |
| 618 SkDebugf(" stop"); |
| 619 } |
| 620 } |
| 621 |
| 622 void SkOpAngle::dumpTo(const SkOpSegment* segment, const SkOpAngle* to) const { |
| 623 const SkOpAngle* first = this; |
| 624 const SkOpAngle* next = this; |
| 625 const char* indent = ""; |
| 626 do { |
| 627 SkDebugf("%s", indent); |
| 628 next->dumpOne(false); |
| 629 if (segment == next->fStart->segment()) { |
| 630 if (this == fNext) { |
| 631 SkDebugf(" << from"); |
| 632 } |
| 633 if (to == fNext) { |
| 634 SkDebugf(" << to"); |
| 635 } |
| 636 } |
| 637 SkDebugf("\n"); |
| 638 indent = " "; |
| 639 next = next->fNext; |
| 640 } while (next && next != first); |
| 641 } |
| 642 |
| 643 void SkOpAngle::dumpCurves() const { |
| 644 const SkOpAngle* first = this; |
| 645 const SkOpAngle* next = this; |
| 646 do { |
| 647 next->fCurvePart.dumpID(next->segment()->debugID()); |
| 648 next = next->fNext; |
| 649 } while (next && next != first); |
| 650 } |
| 651 |
| 652 void SkOpAngle::dumpLoop() const { |
| 653 const SkOpAngle* first = this; |
| 654 const SkOpAngle* next = this; |
| 655 do { |
| 656 next->dumpOne(false); |
| 657 SkDebugf("\n"); |
| 658 next = next->fNext; |
| 659 } while (next && next != first); |
| 660 } |
| 661 |
| 662 void SkOpAngle::dumpTest() const { |
| 663 const SkOpAngle* first = this; |
| 664 const SkOpAngle* next = this; |
| 665 do { |
| 666 SkDebugf("{ "); |
| 667 SkOpSegment* segment = next->segment(); |
| 668 segment->dumpPts(); |
| 669 SkDebugf(", %d, %1.9g, %1.9g, {} },\n", SkPathOpsVerbToPoints(segment->v
erb()) + 1, |
| 670 next->start()->t(), next->end()->t()); |
| 671 next = next->fNext; |
| 672 } while (next && next != first); |
| 673 } |
| 674 |
| 675 bool SkOpPtT::debugMatchID(int id) const { |
| 676 int limit = this->debugLoopLimit(false); |
| 677 int loop = 0; |
| 678 const SkOpPtT* ptT = this; |
| 679 do { |
| 680 if (ptT->debugID() == id) { |
| 681 return true; |
| 682 } |
| 683 } while ((!limit || ++loop <= limit) && (ptT = ptT->next()) && ptT != this); |
| 684 return false; |
| 685 } |
| 686 |
| 687 const SkOpAngle* SkOpPtT::debugAngle(int id) const { |
| 688 return this->span()->debugAngle(id); |
| 689 } |
| 690 |
| 691 SkOpContour* SkOpPtT::debugContour(int id) { |
| 692 return this->span()->debugContour(id); |
| 693 } |
| 694 |
| 695 const SkOpPtT* SkOpPtT::debugPtT(int id) const { |
| 696 return this->span()->debugPtT(id); |
| 697 } |
| 698 |
| 699 const SkOpSegment* SkOpPtT::debugSegment(int id) const { |
| 700 return this->span()->debugSegment(id); |
| 701 } |
| 702 |
| 703 const SkOpSpanBase* SkOpPtT::debugSpan(int id) const { |
| 704 return this->span()->debugSpan(id); |
| 705 } |
| 706 |
| 707 void SkOpPtT::dump() const { |
| 708 SkDebugf("seg=%d span=%d ptT=%d", |
| 709 this->segment()->debugID(), this->span()->debugID(), this->debugID()
); |
| 710 this->dumpBase(); |
| 711 SkDebugf("\n"); |
| 712 } |
| 713 |
| 714 void SkOpPtT::dumpAll() const { |
| 715 contour()->indentDump(); |
| 716 const SkOpPtT* next = this; |
| 717 int limit = debugLoopLimit(true); |
| 718 int loop = 0; |
| 719 do { |
| 720 SkDebugf("%.*s", contour()->debugIndent(), " "); |
| 721 SkDebugf("seg=%d span=%d ptT=%d", |
| 722 next->segment()->debugID(), next->span()->debugID(), next->debug
ID()); |
| 723 next->dumpBase(); |
| 724 SkDebugf("\n"); |
| 725 if (limit && ++loop >= limit) { |
| 726 SkDebugf("*** abort loop ***\n"); |
| 727 break; |
| 728 } |
| 729 } while ((next = next->fNext) && next != this); |
| 730 contour()->outdentDump(); |
| 731 } |
| 732 |
| 733 void SkOpPtT::dumpBase() const { |
| 734 SkDebugf(" t=%1.9g pt=(%1.9g,%1.9g)%s%s", this->fT, this->fPt.fX, this->fPt.
fY, |
| 735 this->fDuplicatePt ? " dup" : "", this->fDeleted ? " deleted" : ""); |
| 736 } |
| 737 |
| 738 const SkOpAngle* SkOpSpanBase::debugAngle(int id) const { |
| 739 return this->segment()->debugAngle(id); |
| 740 } |
| 741 |
| 742 SkOpContour* SkOpSpanBase::debugContour(int id) { |
| 743 return this->segment()->debugContour(id); |
| 744 } |
| 745 |
| 746 const SkOpPtT* SkOpSpanBase::debugPtT(int id) const { |
| 747 return this->segment()->debugPtT(id); |
| 748 } |
| 749 |
| 750 const SkOpSegment* SkOpSpanBase::debugSegment(int id) const { |
| 751 return this->segment()->debugSegment(id); |
| 752 } |
| 753 |
| 754 const SkOpSpanBase* SkOpSpanBase::debugSpan(int id) const { |
| 755 return this->segment()->debugSpan(id); |
| 756 } |
| 757 |
| 758 void SkOpSpanBase::dump() const { |
| 759 this->dumpAll(); |
| 760 SkDebugf("\n"); |
| 761 } |
| 762 |
| 763 void SkOpSpanBase::dumpAll() const { |
| 764 SkDebugf("%.*s", contour()->debugIndent(), " "); |
| 765 SkDebugf("seg=%d span=%d", this->segment()->debugID(), this->debugID()); |
| 766 this->dumpBase(); |
| 767 SkDebugf("\n"); |
| 768 this->fPtT.dumpAll(); |
| 769 } |
| 770 |
| 771 void SkOpSpanBase::dumpBase() const { |
| 772 if (this->fAligned) { |
| 773 SkDebugf(" aligned"); |
| 774 } |
| 775 if (this->fChased) { |
| 776 SkDebugf(" chased"); |
| 777 } |
| 778 if (!this->final()) { |
| 779 this->upCast()->dumpSpan(); |
| 780 } |
| 781 const SkOpSpanBase* coin = this->coinEnd(); |
| 782 if (this != coin) { |
| 783 SkDebugf(" coinEnd seg/span=%d/%d", coin->segment()->debugID(), coin->de
bugID()); |
| 784 } else if (this->final() || !this->upCast()->isCoincident()) { |
| 785 const SkOpPtT* oPt = this->ptT()->next(); |
| 786 SkDebugf(" seg/span=%d/%d", oPt->segment()->debugID(), oPt->span()->debu
gID()); |
| 787 } |
| 788 } |
| 789 |
| 790 void SkOpSpanBase::dumpCoin() const { |
| 791 const SkOpSpan* span = this->upCastable(); |
| 792 if (!span) { |
| 793 return; |
| 794 } |
| 795 if (!span->isCoincident()) { |
| 796 return; |
| 797 } |
| 798 span->dumpCoin(); |
| 799 } |
| 800 |
| 801 void SkOpSpan::dumpCoin() const { |
| 802 const SkOpSpan* coincident = fCoincident; |
| 803 bool ok = debugCoinLoopCheck(); |
| 804 this->dump(); |
| 805 int loop = 0; |
| 806 do { |
| 807 coincident->dump(); |
| 808 if (!ok && ++loop > 10) { |
| 809 SkDebugf("*** abort loop ***\n"); |
| 810 break; |
| 811 } |
| 812 } while ((coincident = coincident->fCoincident) != this); |
| 813 } |
| 814 |
| 815 bool SkOpSpan::dumpSpan() const { |
| 816 SkOpSpan* coin = fCoincident; |
| 817 if (this != coin) { |
| 818 SkDebugf(" coinStart seg/span=%d/%d", coin->segment()->debugID(), coin->
debugID()); |
| 819 } |
| 820 SkDebugf(" windVal=%d", this->windValue()); |
| 821 SkDebugf(" windSum="); |
| 822 SkPathOpsDebug::WindingPrintf(this->windSum()); |
| 823 if (this->oppValue() != 0 || this->oppSum() != SK_MinS32) { |
| 824 SkDebugf(" oppVal=%d", this->oppValue()); |
| 825 SkDebugf(" oppSum="); |
| 826 SkPathOpsDebug::WindingPrintf(this->oppSum()); |
| 827 } |
| 828 if (this->done()) { |
| 829 SkDebugf(" done"); |
| 830 } |
| 831 return this != coin; |
| 832 } |
| 833 |
| 834 const SkOpAngle* SkOpSegment::debugAngle(int id) const { |
| 835 return this->contour()->debugAngle(id); |
| 836 } |
| 837 |
| 838 SkOpContour* SkOpSegment::debugContour(int id) { |
| 839 return this->contour()->debugContour(id); |
| 840 } |
| 841 |
| 842 const SkOpPtT* SkOpSegment::debugPtT(int id) const { |
| 843 return this->contour()->debugPtT(id); |
| 844 } |
| 845 |
| 846 const SkOpSegment* SkOpSegment::debugSegment(int id) const { |
| 847 return this->contour()->debugSegment(id); |
| 848 } |
| 849 |
| 850 const SkOpSpanBase* SkOpSegment::debugSpan(int id) const { |
| 851 return this->contour()->debugSpan(id); |
| 852 } |
| 853 |
| 854 void SkOpSegment::dump() const { |
| 855 SkDebugf("%.*s", contour()->debugIndent(), " "); |
| 856 this->dumpPts(); |
| 857 const SkOpSpanBase* span = &fHead; |
| 858 contour()->indentDump(); |
| 859 do { |
| 860 SkDebugf("%.*s span=%d ", contour()->debugIndent(), " ", span->de
bugID()); |
| 861 span->ptT()->dumpBase(); |
| 862 span->dumpBase(); |
| 863 SkDebugf("\n"); |
| 864 } while (!span->final() && (span = span->upCast()->next())); |
| 865 contour()->outdentDump(); |
| 866 } |
| 867 |
| 868 void SkOpSegment::dumpAll() const { |
| 869 SkDebugf("%.*s", contour()->debugIndent(), " "); |
| 870 this->dumpPts(); |
| 871 const SkOpSpanBase* span = &fHead; |
| 872 contour()->indentDump(); |
| 873 do { |
| 874 span->dumpAll(); |
| 875 } while (!span->final() && (span = span->upCast()->next())); |
| 876 contour()->outdentDump(); |
| 877 } |
| 878 |
| 879 void SkOpSegment::dumpAngles() const { |
| 880 SkDebugf("seg=%d\n", debugID()); |
| 881 const SkOpSpanBase* span = &fHead; |
| 882 do { |
| 883 const SkOpAngle* fAngle = span->fromAngle(); |
| 884 const SkOpAngle* tAngle = span->final() ? NULL : span->upCast()->toAngle
(); |
| 885 if (fAngle) { |
| 886 SkDebugf(" span=%d from=%d ", span->debugID(), fAngle->debugID()); |
| 887 fAngle->dumpTo(this, tAngle); |
| 888 } |
| 889 if (tAngle) { |
| 890 SkDebugf(" span=%d to=%d ", span->debugID(), tAngle->debugID()); |
| 891 tAngle->dumpTo(this, fAngle); |
| 892 } |
| 893 } while (!span->final() && (span = span->upCast()->next())); |
| 894 } |
| 895 |
| 896 void SkOpSegment::dumpCoin() const { |
| 897 const SkOpSpan* span = &fHead; |
| 898 do { |
| 899 span->dumpCoin(); |
| 900 } while ((span = span->next()->upCastable())); |
| 901 } |
| 902 |
| 903 void SkOpSegment::dumpPts() const { |
| 904 int last = SkPathOpsVerbToPoints(fVerb); |
| 905 SkDebugf("seg=%d {{", this->debugID()); |
| 906 int index = 0; |
| 907 do { |
| 908 SkDPoint::Dump(fPts[index]); |
| 909 SkDebugf(", "); |
| 910 } while (++index < last); |
| 911 SkDPoint::Dump(fPts[index]); |
| 912 SkDebugf("}}\n"); |
| 913 } |
| 914 |
| 915 void SkCoincidentSpans::dump() const { |
| 916 SkDebugf("- seg=%d span=%d ptT=%d ", fCoinPtTStart->segment()->debugID(), |
| 917 fCoinPtTStart->span()->debugID(), fCoinPtTStart->debugID()); |
| 918 fCoinPtTStart->dumpBase(); |
| 919 SkDebugf(" span=%d ptT=%d ", fCoinPtTEnd->span()->debugID(), fCoinPtTEnd->de
bugID()); |
| 920 fCoinPtTEnd->dumpBase(); |
| 921 if (fCoinPtTStart->segment()->operand()) { |
| 922 SkDebugf(" operand"); |
| 923 } |
| 924 if (fCoinPtTStart->segment()->isXor()) { |
| 925 SkDebugf(" xor"); |
| 926 } |
| 927 SkDebugf("\n"); |
| 928 SkDebugf("+ seg=%d span=%d ptT=%d ", fOppPtTStart->segment()->debugID(), |
| 929 fOppPtTStart->span()->debugID(), fOppPtTStart->debugID()); |
| 930 fOppPtTStart->dumpBase(); |
| 931 SkDebugf(" span=%d ptT=%d ", fOppPtTEnd->span()->debugID(), fOppPtTEnd->debu
gID()); |
| 932 fOppPtTEnd->dumpBase(); |
| 933 if (fOppPtTStart->segment()->operand()) { |
| 934 SkDebugf(" operand"); |
| 935 } |
| 936 if (fOppPtTStart->segment()->isXor()) { |
| 937 SkDebugf(" xor"); |
| 938 } |
| 939 SkDebugf("\n"); |
| 940 } |
| 941 |
| 942 void SkOpCoincidence::dump() const { |
| 943 SkCoincidentSpans* span = fHead; |
| 944 while (span) { |
| 945 span->dump(); |
| 946 span = span->fNext; |
| 947 } |
| 948 } |
| 949 |
| 950 void SkOpContour::dump() { |
| 951 SkDebugf("contour=%d count=%d\n", this->debugID(), fCount); |
| 952 if (!fCount) { |
| 953 return; |
| 954 } |
| 955 const SkOpSegment* segment = &fHead; |
| 956 PATH_OPS_DEBUG_CODE(fIndent = 0); |
| 957 indentDump(); |
| 958 do { |
| 959 segment->dump(); |
| 960 } while ((segment = segment->next())); |
| 961 outdentDump(); |
| 962 } |
| 963 |
| 964 void SkOpContour::dumpAll() { |
| 965 SkDebugf("contour=%d count=%d\n", this->debugID(), fCount); |
| 966 if (!fCount) { |
| 967 return; |
| 968 } |
| 969 const SkOpSegment* segment = &fHead; |
| 970 PATH_OPS_DEBUG_CODE(fIndent = 0); |
| 971 indentDump(); |
| 972 do { |
| 973 segment->dumpAll(); |
| 974 } while ((segment = segment->next())); |
| 975 outdentDump(); |
| 976 } |
| 977 |
| 978 |
| 979 void SkOpContour::dumpAngles() const { |
| 980 SkDebugf("contour=%d\n", this->debugID()); |
| 981 const SkOpSegment* segment = &fHead; |
| 982 do { |
| 983 SkDebugf(" seg=%d ", segment->debugID()); |
| 984 segment->dumpAngles(); |
| 985 } while ((segment = segment->next())); |
| 986 } |
| 987 |
| 988 void SkOpContour::dumpPt(int index) const { |
| 989 const SkOpSegment* segment = &fHead; |
| 990 do { |
| 991 if (segment->debugID() == index) { |
| 992 segment->dumpPts(); |
| 993 } |
| 994 } while ((segment = segment->next())); |
| 995 } |
| 996 |
| 997 void SkOpContour::dumpPts() const { |
| 998 SkDebugf("contour=%d\n", this->debugID()); |
| 999 const SkOpSegment* segment = &fHead; |
| 1000 do { |
| 1001 SkDebugf(" seg=%d ", segment->debugID()); |
| 1002 segment->dumpPts(); |
| 1003 } while ((segment = segment->next())); |
| 1004 } |
| 1005 |
| 1006 void SkOpContour::dumpPtsX() const { |
| 1007 if (!this->fCount) { |
| 1008 SkDebugf("<empty>\n"); |
| 1009 return; |
| 1010 } |
| 1011 const SkOpSegment* segment = &fHead; |
| 1012 do { |
| 1013 segment->dumpPts(); |
| 1014 } while ((segment = segment->next())); |
| 1015 } |
| 1016 |
| 1017 void SkOpContour::dumpSegment(int index) const { |
| 1018 debugSegment(index)->dump(); |
| 1019 } |
| 1020 |
| 1021 void SkOpContour::dumpSegments(SkPathOp op) const { |
| 1022 bool firstOp = false; |
| 1023 const SkOpContour* c = this; |
| 1024 do { |
| 1025 if (!firstOp && c->operand()) { |
| 1026 #if DEBUG_ACTIVE_OP |
| 1027 SkDebugf("op %s\n", SkPathOpsDebug::kPathOpStr[op]); |
| 1028 #endif |
| 1029 firstOp = true; |
| 1030 } |
| 1031 c->dumpPtsX(); |
| 1032 } while ((c = c->next())); |
| 1033 } |
| 1034 |
| 1035 void SkOpContour::dumpSpan(int index) const { |
| 1036 debugSpan(index)->dump(); |
| 1037 } |
| 1038 |
| 1039 void SkOpContour::dumpSpans() const { |
| 1040 SkDebugf("contour=%d\n", this->debugID()); |
| 1041 const SkOpSegment* segment = &fHead; |
| 1042 do { |
| 1043 SkDebugf(" seg=%d ", segment->debugID()); |
| 1044 segment->dump(); |
| 1045 } while ((segment = segment->next())); |
| 1046 } |
| 1047 |
| 1048 #ifdef SK_DEBUG |
| 1049 const SkOpAngle* SkOpGlobalState::debugAngle(int id) const { |
| 1050 const SkOpContour* contour = fHead; |
| 1051 do { |
| 1052 const SkOpSegment* segment = contour->first(); |
| 1053 while (segment) { |
| 1054 const SkOpSpan* span = segment->head(); |
| 1055 do { |
| 1056 SkOpAngle* angle = span->fromAngle(); |
| 1057 if (angle && angle->debugID() == id) { |
| 1058 return angle; |
| 1059 } |
| 1060 angle = span->toAngle(); |
| 1061 if (angle && angle->debugID() == id) { |
| 1062 return angle; |
| 1063 } |
| 1064 } while ((span = span->next()->upCastable())); |
| 1065 const SkOpSpanBase* tail = segment->tail(); |
| 1066 SkOpAngle* angle = tail->fromAngle(); |
| 1067 if (angle && angle->debugID() == id) { |
| 1068 return angle; |
| 1069 } |
| 1070 segment = segment->next(); |
| 1071 } |
| 1072 } while ((contour = contour->next())); |
| 1073 return NULL; |
| 1074 } |
| 1075 |
| 1076 SkOpContour* SkOpGlobalState::debugContour(int id) { |
| 1077 SkOpContour* contour = fHead; |
| 1078 do { |
| 1079 if (contour->debugID() == id) { |
| 1080 return contour; |
| 1081 } |
| 1082 } while ((contour = contour->next())); |
| 1083 return NULL; |
| 1084 } |
| 1085 |
| 1086 const SkOpPtT* SkOpGlobalState::debugPtT(int id) const { |
| 1087 const SkOpContour* contour = fHead; |
| 1088 do { |
| 1089 const SkOpSegment* segment = contour->first(); |
| 1090 while (segment) { |
| 1091 const SkOpSpan* span = segment->head(); |
| 1092 do { |
| 1093 const SkOpPtT* ptT = span->ptT(); |
| 1094 if (ptT->debugMatchID(id)) { |
| 1095 return ptT; |
| 1096 } |
| 1097 } while ((span = span->next()->upCastable())); |
| 1098 const SkOpSpanBase* tail = segment->tail(); |
| 1099 const SkOpPtT* ptT = tail->ptT(); |
| 1100 if (ptT->debugMatchID(id)) { |
| 1101 return ptT; |
| 1102 } |
| 1103 segment = segment->next(); |
| 1104 } |
| 1105 } while ((contour = contour->next())); |
| 1106 return NULL; |
| 1107 } |
| 1108 |
| 1109 const SkOpSegment* SkOpGlobalState::debugSegment(int id) const { |
| 1110 const SkOpContour* contour = fHead; |
| 1111 do { |
| 1112 const SkOpSegment* segment = contour->first(); |
| 1113 while (segment) { |
| 1114 if (segment->debugID() == id) { |
| 1115 return segment; |
| 1116 } |
| 1117 segment = segment->next(); |
| 1118 } |
| 1119 } while ((contour = contour->next())); |
| 1120 return NULL; |
| 1121 } |
| 1122 |
| 1123 const SkOpSpanBase* SkOpGlobalState::debugSpan(int id) const { |
| 1124 const SkOpContour* contour = fHead; |
| 1125 do { |
| 1126 const SkOpSegment* segment = contour->first(); |
| 1127 while (segment) { |
| 1128 const SkOpSpan* span = segment->head(); |
| 1129 do { |
| 1130 if (span->debugID() == id) { |
| 1131 return span; |
| 1132 } |
| 1133 } while ((span = span->next()->upCastable())); |
| 1134 const SkOpSpanBase* tail = segment->tail(); |
| 1135 if (tail->debugID() == id) { |
| 1136 return tail; |
| 1137 } |
| 1138 segment = segment->next(); |
| 1139 } |
| 1140 } while ((contour = contour->next())); |
| 1141 return NULL; |
| 1142 } |
| 1143 #endif |
| 1144 |
| 1145 const SkOpAngle* DebugAngle(const SkTArray<SkOpContour*, true>* contours, int id
) { |
| 1146 return (*contours)[0]->debugAngle(id); |
| 1147 } |
| 1148 |
| 1149 SkOpContour* DumpContour(const SkTArray<SkOpContour*, true>* contours, int id) { |
| 1150 return (*contours)[0]->debugContour(id); |
| 1151 } |
| 1152 |
| 1153 const SkOpPtT* DebugPtT(const SkTArray<SkOpContour*, true>* contours, int id) { |
| 1154 return (*contours)[0]->debugPtT(id); |
| 1155 } |
| 1156 |
| 1157 const SkOpSegment* DebugSegment(const SkTArray<SkOpContour*, true>* contours, in
t id) { |
| 1158 return (*contours)[0]->debugSegment(id); |
| 1159 } |
| 1160 |
| 1161 const SkOpSpanBase* DebugSpan(const SkTArray<SkOpContour*, true>* contours, int
id) { |
| 1162 return (*contours)[0]->debugSpan(id); |
| 1163 } |
| 1164 |
| 1165 void Dump(SkTDArray<SkOpContour* >* contours) { |
| 1166 SkPathOpsDebug::DumpContours(contours); |
| 1167 } |
| 1168 |
| 1169 void DumpAll(SkTDArray<SkOpContour* >* contours) { |
| 1170 SkPathOpsDebug::DumpContoursAll(contours); |
| 1171 } |
| 1172 |
| 1173 void DumpAngles(const SkTDArray<SkOpContour* >* contours) { |
| 1174 SkPathOpsDebug::DumpContoursAngles(contours); |
| 1175 } |
| 1176 |
| 1177 void DumpSegment(const SkTDArray<SkOpContour* >* contours, int segmentID) { |
| 1178 SkPathOpsDebug::DumpContoursSegment(contours, segmentID); |
| 1179 } |
| 1180 |
| 1181 void DumpSpan(const SkTDArray<SkOpContour* >* contours, int spanID) { |
| 1182 SkPathOpsDebug::DumpContoursSpan(contours, spanID); |
| 1183 } |
| 1184 |
| 1185 void DumpSpans(const SkTDArray<SkOpContour* >* contours) { |
| 1186 SkPathOpsDebug::DumpContoursSpans(contours); |
| 1187 } |
| 1188 |
| 1189 void DumpPt(const SkTDArray<SkOpContour* >* contours, int segmentID) { |
| 1190 SkPathOpsDebug::DumpContoursPt(contours, segmentID); |
| 1191 } |
| 1192 |
| 1193 void DumpPts(const SkTDArray<SkOpContour* >* contours) { |
| 1194 SkPathOpsDebug::DumpContoursPts(contours); |
| 1195 } |
| 1196 |
| 1197 #if DEBUG_T_SECT_DUMP > 1 |
| 1198 int gDumpTSectNum; |
| 1199 #endif |
OLD | NEW |