Reduce flicker

Reduce flicker by only erasing the parts of the window that won't be
overwritten by the image.