Update canvas to avoid flickers.