You must be registered for see images
I thought that Roger gave hat to shanks after he decided to surrender to WG. But here shanks is wearing the straw hat. So Roger gave hat to Shanks way before. Roger must have travelled to lots of places after battle with Shiki. That means that Roger gave hat to shanks after seeing his potential not to pass it to other.