Added flip for double buffers.