Optimising progress bar repaint routine.
It wasn't slow, as such, but it was being called sufficiently often that it needed to be as fast as possible.