I have a Viewport with a grid of thumb components inside of it. Each thumb has a couple of images, some text and a few shapes drawn. Once rendered, those thumbs don’t need to change.
Right now, I call
setBufferedToImage (true) inside the constructor of the Thumb component. And this improves scrolling of the Viewport significantly. But the Viewport doesn’t seem to render images that aren’t visible (which is reasonable), so on a first scroll the User Experience isn’t great. The moment everything has been shown at least once, scroll works without any freezes. But even if it draws everything, I don’t seem to find anything about virtual scrolling in JUCE, so the load of so many components freezes the UI (since it’s hogging the Message Thread) and the user would still experience a huge freeze of the UI.
I don’t want my users to ever to see their UI freezing. If there is something to be loaded - notification of loading is shown (notification pops or modal AlertWindow with a progress bar is shown), while in the background work gets done, but I want those sliders buttons and knobs to still be working without any jitter.
Since there is nothing dynamic about these thumbs, can I have them detached from the components tree (so there is no synchronization issue with the Message Thread accessing them), render them with some sort of a detached graphic context (I really don’t know if there is such a thing) and once ready,
signal the message thread to add them up with
Any help is much appreciated.
I will try caching the images on a separate thread. Maybe this would solve the initial UI freeze problem. The first-scroll issue remains, though…