I have submitted this via Feedback Assistant but am posting this here to ensure this bug gets some attention.
On previous versions of macOS, when you invalidated an area using setNeedsDisplayInRect:, calling the getRectsBeingDrawn:count: method in the drawRect: method for a view would correctly return the invalidated area.
Under Big Sur Beta 9, calling getRectsBeingDrawn:count: to determine the invalid area always returns the entire frame of the view. This is bad because routines that rely on getRectsBeingDrawn:count: to optimize drawing are getting the wrong information, and will draw more than they need to draw.
But even more serious is this: even getRectsBeingDrawn:count: reports the entire view as being invalid, you cannot successfully to draw into the area that has not been invalidated.
A sample demonstrating the problem can be found at https://github.com/TroikaTronix/BigSurDrawingTest
The READ ME gives further details about the bug and how the sample code reproduces the problem.
On previous versions of macOS, when you invalidated an area using setNeedsDisplayInRect:, calling the getRectsBeingDrawn:count: method in the drawRect: method for a view would correctly return the invalidated area.
Under Big Sur Beta 9, calling getRectsBeingDrawn:count: to determine the invalid area always returns the entire frame of the view. This is bad because routines that rely on getRectsBeingDrawn:count: to optimize drawing are getting the wrong information, and will draw more than they need to draw.
But even more serious is this: even getRectsBeingDrawn:count: reports the entire view as being invalid, you cannot successfully to draw into the area that has not been invalidated.
A sample demonstrating the problem can be found at https://github.com/TroikaTronix/BigSurDrawingTest
The READ ME gives further details about the bug and how the sample code reproduces the problem.
Hi Mark, sorry, I should have mentioned that we set .layer.contentFormat each time in -viewWillDraw (and in -layerWillDraw under iOS). When investigating this back when iOS 12 was new we found that the format is often reset by the OS. I didn’t investigate this further under macOS, just copied the fix from iOS.
One difference under macOS is that .layer.contentFormat returns kCAContentsFormatRGBA8Uint, even before setting it. Nevertheless setting this same value does make a difference. Under iOS, it returns "automatic" before changing it.
Kai
One difference under macOS is that .layer.contentFormat returns kCAContentsFormatRGBA8Uint, even before setting it. Nevertheless setting this same value does make a difference. Under iOS, it returns "automatic" before changing it.
Kai