Post

Replies

Boosts

Views

Activity

CGContextAddArc not respecting clipping rects for open paths
macOS 15.2, MBP M1, built-in display. The following code produces a line outside the bounds of my clipping region when drawing to CGLayers, to produce a clockwise arc: CGContextBeginPath(m_s.outContext); CGContextAddArc(m_s.outContext, leftX + radius, topY - radius, radius, -startRads, -endRads, 1); CGContextSetRGBStrokeColor(m_s.outContext, col.fRed(), col.fGreen(), col.fBlue(), col.fAlpha()); CGContextSetLineWidth(m_s.outContext, width); CGContextStrokePath(m_s.outContext); Drawing other shapes such as rects or ellipses doesn't cause a problem. I can work around the issue by bringing the path back to the start of the arc: CGContextBeginPath(m_s.outContext); CGContextAddArc(m_s.outContext, leftX + radius, topY - radius, radius, -startRads, -endRads, 1); // add a second arc back to the start CGContextAddArc(m_s.outContext, leftX + radius, topY - radius, radius, -endRads, -startRads, 0); CGContextSetRGBStrokeColor(m_s.outContext, col.fRed(), col.fGreen(), col.fBlue(), col.fAlpha()); CGContextSetLineWidth(m_s.outContext, width); CGContextStrokePath(m_s.outContext); But this does appear to be a bug.
1
0
150
1w