team-phoenix / Phoenix

A multi-system emulator and library manager designed to be both powerful and easy to use.
http://phoenix.vg
GNU General Public License v2.0
377 stars 39 forks source link

GridView/ListView and choppy scrolling #256

Open athairus opened 8 years ago

athairus commented 8 years ago

If the user scrolls through either View quickly enough things will start to get choppy. This is because the delegates cannot be instantiated fast enough to hit that 60fps target. What's worse is if the user scrolls extremely fast the instantiations will pile up to the point the main thread is stalled for a few seconds (instantiation happens on the main thread, offloading with Loader still happens on the main thread because it uses cooperative multitasking). While the main thread is stalled, the render thread is still working at full speed.

The solution is to patch Qt's source. The current instantiation strategy of instantiating everything along the way from point A to point B needs to be changed. First off, delegates that are currently in view get priority for instantiation. Delegates that are partially loaded but no longer in view (at one point they were) need to have their creation aborted. Any (potential) delegates currently in view no longer have to be synchronously loaded. Add a default (styleable) loading animation so the user can have some visual indication of where they are in the grid (and don't instantiate it, just draw it wherever it's needed!). I don't know just how flexible these Views are so there might have to be some other assumptions we have to make like constant cell size.