lavfi: factorize drawgrid and drawbox code