Skip to content

Refactor transforms

These commits are salvaged from an incomplete mega-refactor where I was experimenting with several things:

  • Can we remove the draw_ctx.drawsub_stack? Maybe; some preliminary work is already in the commits. The main thing is to be able to walk down from the root to the element to draw, while reconstructing the current viewport/transform. This led me to...
  • Instead of keeping the current transform as mutable state in draw_ctx.cr, pass around a Transform to all the drawing functions. I didn't like where that was going and had no immediate way of testing that I got the pre_transform/post_transform correct, so instead I tried...
  • Instead of keeping a stack of viewports as mutable state in draw_ctx, pass a Viewport around to the drawing functions. I didn't like where this was going.

It seems that the code needs some more preliminary refactoring instead of trying to do the Viewport or Transform things at once. I'll file issues. It sounds like finishing !387 (closed) (extracting standalone structs for filter specs instead of doing everything in imperative code) will make it more obvious how to do these.

Merge request reports