Resizing the stage causes window flickering on Mac OS X Lion.
To confirm that this is not just our application, I ran the "Advanced Area Chart" demo of the Ensemble application. Resizing the Ensemble window very fast on my Apple LED Cinema display at high resolution, caused moderate flickering - I could resize it perhaps 10-12 times moving my mouse back and forth rapidly and then it would do a full window flicker where the window is all black for perhaps 100 milliseconds.
I am testing on a new high performance Mac Pro with a 1GB Radeon 5870 graphics card, so I expect the results to be worse on other systems.
In my own application, the background is transparent because we render a window with rounded corners. In this app, the flickering looks extreme. Even just slowly dragging the resize handle of the window leads to constant full window flickering - it looks as if the window paints all transparent every second frame and fully rendered every other frame.
I realize that the clear difference between my app and the Ensemble demo could prove that this is application specific. But it could also prove that running an application with
stage.initStyle(StageStyle.TRANSPARENT);
stage.setResizable(true);
in general causes flickering on the Mac, because as soon as I remove the initStyle call, the flickering is reduced to what is seen in the Ensemble app.
With StageStyle.TRANSPARENT I tried simplifying our app by removing all but one of my tabbed panes and showing only very little content, and the flickering is still extreme. I even restyled the app to replace the large gradient background with a solid color. Still the same extreme flickering.
I improved the situation by adding
setCache(true);
to the root node of the scene. Now if I resize the window from 1920x1080 down to half the size, it flickers only perhaps 3-4 times in the process, and not every other frame as before. But it still flickers from fully transparent to fully painted and often enough to look pretty bad.
I sincerely hope we will be able to fix this before our application is shown to customers, but I am afraid it is a bug in JavaFX.
To confirm that this is not just our application, I ran the "Advanced Area Chart" demo of the Ensemble application. Resizing the Ensemble window very fast on my Apple LED Cinema display at high resolution, caused moderate flickering - I could resize it perhaps 10-12 times moving my mouse back and forth rapidly and then it would do a full window flicker where the window is all black for perhaps 100 milliseconds.
I am testing on a new high performance Mac Pro with a 1GB Radeon 5870 graphics card, so I expect the results to be worse on other systems.
In my own application, the background is transparent because we render a window with rounded corners. In this app, the flickering looks extreme. Even just slowly dragging the resize handle of the window leads to constant full window flickering - it looks as if the window paints all transparent every second frame and fully rendered every other frame.
I realize that the clear difference between my app and the Ensemble demo could prove that this is application specific. But it could also prove that running an application with
stage.initStyle(StageStyle.TRANSPARENT);
stage.setResizable(true);
in general causes flickering on the Mac, because as soon as I remove the initStyle call, the flickering is reduced to what is seen in the Ensemble app.
With StageStyle.TRANSPARENT I tried simplifying our app by removing all but one of my tabbed panes and showing only very little content, and the flickering is still extreme. I even restyled the app to replace the large gradient background with a solid color. Still the same extreme flickering.
I improved the situation by adding
setCache(true);
to the root node of the scene. Now if I resize the window from 1920x1080 down to half the size, it flickers only perhaps 3-4 times in the process, and not every other frame as before. But it still flickers from fully transparent to fully painted and often enough to look pretty bad.
I sincerely hope we will be able to fix this before our application is shown to customers, but I am afraid it is a bug in JavaFX.
- duplicates
-
JDK-8127874 SceneBuilder is out of sync with the native OS window size while resizing.
- Closed
- relates to
-
JDK-8088317 Mac: Quantum should handle the ViewEvent.REPAINT event and/or implement the Pen.paint() method
- Open
-
JDK-8090283 [D3D] Ensemble application flickers during resize
- In Progress