border: Avoid generating empty segments.
This is a bit less invasive and should do the job. I've confirmed that all the negative sizes come from edges, when a huge radii with radius > rect.size - cw_border.width - ccw_border.width. Still we're creating a gazillion empty borders which are useless, so prevent that too.