[librsvg] gitlab#181 - Inherit attributes in <svg> element properly



commit e2f68bc6fa1d4a75bd1952ada7a61be320ea339e
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Jan 12 16:23:08 2018 -0600

    gitlab#181 - Inherit attributes in <svg> element properly
    
    I accidentally removed the call to state_reinherit_top() in
    NodeSvg::draw().  Duh!
    
    Also, regenerated 761175-recursive-masks-ref.png.  It *was* being
    rendered incorrectly, with the caps at the end of the lines chopped
    off.  I didn't notice because they were very small in the resulting
    PNG.
    
    https://gitlab.gnome.org/GNOME/librsvg/issues/181

 rust/src/structure.rs                                   |   4 +++-
 .../reftests/bugs/181-inheritable-attrs-in-svg-ref.png  | Bin 0 -> 1214 bytes
 .../reftests/bugs/181-inheritable-attrs-in-svg.svg      |   3 +++
 .../reftests/bugs/761175-recursive-masks-ref.png        | Bin 460 -> 513 bytes
 4 files changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/rust/src/structure.rs b/rust/src/structure.rs
index 666c938..2377192 100644
--- a/rust/src/structure.rs
+++ b/rust/src/structure.rs
@@ -168,12 +168,14 @@ impl NodeTrait for NodeSvg {
         Ok (())
     }
 
-    fn draw (&self, node: &RsvgNode, draw_ctx: *const RsvgDrawingCtx, _dominate: i32) {
+    fn draw (&self, node: &RsvgNode, draw_ctx: *const RsvgDrawingCtx, dominate: i32) {
         let nx = self.x.get ().normalize (draw_ctx);
         let ny = self.y.get ().normalize (draw_ctx);
         let nw = self.w.get ().normalize (draw_ctx);
         let nh = self.h.get ().normalize (draw_ctx);
 
+        drawing_ctx::state_reinherit_top (draw_ctx, node.get_state (), dominate);
+
         let state = drawing_ctx::get_current_state (draw_ctx);
         let do_clip = !drawing_ctx::state_is_overflow (state) && node.get_parent ().is_some ();
 
diff --git a/tests/fixtures/reftests/bugs/181-inheritable-attrs-in-svg-ref.png 
b/tests/fixtures/reftests/bugs/181-inheritable-attrs-in-svg-ref.png
new file mode 100644
index 0000000..147134b
Binary files /dev/null and b/tests/fixtures/reftests/bugs/181-inheritable-attrs-in-svg-ref.png differ
diff --git a/tests/fixtures/reftests/bugs/181-inheritable-attrs-in-svg.svg 
b/tests/fixtures/reftests/bugs/181-inheritable-attrs-in-svg.svg
new file mode 100644
index 0000000..cb4fdf0
--- /dev/null
+++ b/tests/fixtures/reftests/bugs/181-inheritable-attrs-in-svg.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg"; width="128" height="128" fill="red" opacity="0.5">
+  <circle cx="64" cy="64" r="32"/>
+</svg>
diff --git a/tests/fixtures/reftests/bugs/761175-recursive-masks-ref.png 
b/tests/fixtures/reftests/bugs/761175-recursive-masks-ref.png
index 988c55e..aceb5d2 100644
Binary files a/tests/fixtures/reftests/bugs/761175-recursive-masks-ref.png and 
b/tests/fixtures/reftests/bugs/761175-recursive-masks-ref.png differ


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