The rendering stage is about the sizes of the graphics primitives. Basically what this stage does is it visits every allocated cell and sets the sizes appropriately.

Naturally each cell in a virtual canvas has two sets of sizes: minimum required width and height and the actual - calculated during rendering process - width and height. Let's talk about the cell heights first. The analysis is done on per row basis. In the code example the assignment statement takes just one line while the height of its side comment allocated in the same row requires two lines i.e. more pixels vertically. So the minimum required sizes differ for the items in the same row. The rendering algorithm will walk all the items in the row and pick the maximum height required. That value will be assigned as the actual height of each cell in the row. By the way, all the calculations are done basing on the font which was selected for drawing the diagram and other settings like a text or a cell padding.

Slightly more complicated story is with the cell width. From this prospective there are two types of rows: those which cell widths affect the other row cell widths and those which do not. A good example of a dependent row region is an if-else portion of a diagram. A below-branch of an if statement could of an arbitrary complexity so the width of the suite could vary while on the other hand a connector for the right-branch needs to be drawn properly i.e. considering the below-branch suite width. Therefore for an independent row rendering is primitive: the actual width of a cell is assigned as the minimum required. For the dependent row regions the rendering procedure needs to walk all the rows for each column and calculate the actual required width as a maximum of the minimum required ones - quite similar to what is done for a row in terms of its height. Then the calculated width is assigned to all the cells in the column.

Obviously the calculations are done recursively for all the virtual canvases. The outcome of the rendering is that the sizes of all the graphics primitives are calculated and the scene is ready for drawing.