You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calls buffer_rgba() to get a memoryview of the buffer.
Performs a malloc() and copies the contents to the new buffer.
Wraps in CGDataProviderRef, then CGImageRef
Draws into the View's buffer via CGContextDrawImage()
View's buffer is then composited to the window's buffer.
Releases the GIL.
We can probably merge Step 6 / Step 7 by using a layer-backed view and setting CALayer.contents directly. There may be more optimizations here as well, if we can directly "push" a buffer to the view rather than relying on the -drawRect: call during the render cycle.
In either case, the rubberband would need to be a separate layer or view (non-opaque).
Fixed in my macosx-rework branch but requires more testing.
Moving away from -drawRect: and setting the CALayer.contents directly is a huge win - I'm no longer seeing flickering when updating figures or resizing the window. I was also able to remove an additional draw by changing the NSWindow's color space to match the layer-hosted view.
Previously, 50% of the draw cycle was Agg and the other 50% was CoreGraphic DrawImages. This is now at 80% in Agg and only 20% in CG.
Activity
iccir commentedon Jun 27, 2026
Fixed in my
macosx-reworkbranch but requires more testing.Moving away from
-drawRect:and setting theCALayer.contentsdirectly is a huge win - I'm no longer seeing flickering when updating figures or resizing the window. I was also able to remove an additional draw by changing the NSWindow's color space to match the layer-hosted view.Previously, 50% of the draw cycle was Agg and the other 50% was CoreGraphic DrawImages. This is now at 80% in Agg and only 20% in CG.