[PATCH v3 1/2] windowscodecs: Factor out common GIF palette copying logic.