ofPath arc rendering glitch

I’m drawing a whole bunch of arcs using ofPath. The side by side images show the problem I’m experiencing. On the left is a saved image using grabScreen. It is exactly what I see while the program is running. The glitch becomes obvious when compared to the image on the right, which is a PDF save of the exact same frame.

The PDF looks correct. I’m trying to figure out why the program is drawing the extra red arcs and fills when running. The code for the draw function is pasted below.

The project is from this processing book, I’m converting it to OF. http://www.generative-gestaltung.de


void SunburstItem::drawArc(float folderScale, float fileScale)
{




float arcRadius;
if (depth > 0)
{
float lineWidth;
if (isDir == 1)
{
lineWidth = (depthWeight * folderScale);
arcRadius = radius + ((depthWeight*folderScale)/2);
}
else {
lineWidth = (depthWeight * fileScale);
arcRadius = radius + ((depthWeight * fileScale)/2);
}
// ofNoFill();
// ofSetColor(color);
//ofPolyline arcPolyLine;
ofPath arcPath;
ofPoint p = ofPoint(ofGetWidth()/2,ofGetHeight()/2);
arcPath.arc(p, arcRadius, arcRadius, angleStart, angleEnd);
arcPath.arcNegative(p, arcRadius+lineWidth, arcRadius+lineWidth, angleEnd, angleStart);
arcPath.close();
arcPath.setCircleResolution(60);
arcPath.setFillColor(color);
arcPath.setFilled(true);
arcPath.draw();
}
}

It seems that adding floor and ceil to the angleStart and angleEnd fixes 99.9% of the problem.