+ pLeft = pRight->pNext;
+ pRight = pLeft ? pLeft->pNext : NULL;
+ }
+}
+
+static
+void
+STDCALL
+POLYGONFILL_FillScanLineWinding(
+ PDC dc,
+ int ScanLine,
+ FILL_EDGE* ActiveHead,
+ SURFOBJ *SurfObj,
+ PBRUSHOBJ BrushObj,
+ MIX RopMode )
+{
+ FILL_EDGE *pLeft, *pRight;
+ int x1, x2, winding = 0;
+ RECTL BoundRect;
+
+ if ( !ActiveHead )
+ return;
+
+ BoundRect.top = ScanLine;
+ BoundRect.bottom = ScanLine + 1;
+
+ pLeft = ActiveHead;
+ winding = pLeft->YDirection;
+ pRight = pLeft->pNext;
+ ASSERT(pRight);
+
+ // setup first line...
+ x1 = pLeft->XIntercept[0];
+ x2 = pRight->XIntercept[1];
+
+ pLeft = pRight;
+ pRight = pLeft->pNext;
+ winding += pLeft->YDirection;
+
+ while ( NULL != pRight )
+ {
+ int newx1 = pLeft->XIntercept[0];
+ int newx2 = pRight->XIntercept[1];
+ if ( winding )
+ {
+ // check and see if this new line touches the previous...
+ if ( (newx1 >= x1 && newx1 <= x2)
+ || (newx2 >= x1 && newx2 <= x2)
+ || (x1 >= newx1 && x1 <= newx2)
+ || (x2 >= newx2 && x2 <= newx2)
+ )
+ {
+ // yup, just tack it on to our existing line
+ x1 = MIN(x1,newx1);
+ x2 = MAX(x2,newx2);
+ }
+ else
+ {
+ // nope - render the old line..
+ BoundRect.left = x1;
+ BoundRect.right = x2;
+
+ //DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine);
+ IntEngLineTo( SurfObj,
+ dc->CombinedClip,
+ BrushObj,
+ x1,
+ ScanLine,
+ x2,
+ ScanLine,
+ &BoundRect, // Bounding rectangle
+ RopMode); // MIX
+
+ x1 = newx1;
+ x2 = newx2;
+ }
+ }
+ pLeft = pRight;
+ pRight = pLeft->pNext;
+ winding += pLeft->YDirection;
+ }
+ // there will always be a line left-over, render it now...
+ BoundRect.left = x1;
+ BoundRect.right = x2;
+
+ //DPRINT("Fill Line (%d, %d) to (%d, %d)\n",x1, ScanLine, x2, ScanLine);
+ IntEngLineTo( SurfObj,
+ dc->CombinedClip,
+ BrushObj,
+ x1,
+ ScanLine,
+ x2,
+ ScanLine,
+ &BoundRect, // Bounding rectangle
+ RopMode); // MIX