Fix drawing of polygons with NaNs on cairo backends.