new function gfxdevice_record_flush()