[librsvg/librsvg-2.52: 1/18] (#823): Regression in geometry computation when the SVG viewBox does not match the default viewport




commit 800948096f897a650f06cce9a30d0b7eb6ec43c3
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Apr 28 13:27:51 2022 -0500

    (#823): Regression in geometry computation when the SVG viewBox does not match the default viewport
    
    Curiously, this manifests in the same way as #521, and is fixed by
    removing the code that I added to fix that one.
    
    I'm thinking that all the cleanups around viewport and viewBox
    handling caused the old code to not be needed anymore.
    
    (Found by adding the same debug output to librsvg-2.48 and the main
    branch, and comparing executions.)
    
    Fixes https://gitlab.gnome.org/GNOME/librsvg/-/issues/823
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/695>

 src/drawing_ctx.rs                             | 11 +----------
 tests/api.c                                    |  7 +++++++
 tests/fixtures/dimensions/823-position-sub.svg |  8 ++++++++
 3 files changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index b5d926c9d..b15c6c39b 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -691,7 +691,6 @@ impl DrawingCtx {
         }
 
         let orig_transform = self.get_transform();
-
         self.cr.transform(stacking_ctx.transform.into());
 
         let res = if clipping {
@@ -893,7 +892,6 @@ impl DrawingCtx {
                     }
 
                     self.cr.set_matrix(affine_at_start.into());
-
                     res
                 } else {
                     let current_transform = self.get_transform();
@@ -909,14 +907,7 @@ impl DrawingCtx {
         };
 
         self.cr.set_matrix(orig_transform.into());
-
-        if let Ok(bbox) = res {
-            let mut res_bbox = BoundingBox::new().with_transform(orig_transform);
-            res_bbox.insert(&bbox);
-            Ok(res_bbox)
-        } else {
-            res
-        }
+        res
     }
 
     /// Run the drawing function with the specified opacity
diff --git a/tests/api.c b/tests/api.c
index 8e73c0c08..5c494a4d8 100644
--- a/tests/api.c
+++ b/tests/api.c
@@ -1575,6 +1575,13 @@ static DimensionsFixtureData dimensions_fixtures[] =
         50.0, 60.0, 70.0, 80.0,
         TRUE, TRUE
     },
+    {
+        "/dimensions/sub/823",
+        "dimensions/823-position-sub.svg",
+        "#pad_width",
+        444.0, 139.0, 0.0, 0.0,
+        TRUE, FALSE
+    },
 };
 
 typedef struct
diff --git a/tests/fixtures/dimensions/823-position-sub.svg b/tests/fixtures/dimensions/823-position-sub.svg
new file mode 100644
index 000000000..66b47ae31
--- /dev/null
+++ b/tests/fixtures/dimensions/823-position-sub.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg width="700" height="500" viewBox="0 0 185.20832 132.29167"
+     version="1.1" xmlns="http://www.w3.org/2000/svg";>
+  <g style="opacity:0.86042145; fill:#ff0000;">
+    <rect x="117.58522" y="36.993668" width="52.916664" height="13.229166"
+          id="pad_width" />
+  </g>
+</svg>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]