With Juce8.0.3 running on Win11 using the Direct2D rendering, sometimes a strange rendering bug happens when a component has both transparent and opaque child components.
I’ve seen it with my custom components, but now I also see it with juce::PopupMenus that have a parent component. If the popup background colour is opaque these become opaque child components.
This arrangement seems to trigger a bad state in the Direct2D renderer that leads to wrong colours of random transparent components that have the same parent. It feels like the d2d state of the opaque child unintentionally spills into the parent d2d state.
I have a hard time coming up with a simple example as so far I’ve only seen it in complex UIs and only some random transparent siblings seem to be affected. I hope someone else sees this as well so we can figure out more clearly what causes this.
I also can work around the problem by making child components causing the issue non-opaque. In the case of PopupMenu it’s enough to make the background colour slightly transparent, which will trigger setOpaque(false) in the Juce popup code.
Here is a capture where it happens:
“Steps” is a label with black text. A juce::PopupMenu with all customization removed is opened. This is an opaque component. When it is drawn, the label text is drawn with some wrong color. Once the popup menu has disappeared and the label gets a redraw, it is drawn in black again.
The label text colour does not change from the code. The problem happens inside the D2D context. It happens only when using the d2d renderer.
I’ll add to this thread if I can narrow it down more.