libfreerdp-codec: optimize zgfx history buffer wrap around