The root of the evil: XFillPolygon follows an arcane algorithm to decide whether...

@DaveFlater@infosec.exchange

The root of the evil: XFillPolygon follows an arcane algorithm to decide whether border pixels are included, producing off-by-one anomalies.

Correct mitigation: follow up with XDrawLines to draw the borders.

What they did: every time the output was visually wrong, they fudged the coordinates by 1. Off-by-one coordinates are reused and hilarity ensues.