The sorting of the positions across the scanline is fine, but when you reach an active line segment, there will be a clockwise or counter-clockwise directioning. It's not too hard to count the insidedness of an object based on the directionality of the enclosing polygons. This is the noted difference with non-zero vs. evenodd filling. This requires storing the directionality of the graph lines being crossed. But, would give OR and AND like fill capabilities.
https://en.wikipedia.org/wiki/Nonzero-rule