| 2834 | //------------------------------------------------------------------------------ |
| 2835 | |
| 2836 | void Clipper::BuildIntersectList(const cInt topY) |
| 2837 | { |
| 2838 | if (!m_ActiveEdges) |
| 2839 | return; |
| 2840 | |
| 2841 | //prepare for sorting ... |
| 2842 | TEdge* e = m_ActiveEdges; |
| 2843 | m_SortedEdges = e; |
| 2844 | while (e) { |
| 2845 | e->PrevInSEL = e->PrevInAEL; |
| 2846 | e->NextInSEL = e->NextInAEL; |
| 2847 | e->Curr.X = TopX(*e, topY); |
| 2848 | e = e->NextInAEL; |
| 2849 | } |
| 2850 | |
| 2851 | //bubblesort ... |
| 2852 | bool isModified; |
| 2853 | do { |
| 2854 | isModified = false; |
| 2855 | e = m_SortedEdges; |
| 2856 | while (e->NextInSEL) { |
| 2857 | TEdge* eNext = e->NextInSEL; |
| 2858 | IntPoint Pt; |
| 2859 | if (e->Curr.X > eNext->Curr.X) { |
| 2860 | IntersectPoint(*e, *eNext, Pt); |
| 2861 | if (Pt.Y < topY) |
| 2862 | Pt = IntPoint(TopX(*e, topY), topY); |
| 2863 | IntersectNode* newNode = new IntersectNode; |
| 2864 | newNode->Edge1 = e; |
| 2865 | newNode->Edge2 = eNext; |
| 2866 | newNode->Pt = Pt; |
| 2867 | m_IntersectList.push_back(newNode); |
| 2868 | |
| 2869 | SwapPositionsInSEL(e, eNext); |
| 2870 | isModified = true; |
| 2871 | } else |
| 2872 | e = eNext; |
| 2873 | } |
| 2874 | if (e->PrevInSEL) |
| 2875 | e->PrevInSEL->NextInSEL = nullptr; |
| 2876 | else |
| 2877 | break; |
| 2878 | } while (isModified); |
| 2879 | m_SortedEdges = nullptr; //important |
| 2880 | } |
| 2881 | //------------------------------------------------------------------------------ |
| 2882 | |
| 2883 | void Clipper::ProcessIntersectList() |
nothing calls this directly
no test coverage detected