| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkMutex.h" | 8 #include "SkMutex.h" |
| 9 #include "SkPath.h" | 9 #include "SkPath.h" |
| 10 #include "SkPathOpsDebug.h" | 10 #include "SkPathOpsDebug.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 cubic[2].fX = (cubic[3].fX + cubic[2].fX * 2) / 3; | 156 cubic[2].fX = (cubic[3].fX + cubic[2].fX * 2) / 3; |
| 157 cubic[2].fY = (cubic[3].fY + cubic[2].fY * 2) / 3; | 157 cubic[2].fY = (cubic[3].fY + cubic[2].fY * 2) / 3; |
| 158 return cubic; | 158 return cubic; |
| 159 } | 159 } |
| 160 | 160 |
| 161 #include "SkOpAngle.h" | 161 #include "SkOpAngle.h" |
| 162 #include "SkOpCoincidence.h" | 162 #include "SkOpCoincidence.h" |
| 163 #include "SkOpSegment.h" | 163 #include "SkOpSegment.h" |
| 164 | 164 |
| 165 SkOpAngle* SkOpSegment::debugLastAngle() { | 165 SkOpAngle* SkOpSegment::debugLastAngle() { |
| 166 SkOpAngle* result = NULL; | 166 SkOpAngle* result = nullptr; |
| 167 SkOpSpan* span = this->head(); | 167 SkOpSpan* span = this->head(); |
| 168 do { | 168 do { |
| 169 if (span->toAngle()) { | 169 if (span->toAngle()) { |
| 170 SkASSERT(!result); | 170 SkASSERT(!result); |
| 171 result = span->toAngle(); | 171 result = span->toAngle(); |
| 172 } | 172 } |
| 173 } while ((span = span->next()->upCastable())); | 173 } while ((span = span->next()->upCastable())); |
| 174 SkASSERT(result); | 174 SkASSERT(result); |
| 175 return result; | 175 return result; |
| 176 } | 176 } |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 span->fOppPtTStart->segment()->debugID(), | 407 span->fOppPtTStart->segment()->debugID(), |
| 408 span->fOppPtTStart->fT, span->fOppPtTEnd->fT); | 408 span->fOppPtTStart->fT, span->fOppPtTEnd->fT); |
| 409 span = span->fNext; | 409 span = span->fNext; |
| 410 } | 410 } |
| 411 } | 411 } |
| 412 | 412 |
| 413 void SkOpSegment::debugValidate() const { | 413 void SkOpSegment::debugValidate() const { |
| 414 #if DEBUG_VALIDATE | 414 #if DEBUG_VALIDATE |
| 415 const SkOpSpanBase* span = &fHead; | 415 const SkOpSpanBase* span = &fHead; |
| 416 double lastT = -1; | 416 double lastT = -1; |
| 417 const SkOpSpanBase* prev = NULL; | 417 const SkOpSpanBase* prev = nullptr; |
| 418 int count = 0; | 418 int count = 0; |
| 419 int done = 0; | 419 int done = 0; |
| 420 do { | 420 do { |
| 421 if (!span->final()) { | 421 if (!span->final()) { |
| 422 ++count; | 422 ++count; |
| 423 done += span->upCast()->done() ? 1 : 0; | 423 done += span->upCast()->done() ? 1 : 0; |
| 424 } | 424 } |
| 425 SkASSERT(span->segment() == this); | 425 SkASSERT(span->segment() == this); |
| 426 SkASSERT(!prev || prev->upCast()->next() == span); | 426 SkASSERT(!prev || prev->upCast()->next() == span); |
| 427 SkASSERT(!prev || prev == span->prev()); | 427 SkASSERT(!prev || prev == span->prev()); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 "kWinding_FillType", | 638 "kWinding_FillType", |
| 639 "kEvenOdd_FillType", | 639 "kEvenOdd_FillType", |
| 640 "kInverseWinding_FillType", | 640 "kInverseWinding_FillType", |
| 641 "kInverseEvenOdd_FillType" | 641 "kInverseEvenOdd_FillType" |
| 642 }; | 642 }; |
| 643 | 643 |
| 644 void SkPathOpsDebug::ShowOnePath(const SkPath& path, const char* name, bool incl
udeDeclaration) { | 644 void SkPathOpsDebug::ShowOnePath(const SkPath& path, const char* name, bool incl
udeDeclaration) { |
| 645 SkPath::RawIter iter(path); | 645 SkPath::RawIter iter(path); |
| 646 #define SUPPORT_RECT_CONTOUR_DETECTION 0 | 646 #define SUPPORT_RECT_CONTOUR_DETECTION 0 |
| 647 #if SUPPORT_RECT_CONTOUR_DETECTION | 647 #if SUPPORT_RECT_CONTOUR_DETECTION |
| 648 int rectCount = path.isRectContours() ? path.rectContours(NULL, NULL) : 0; | 648 int rectCount = path.isRectContours() ? path.rectContours(nullptr, nullptr)
: 0; |
| 649 if (rectCount > 0) { | 649 if (rectCount > 0) { |
| 650 SkTDArray<SkRect> rects; | 650 SkTDArray<SkRect> rects; |
| 651 SkTDArray<SkPath::Direction> directions; | 651 SkTDArray<SkPath::Direction> directions; |
| 652 rects.setCount(rectCount); | 652 rects.setCount(rectCount); |
| 653 directions.setCount(rectCount); | 653 directions.setCount(rectCount); |
| 654 path.rectContours(rects.begin(), directions.begin()); | 654 path.rectContours(rects.begin(), directions.begin()); |
| 655 for (int contour = 0; contour < rectCount; ++contour) { | 655 for (int contour = 0; contour < rectCount; ++contour) { |
| 656 const SkRect& rect = rects[contour]; | 656 const SkRect& rect = rects[contour]; |
| 657 SkDebugf("path.addRect(%1.9g, %1.9g, %1.9g, %1.9g, %s);\n", rect.fLe
ft, rect.fTop, | 657 SkDebugf("path.addRect(%1.9g, %1.9g, %1.9g, %1.9g, %s);\n", rect.fLe
ft, rect.fTop, |
| 658 rect.fRight, rect.fBottom, directions[contour] == SkPath::kC
CW_Direction | 658 rect.fRight, rect.fBottom, directions[contour] == SkPath::kC
CW_Direction |
| 659 ? "SkPath::kCCW_Direction" : "SkPath::kCW_Direction"); | 659 ? "SkPath::kCCW_Direction" : "SkPath::kCW_Direction"); |
| 660 } | 660 } |
| 661 return; | 661 return; |
| 662 } | 662 } |
| 663 #endif | 663 #endif |
| 664 SkPath::FillType fillType = path.getFillType(); | 664 SkPath::FillType fillType = path.getFillType(); |
| 665 SkASSERT(fillType >= SkPath::kWinding_FillType && fillType <= SkPath::kInver
seEvenOdd_FillType); | 665 SkASSERT(fillType >= SkPath::kWinding_FillType && fillType <= SkPath::kInver
seEvenOdd_FillType); |
| 666 if (includeDeclaration) { | 666 if (includeDeclaration) { |
| 667 SkDebugf(" SkPath %s;\n", name); | 667 SkDebugf(" SkPath %s;\n", name); |
| 668 } | 668 } |
| 669 SkDebugf(" %s.setFillType(SkPath::%s);\n", name, gFillTypeStr[fillType]); | 669 SkDebugf(" %s.setFillType(SkPath::%s);\n", name, gFillTypeStr[fillType]); |
| 670 iter.setPath(path); | 670 iter.setPath(path); |
| 671 showPathContours(iter, name); | 671 showPathContours(iter, name); |
| 672 } | 672 } |
| OLD | NEW |