This simplifies RenderPicture() and reduces the scope of local variables.
mentioned in merge request !456 (merged)