Remove the current viewport as mutable state from DrawingCtx
This combines ViewParams
and Viewport
into a single struct Viewport
, which is basically about removing redundant data.
More importantly, the viewport stack is no longer part of the mutable state in DrawingCtx
. Viewports are now immutable, created as-needed by elements that need to establish them, and passed down the call chain as a function argument. Thus, the viewport stack is now implied by the call stack.
The next step is to make the current transform not part of the DrawingCtx.cr
's state. Instead, the Viewport.transform
should be accurate, and it should be composed with the current element's transform before rendering. That will happen in another MR.
Once the transform is implied by the viewport and the current element, it should be easier to create LayerKind
variants for groups of elements.