| 2634 | *******************************************************************************/ |
| 2635 | |
| 2636 | void Clipper::ProcessHorizontal(TEdge *horzEdge) |
| 2637 | { |
| 2638 | Direction dir; |
| 2639 | cInt horzLeft, horzRight; |
| 2640 | bool IsOpen = (horzEdge->WindDelta == 0); |
| 2641 | |
| 2642 | GetHorzDirection(*horzEdge, dir, horzLeft, horzRight); |
| 2643 | |
| 2644 | TEdge* eLastHorz = horzEdge, *eMaxPair = 0; |
| 2645 | while (eLastHorz->NextInLML && IsHorizontal(*eLastHorz->NextInLML)) |
| 2646 | eLastHorz = eLastHorz->NextInLML; |
| 2647 | if (!eLastHorz->NextInLML) |
| 2648 | eMaxPair = GetMaximaPair(eLastHorz); |
| 2649 | |
| 2650 | MaximaList::const_iterator maxIt; |
| 2651 | MaximaList::const_reverse_iterator maxRit; |
| 2652 | if (m_Maxima.size() > 0) |
| 2653 | { |
| 2654 | //get the first maxima in range (X) ... |
| 2655 | if (dir == dLeftToRight) |
| 2656 | { |
| 2657 | maxIt = m_Maxima.begin(); |
| 2658 | while (maxIt != m_Maxima.end() && *maxIt <= horzEdge->Bot.X) maxIt++; |
| 2659 | if (maxIt != m_Maxima.end() && *maxIt >= eLastHorz->Top.X) |
| 2660 | maxIt = m_Maxima.end(); |
| 2661 | } |
| 2662 | else |
| 2663 | { |
| 2664 | maxRit = m_Maxima.rbegin(); |
| 2665 | while (maxRit != m_Maxima.rend() && *maxRit > horzEdge->Bot.X) maxRit++; |
| 2666 | if (maxRit != m_Maxima.rend() && *maxRit <= eLastHorz->Top.X) |
| 2667 | maxRit = m_Maxima.rend(); |
| 2668 | } |
| 2669 | } |
| 2670 | |
| 2671 | OutPt* op1 = 0; |
| 2672 | |
| 2673 | for (;;) //loop through consec. horizontal edges |
| 2674 | { |
| 2675 | |
| 2676 | bool IsLastHorz = (horzEdge == eLastHorz); |
| 2677 | TEdge* e = GetNextInAEL(horzEdge, dir); |
| 2678 | while(e) |
| 2679 | { |
| 2680 | |
| 2681 | //this code block inserts extra coords into horizontal edges (in output |
| 2682 | //polygons) whereever maxima touch these horizontal edges. This helps |
| 2683 | //'simplifying' polygons (ie if the Simplify property is set). |
| 2684 | if (m_Maxima.size() > 0) |
| 2685 | { |
| 2686 | if (dir == dLeftToRight) |
| 2687 | { |
| 2688 | while (maxIt != m_Maxima.end() && *maxIt < e->Curr.X) |
| 2689 | { |
| 2690 | if (horzEdge->OutIdx >= 0 && !IsOpen) |
| 2691 | AddOutPt(horzEdge, IntPoint(*maxIt, horzEdge->Bot.Y)); |
| 2692 | maxIt++; |
| 2693 | } |
nothing calls this directly
no test coverage detected