diff options
author | Federico Mena Quintero <federico@gnome.org> | 2020-09-21 20:16:02 -0500 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2020-10-02 11:54:24 -0500 |
commit | 714af1a6f8fba8e2e2d8d41871bfd33cedcb3cbb (patch) | |
tree | dd3e2c8fa49fba5169f3e3642abbe3d9a71a746e | |
parent | c2100d2ce3f7da80e31e5a8a94a59ff1a5405eb1 (diff) | |
download | librsvg-714af1a6f8fba8e2e2d8d41871bfd33cedcb3cbb.tar.gz |
Don't special-case measuring in DrawingCtx::new
Thanks to Emile Snyder for nothing that that special case is unnecessary.
-rw-r--r-- | rsvg_internals/src/drawing_ctx.rs | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs index fcdeed97..e1c87bc2 100644 --- a/rsvg_internals/src/drawing_ctx.rs +++ b/rsvg_internals/src/drawing_ctx.rs @@ -204,29 +204,20 @@ impl DrawingCtx { ) -> DrawingCtx { let initial_transform = Transform::from(cr.get_matrix()); - // This is more or less a hack to make measuring geometries possible, - // while the code gets refactored not to need special cases for that. - - let (rect, vbox) = if measuring { - let unit_rect = Rect::from_size(1.0, 1.0); - (unit_rect, ViewBox(unit_rect)) - } else { - // https://www.w3.org/TR/SVG2/coords.html#InitialCoordinateSystem - // - // "For the outermost svg element, the SVG user agent must - // determine an initial viewport coordinate system and an - // initial user coordinate system such that the two - // coordinates systems are identical. The origin of both - // coordinate systems must be at the origin of the SVG - // viewport." - // - // "... the initial viewport coordinate system (and therefore - // the initial user coordinate system) must have its origin at - // the top/left of the viewport" - let vbox = ViewBox(Rect::from_size(viewport.width(), viewport.height())); - - (viewport, vbox) - }; + // https://www.w3.org/TR/SVG2/coords.html#InitialCoordinateSystem + // + // "For the outermost svg element, the SVG user agent must + // determine an initial viewport coordinate system and an + // initial user coordinate system such that the two + // coordinates systems are identical. The origin of both + // coordinate systems must be at the origin of the SVG + // viewport." + // + // "... the initial viewport coordinate system (and therefore + // the initial user coordinate system) must have its origin at + // the top/left of the viewport" + let vbox = ViewBox(Rect::from_size(viewport.width(), viewport.height())); + let rect = viewport; let mut view_box_stack = Vec::new(); view_box_stack.push(vbox); |