Apple tries to not break apps built with an older macOS SDK on newer macOS versions sometimes by providing them with the same environment as they were built. And in this case it looks like that DP was built with a version where NSViews were not using any CALayers by default. Later macOS added CALayers per default and one of these has the geometryFlipped property set to true
. While the default is false
. So in the case of DP if you add a layer, the content is not flipped. For any other host build with a later SDK adding a layer the content is flipped.
Later macOS added CALayers per default and one of these has the geometryFlipped property set to
true
Thanks for bearing with me on this one. If you take a look at the debug dump from DP both CALayers have geometryFlipped
set to NO
, though. I guess you’re referring to the contentsAreFlipped
implementation?
Anyway, making sure that the two layers added by VSTGUI have opposite geometryFlipped
values seems to fix the issue. I still don’t get why it doesn’t mess up the appearance in all other cases.
The important part is that VSTGUI expects that contentsAreFlipped are YES
for its own layer. It doesn’t matter what the other layers have.
In the case of DP, per default there’s no layer created by the system. VSTGUI now triggers NSView.wantsLayer = YES
which indirectly creates a CALayer hierarchy for the NSView and adds one Layer. Now VSTGUI adds its render layer via [nsView.layer addSublayer:caLayer];
. Both layers have their default state which is geometryFlipped == NO
. Thus the render layer has contentsAreFlipped == NO
.
In the case of hosts built with newer SDK versions, the NSView is already using layers and one of these layers has geometryFlipped == YES
and thus all layers afterwards have contentsAreFlipped == YES
.
Hope this makes it more clear.
Hi Arne,
Thanks for the elaboration, it’s starting to make sense now. I’ll patch in nsviewframe.mm caLayer.geometryFlipped = ![nsView.layer contentsAreFlipped];
for now. Given that it’s a one-liner I assume I shouldn’t do a PR for a fix?
Best,
Ray
I will take care of it,
Awesome, thank you!