This PR refactors the image loading (and cleans up some of the code there, so make sure you disable whitespace when viewing the diff). It moves the loading of frames to a worker thread (the one we get from the network request).
Since the only work left is to assign the parsed frames to the image, this can be done in one go (no more queue). Once the frames are loaded, they are immediately pushed.
Technically, if many images load between two gui-thread-event-loop iterations, this could bloat the event-queue. Although I haven't measured, I don't think this is a bottleneck. When notifying channels, however, updates are batched to at most one per iteration.
This PR refactors the image loading (and cleans up some of the code there, so make sure you disable whitespace when viewing the diff). It moves the loading of frames to a worker thread (the one we get from the network request).
Since the only work left is to assign the parsed frames to the image, this can be done in one go (no more queue). Once the frames are loaded, they are immediately pushed.
Technically, if many images load between two gui-thread-event-loop iterations, this could bloat the event-queue. Although I haven't measured, I don't think this is a bottleneck. When notifying channels, however, updates are batched to at most one per iteration.