Fix inadvertent O(N^2) loop within do_paint() which I just