[librsvg/librsvg-2.50] Don't special-case measuring in DrawingCtx::new
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.50] Don't special-case measuring in DrawingCtx::new
- Date: Fri, 2 Oct 2020 19:24:36 +0000 (UTC)
commit 714af1a6f8fba8e2e2d8d41871bfd33cedcb3cbb
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Sep 21 20:16:02 2020 -0500
Don't special-case measuring in DrawingCtx::new
Thanks to Emile Snyder for nothing that that special case is unnecessary.
rsvg_internals/src/drawing_ctx.rs | 37 ++++++++++++++-----------------------
1 file 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]