I think problem is with frame. It may happen that frame being drawn is distorted itself.

Try to continuously copy that frame with different names using some loop on desktop before showing it on screen. The movement flicker appear stop application and check whether any of frame you tried to show were distorted.