[librsvg] marker.rs: Don't convert from *const RsvgNode to RsvgNode twice



commit e594049adcb84fe89758e6e3d26dbb4f011f2ad9
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Mar 16 19:58:46 2017 -0600

    marker.rs: Don't convert from *const RsvgNode to RsvgNode twice
    
    This is still a bit ugly, since for convenience we pass both the node
    and the cnode to Marker::render().  Hopefully this will go away
    eventually.

 rust/src/marker.rs |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/rust/src/marker.rs b/rust/src/marker.rs
index 57eba6f..48a282a 100644
--- a/rust/src/marker.rs
+++ b/rust/src/marker.rs
@@ -111,6 +111,7 @@ impl NodeMarker {
     }
 
     fn render (&self,
+               node:           &RsvgNode,
                c_node:         *const RsvgNode,
                draw_ctx:       *const RsvgDrawingCtx,
                xpos:           f64,
@@ -181,8 +182,7 @@ impl NodeMarker {
             }
         }
 
-        let marker_node: &RsvgNode = unsafe { & *c_node };
-        marker_node.draw_children (draw_ctx, -1); // dominate=-1 so it won't reinherit state / push a layer
+        node.draw_children (draw_ctx, -1); // dominate=-1 so it won't reinherit state / push a layer
 
         drawing_ctx::pop_discrete_layer (draw_ctx);
 
@@ -587,7 +587,7 @@ fn emit_marker_by_name (draw_ctx:       *const RsvgDrawingCtx,
 
     let node: &RsvgNode = unsafe { & *c_node };
 
-    node.with_impl (|marker: &NodeMarker| marker.render (c_node, draw_ctx, xpos, ypos, computed_angle, 
line_width));
+    node.with_impl (|marker: &NodeMarker| marker.render (node, c_node, draw_ctx, xpos, ypos, computed_angle, 
line_width));
 
     drawing_ctx::release_node (draw_ctx, c_node);
 }


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