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 "SkOpCoincidence.h" | 9 #include "SkOpCoincidence.h" |
10 #include "SkOpContour.h" | 10 #include "SkOpContour.h" |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 case kMoveNearbyReleaseFinal_Glitch: SkDebugf(" MoveNearbyReleaseFin
al"); break; | 364 case kMoveNearbyReleaseFinal_Glitch: SkDebugf(" MoveNearbyReleaseFin
al"); break; |
365 case kReleasedSpan_Glitch: SkDebugf(" ReleasedSpan"); break; | 365 case kReleasedSpan_Glitch: SkDebugf(" ReleasedSpan"); break; |
366 case kUnaligned_Glitch: SkDebugf(" Unaligned"); break; | 366 case kUnaligned_Glitch: SkDebugf(" Unaligned"); break; |
367 case kUnalignedHead_Glitch: SkDebugf(" UnalignedHead"); break; | 367 case kUnalignedHead_Glitch: SkDebugf(" UnalignedHead"); break; |
368 case kUnalignedTail_Glitch: SkDebugf(" UnalignedTail"); break; | 368 case kUnalignedTail_Glitch: SkDebugf(" UnalignedTail"); break; |
369 default: SkASSERT(0); | 369 default: SkASSERT(0); |
370 } | 370 } |
371 SkDebugf("\n"); | 371 SkDebugf("\n"); |
372 } | 372 } |
373 contourList->globalState()->debugSetCheckHealth(false); | 373 contourList->globalState()->debugSetCheckHealth(false); |
374 #if 0 && DEBUG_ACTIVE_SPANS | 374 #if 01 && DEBUG_ACTIVE_SPANS |
375 SkDebugf("active after %s:\n", id); | 375 SkDebugf("active after %s:\n", id); |
376 ShowActiveSpans(contourList); | 376 ShowActiveSpans(contourList); |
377 #endif | 377 #endif |
378 #endif | 378 #endif |
379 } | 379 } |
380 #endif | 380 #endif |
381 | 381 |
382 #if defined SK_DEBUG || !FORCE_RELEASE | 382 #if defined SK_DEBUG || !FORCE_RELEASE |
383 void SkPathOpsDebug::MathematicaIze(char* str, size_t bufferLen) { | 383 void SkPathOpsDebug::MathematicaIze(char* str, size_t bufferLen) { |
384 size_t len = strlen(str); | 384 size_t len = strlen(str); |
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1839 } | 1839 } |
1840 | 1840 |
1841 // Commented-out lines keep this in sync with markCollapsed() | 1841 // Commented-out lines keep this in sync with markCollapsed() |
1842 void SkOpCoincidence::debugMarkCollapsed(const char* id, SkPathOpsDebug::GlitchL
og* log, const SkOpPtT* test) const { | 1842 void SkOpCoincidence::debugMarkCollapsed(const char* id, SkPathOpsDebug::GlitchL
og* log, const SkOpPtT* test) const { |
1843 this->debugMarkCollapsed(id, log, fHead, test); | 1843 this->debugMarkCollapsed(id, log, fHead, test); |
1844 this->debugMarkCollapsed(id, log, fTop, test); | 1844 this->debugMarkCollapsed(id, log, fTop, test); |
1845 } | 1845 } |
1846 #endif | 1846 #endif |
1847 | 1847 |
1848 void SkCoincidentSpans::debugShow() const { | 1848 void SkCoincidentSpans::debugShow() const { |
1849 SkDebugf("%s - id=%d t=%1.9g tEnd=%1.9g\n", __FUNCTION__, | 1849 SkDebugf("coinSpan - id=%d t=%1.9g tEnd=%1.9g\n", coinPtTStart()->segment()-
>debugID(), |
1850 coinPtTStart()->segment()->debugID(), | |
1851 coinPtTStart()->fT, coinPtTEnd()->fT); | 1850 coinPtTStart()->fT, coinPtTEnd()->fT); |
1852 SkDebugf("%s + id=%d t=%1.9g tEnd=%1.9g\n", __FUNCTION__, | 1851 SkDebugf("coinSpan + id=%d t=%1.9g tEnd=%1.9g\n", oppPtTStart()->segment()->
debugID(), |
1853 oppPtTStart()->segment()->debugID(), | |
1854 oppPtTStart()->fT, oppPtTEnd()->fT); | 1852 oppPtTStart()->fT, oppPtTEnd()->fT); |
1855 } | 1853 } |
1856 | 1854 |
1857 void SkOpCoincidence::debugShowCoincidence() const { | 1855 void SkOpCoincidence::debugShowCoincidence() const { |
1858 #if DEBUG_COINCIDENCE | 1856 #if DEBUG_COINCIDENCE |
1859 const SkCoincidentSpans* span = fHead; | 1857 const SkCoincidentSpans* span = fHead; |
1860 while (span) { | 1858 while (span) { |
1861 span->debugShow(); | 1859 span->debugShow(); |
1862 span = span->next(); | 1860 span = span->next(); |
1863 } | 1861 } |
1864 #endif | 1862 #endif |
1865 } | 1863 } |
1866 | 1864 |
1867 #if DEBUG_COINCIDENCE | 1865 #if DEBUG_COINCIDENCE |
1868 static void DebugValidate(const SkOpSpanBase* next, const SkOpSpanBase* end, | 1866 static void DebugCheckBetween(const SkOpSpanBase* next, const SkOpSpanBase* end, |
1869 double oStart, double oEnd, const SkOpSegment* oSegment, | 1867 double oStart, double oEnd, const SkOpSegment* oSegment, |
1870 const char* id, SkPathOpsDebug::GlitchLog* log) { | 1868 const char* id, SkPathOpsDebug::GlitchLog* log) { |
1871 SkASSERT(next != end); | 1869 SkASSERT(next != end); |
1872 SkASSERT(!next->contains(end) || log); | 1870 SkASSERT(!next->contains(end) || log); |
1873 if (next->t() > end->t()) { | 1871 if (next->t() > end->t()) { |
1874 SkTSwap(next, end); | 1872 SkTSwap(next, end); |
1875 } | 1873 } |
1876 do { | 1874 do { |
1877 const SkOpPtT* ptT = next->ptT(); | 1875 const SkOpPtT* ptT = next->ptT(); |
1878 int index = 0; | 1876 int index = 0; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1979 const char* id, SkPathOpsDebug::GlitchLog* log) { | 1977 const char* id, SkPathOpsDebug::GlitchLog* log) { |
1980 // look for pts inside coincident spans that are not inside the opposite spa
ns | 1978 // look for pts inside coincident spans that are not inside the opposite spa
ns |
1981 const SkCoincidentSpans* coin = head; | 1979 const SkCoincidentSpans* coin = head; |
1982 while (coin) { | 1980 while (coin) { |
1983 SkASSERT(SkOpCoincidence::Ordered(coin->coinPtTStart()->segment(), | 1981 SkASSERT(SkOpCoincidence::Ordered(coin->coinPtTStart()->segment(), |
1984 coin->oppPtTStart()->segment())); | 1982 coin->oppPtTStart()->segment())); |
1985 SkASSERT(coin->coinPtTStart()->span()->ptT() == coin->coinPtTStart()); | 1983 SkASSERT(coin->coinPtTStart()->span()->ptT() == coin->coinPtTStart()); |
1986 SkASSERT(coin->coinPtTEnd()->span()->ptT() == coin->coinPtTEnd()); | 1984 SkASSERT(coin->coinPtTEnd()->span()->ptT() == coin->coinPtTEnd()); |
1987 SkASSERT(coin->oppPtTStart()->span()->ptT() == coin->oppPtTStart()); | 1985 SkASSERT(coin->oppPtTStart()->span()->ptT() == coin->oppPtTStart()); |
1988 SkASSERT(coin->oppPtTEnd()->span()->ptT() == coin->oppPtTEnd()); | 1986 SkASSERT(coin->oppPtTEnd()->span()->ptT() == coin->oppPtTEnd()); |
1989 DebugValidate(coin->coinPtTStart()->span(), coin->coinPtTEnd()->span(), | 1987 coin = coin->next(); |
| 1988 } |
| 1989 DebugCheckOverlapTop(head, opt, id, log); |
| 1990 } |
| 1991 #endif |
| 1992 |
| 1993 void SkOpCoincidence::debugValidate() const { |
| 1994 #if DEBUG_COINCIDENCE |
| 1995 DebugValidate(fHead, fTop, nullptr, nullptr); |
| 1996 DebugValidate(fTop, nullptr, nullptr, nullptr); |
| 1997 #endif |
| 1998 } |
| 1999 |
| 2000 #if DEBUG_COINCIDENCE |
| 2001 static void DebugCheckBetween(const SkCoincidentSpans* head, const SkCoincidentS
pans* opt, |
| 2002 const char* id, SkPathOpsDebug::GlitchLog* log) { |
| 2003 // look for pts inside coincident spans that are not inside the opposite spa
ns |
| 2004 const SkCoincidentSpans* coin = head; |
| 2005 while (coin) { |
| 2006 DebugCheckBetween(coin->coinPtTStart()->span(), coin->coinPtTEnd()->span
(), |
1990 coin->oppPtTStart()->fT, coin->oppPtTEnd()->fT, coin->oppPtTStar
t()->segment(), | 2007 coin->oppPtTStart()->fT, coin->oppPtTEnd()->fT, coin->oppPtTStar
t()->segment(), |
1991 id, log); | 2008 id, log); |
1992 DebugValidate(coin->oppPtTStart()->span(), coin->oppPtTEnd()->span(), | 2009 DebugCheckBetween(coin->oppPtTStart()->span(), coin->oppPtTEnd()->span()
, |
1993 coin->coinPtTStart()->fT, coin->coinPtTEnd()->fT, coin->coinPtTS
tart()->segment(), | 2010 coin->coinPtTStart()->fT, coin->coinPtTEnd()->fT, coin->coinPtTS
tart()->segment(), |
1994 id, log); | 2011 id, log); |
1995 coin = coin->next(); | 2012 coin = coin->next(); |
1996 } | 2013 } |
1997 DebugCheckOverlapTop(head, opt, id, log); | 2014 DebugCheckOverlapTop(head, opt, id, log); |
1998 } | 2015 } |
1999 #endif | 2016 #endif |
2000 | 2017 |
2001 void SkOpCoincidence::debugValidate() const { | 2018 void SkOpCoincidence::debugCheckBetween() const { |
2002 #if DEBUG_COINCIDENCE | 2019 #if DEBUG_COINCIDENCE |
2003 // if (fGlobalState->debugCheckHealth()) { | 2020 if (fGlobalState->debugCheckHealth()) { |
2004 // return; | 2021 return; |
2005 // } | 2022 } |
2006 DebugValidate(fHead, fTop, nullptr, nullptr); | 2023 DebugCheckBetween(fHead, fTop, nullptr, nullptr); |
2007 DebugValidate(fTop, nullptr, nullptr, nullptr); | 2024 DebugCheckBetween(fTop, nullptr, nullptr, nullptr); |
2008 #endif | 2025 #endif |
2009 } | 2026 } |
2010 | 2027 |
2011 #if DEBUG_COINCIDENCE_VERBOSE | 2028 #if DEBUG_COINCIDENCE_VERBOSE |
2012 void SkOpCoincidence::debugCheckValid(const char* id, SkPathOpsDebug::GlitchLog*
log) const { | 2029 void SkOpCoincidence::debugCheckValid(const char* id, SkPathOpsDebug::GlitchLog*
log) const { |
2013 DebugValidate(fHead, fTop, id, log); | 2030 DebugValidate(fHead, fTop, id, log); |
2014 DebugValidate(fTop, nullptr, id, log); | 2031 DebugValidate(fTop, nullptr, id, log); |
2015 } | 2032 } |
2016 #endif | 2033 #endif |
2017 | 2034 |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2637 #endif | 2654 #endif |
2638 SkPath::FillType fillType = path.getFillType(); | 2655 SkPath::FillType fillType = path.getFillType(); |
2639 SkASSERT(fillType >= SkPath::kWinding_FillType && fillType <= SkPath::kInver
seEvenOdd_FillType); | 2656 SkASSERT(fillType >= SkPath::kWinding_FillType && fillType <= SkPath::kInver
seEvenOdd_FillType); |
2640 if (includeDeclaration) { | 2657 if (includeDeclaration) { |
2641 SkDebugf(" SkPath %s;\n", name); | 2658 SkDebugf(" SkPath %s;\n", name); |
2642 } | 2659 } |
2643 SkDebugf(" %s.setFillType(SkPath::%s);\n", name, gFillTypeStr[fillType]); | 2660 SkDebugf(" %s.setFillType(SkPath::%s);\n", name, gFillTypeStr[fillType]); |
2644 iter.setPath(path); | 2661 iter.setPath(path); |
2645 showPathContours(iter, name); | 2662 showPathContours(iter, name); |
2646 } | 2663 } |
OLD | NEW |