This looks like a depth buffering issue to me you start with a white background, draw the thing with the border so that it's composited on the white, then draw the thing behind the thing with the...