[librsvg/librsvg-2.50] (#554): Do not ignore the viewport in the geometry_for_layer() APIs
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.50] (#554): Do not ignore the viewport in the geometry_for_layer() APIs
- Date: Fri, 2 Oct 2020 19:24:37 +0000 (UTC)
commit 6ebdebf43a92aff635646f19e1ccfd4c263ab535
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Sep 28 19:58:19 2020 -0500
(#554): Do not ignore the viewport in the geometry_for_layer() APIs
Convert the final bounds to be relative to the starting transform.
Fixes https://gitlab.gnome.org/GNOME/librsvg/-/issues/554
librsvg_crate/tests/intrinsic_dimensions.rs | 1 -
rsvg_internals/src/drawing_ctx.rs | 14 +++++++++-----
2 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/librsvg_crate/tests/intrinsic_dimensions.rs b/librsvg_crate/tests/intrinsic_dimensions.rs
index 3e05ead1..db06cd3c 100644
--- a/librsvg_crate/tests/intrinsic_dimensions.rs
+++ b/librsvg_crate/tests/intrinsic_dimensions.rs
@@ -81,7 +81,6 @@ fn root_geometry_with_percent_viewport() {
assert_eq!((ink_r, logical_r), (rect, rect));
}
-#[cfg(ignore)]
#[test]
fn layer_geometry_with_offset_viewport() {
let svg = load_svg(
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index ff0aa5a8..38b23299 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -179,9 +179,16 @@ pub fn draw_tree(
let cascaded = CascadedValues::new_from_node(&node);
+ let transform = Transform::from(cr.get_matrix());
+ let mut bbox = BoundingBox::new().with_transform(transform);
+
let mut draw_ctx = DrawingCtx::new(cr, viewport, dpi, measuring, testing, drawsub_stack);
- draw_ctx.draw_node_from_stack(&node, acquired_nodes, &cascaded, false)
+ let content_bbox = draw_ctx.draw_node_from_stack(&node, acquired_nodes, &cascaded, false)?;
+
+ bbox.insert(&content_bbox);
+
+ Ok(bbox)
}
impl DrawingCtx {
@@ -214,10 +221,7 @@ impl DrawingCtx {
let viewport = viewport.translate((-viewport.x0, -viewport.y0));
let vbox = ViewBox::from(viewport);
- let initial_viewport = Viewport {
- transform,
- vbox,
- };
+ let initial_viewport = Viewport { transform, vbox };
let mut viewport_stack = Vec::new();
viewport_stack.push(initial_viewport);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]