[librsvg/librsvg-2.50] New helper function to push a full Viewport
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.50] New helper function to push a full Viewport
- Date: Fri, 2 Oct 2020 19:24:37 +0000 (UTC)
commit 29bd059ed5f621267254b18409b5ee3d97245ea5
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Sep 22 19:00:38 2020 -0500
New helper function to push a full Viewport
rsvg_internals/src/drawing_ctx.rs | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index 85a8a701..5c34d0b4 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -326,6 +326,18 @@ impl DrawingCtx {
}
}
+ fn push_viewport(&self, viewport: Viewport) -> ViewParams {
+ let vbox = viewport.vbox;
+
+ self.viewport_stack.borrow_mut().push(viewport);
+
+ ViewParams {
+ dpi: self.dpi,
+ vbox,
+ viewport_stack: Some(Rc::downgrade(&self.viewport_stack)),
+ }
+ }
+
/// Pushes a viewport size for normalizing `Length` values.
///
/// You should pass the returned `ViewParams` to all subsequent `Length.normalize()`
@@ -337,16 +349,7 @@ impl DrawingCtx {
let Viewport { transform, .. } = self.get_top_viewport();
let vbox = ViewBox::from(Rect::from_size(width, height));
-
- self.viewport_stack
- .borrow_mut()
- .push(Viewport { transform, vbox });
-
- ViewParams {
- dpi: self.dpi,
- vbox,
- viewport_stack: Some(Rc::downgrade(&self.viewport_stack)),
- }
+ self.push_viewport(Viewport { transform, vbox })
}
/// Creates a new coordinate space inside a viewport.
@@ -394,8 +397,12 @@ impl DrawingCtx {
}
}
- let vbox = vbox.unwrap_or_else(|| self.get_top_viewport().vbox);
- self.push_view_box(vbox.width(), vbox.height())
+ let top_viewport = self.get_top_viewport();
+
+ self.push_viewport(Viewport {
+ transform: top_viewport.transform.post_transform(&t),
+ vbox: vbox.unwrap_or(top_viewport.vbox),
+ })
})
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]