[librsvg] with_discrete_layer(): take a &mut FnMut



commit 9a7ee576e2078d131d5b210f38f49d9c3df293a6
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Jun 19 11:56:13 2018 -0500

    with_discrete_layer(): take a &mut FnMut
    
    Thanks to Ivan Molodetskikh for the tip!

 rsvg_internals/src/drawing_ctx.rs | 8 +++-----
 rsvg_internals/src/image.rs       | 2 +-
 rsvg_internals/src/link.rs        | 2 +-
 rsvg_internals/src/marker.rs      | 2 +-
 rsvg_internals/src/mask.rs        | 2 +-
 rsvg_internals/src/shapes.rs      | 2 +-
 rsvg_internals/src/structure.rs   | 6 +++---
 rsvg_internals/src/text.rs        | 2 +-
 8 files changed, 12 insertions(+), 14 deletions(-)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index 915b7e23..9b5b4884 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -202,15 +202,13 @@ pub fn get_acquired_node_of_type(
         })
 }
 
-pub fn with_discrete_layer<F>(
+pub fn with_discrete_layer(
     draw_ctx: *mut RsvgDrawingCtx,
     node: &RsvgNode,
     values: &ComputedValues,
     clipping: bool,
-    mut draw_fn: F,
-) where
-    F: FnMut(&cairo::Context),
-{
+    draw_fn: &mut FnMut(&cairo::Context),
+) {
     push_discrete_layer(draw_ctx, values, clipping);
 
     draw_fn(&get_cairo_context(draw_ctx));
diff --git a/rsvg_internals/src/image.rs b/rsvg_internals/src/image.rs
index 4b8650c2..84dcb592 100644
--- a/rsvg_internals/src/image.rs
+++ b/rsvg_internals/src/image.rs
@@ -118,7 +118,7 @@ impl NodeTrait for NodeImage {
             let w = self.w.get().normalize(values, draw_ctx);
             let h = self.h.get().normalize(values, draw_ctx);
 
-            drawing_ctx::with_discrete_layer(draw_ctx, node, values, clipping, |cr| {
+            drawing_ctx::with_discrete_layer(draw_ctx, node, values, clipping, &mut |cr| {
                 cr.save();
 
                 let aspect = self.aspect.get();
diff --git a/rsvg_internals/src/link.rs b/rsvg_internals/src/link.rs
index 078ae7c2..62fdc4fa 100644
--- a/rsvg_internals/src/link.rs
+++ b/rsvg_internals/src/link.rs
@@ -50,7 +50,7 @@ impl NodeTrait for NodeLink {
         let cascaded = CascadedValues::new(cascaded, node);
         let values = cascaded.get();
 
-        drawing_ctx::with_discrete_layer(draw_ctx, node, values, clipping, |_cr| {
+        drawing_ctx::with_discrete_layer(draw_ctx, node, values, clipping, &mut |_cr| {
             if link.is_some() && link.as_ref().unwrap() != "" {
                 const CAIRO_TAG_LINK: &str = "Link";
 
diff --git a/rsvg_internals/src/marker.rs b/rsvg_internals/src/marker.rs
index 70d3cd6c..0691a503 100644
--- a/rsvg_internals/src/marker.rs
+++ b/rsvg_internals/src/marker.rs
@@ -192,7 +192,7 @@ impl NodeMarker {
             }
         }
 
-        drawing_ctx::with_discrete_layer(draw_ctx, node, values, clipping, |_cr| {
+        drawing_ctx::with_discrete_layer(draw_ctx, node, values, clipping, &mut |_cr| {
             node.draw_children(&cascaded, draw_ctx, clipping);
         });
 
diff --git a/rsvg_internals/src/mask.rs b/rsvg_internals/src/mask.rs
index 220af0e4..836b90b9 100644
--- a/rsvg_internals/src/mask.rs
+++ b/rsvg_internals/src/mask.rs
@@ -128,7 +128,7 @@ impl NodeMask {
                 drawing_ctx::push_view_box(draw_ctx, 1.0, 1.0);
             }
 
-            drawing_ctx::with_discrete_layer(draw_ctx, node, values, false, |_cr| {
+            drawing_ctx::with_discrete_layer(draw_ctx, node, values, false, &mut |_cr| {
                 node.draw_children(&cascaded, draw_ctx, false);
             });
 
diff --git a/rsvg_internals/src/shapes.rs b/rsvg_internals/src/shapes.rs
index 05b57aa8..7ec0f3f3 100644
--- a/rsvg_internals/src/shapes.rs
+++ b/rsvg_internals/src/shapes.rs
@@ -23,7 +23,7 @@ fn render_path_builder(
     render_markers: bool,
     clipping: bool,
 ) {
-    drawing_ctx::with_discrete_layer(draw_ctx, node, values, clipping, |_cr| {
+    drawing_ctx::with_discrete_layer(draw_ctx, node, values, clipping, &mut |_cr| {
         draw_path_builder(draw_ctx, values, builder, clipping);
     });
 
diff --git a/rsvg_internals/src/structure.rs b/rsvg_internals/src/structure.rs
index 0b75d6e9..84024556 100644
--- a/rsvg_internals/src/structure.rs
+++ b/rsvg_internals/src/structure.rs
@@ -37,7 +37,7 @@ impl NodeTrait for NodeGroup {
     ) {
         let values = cascaded.get();
 
-        drawing_ctx::with_discrete_layer(draw_ctx, node, values, clipping, |_cr| {
+        drawing_ctx::with_discrete_layer(draw_ctx, node, values, clipping, &mut |_cr| {
             node.draw_children(cascaded, draw_ctx, clipping);
         });
     }
@@ -79,7 +79,7 @@ impl NodeTrait for NodeSwitch {
     ) {
         let values = cascaded.get();
 
-        drawing_ctx::with_discrete_layer(draw_ctx, node, values, clipping, |_cr| {
+        drawing_ctx::with_discrete_layer(draw_ctx, node, values, clipping, &mut |_cr| {
             if let Some(child) = node.children().find(|c| c.get_cond()) {
                 drawing_ctx::draw_node_from_stack(
                     draw_ctx,
@@ -320,7 +320,7 @@ impl NodeTrait for NodeUse {
             let cr = drawing_ctx::get_cairo_context(draw_ctx);
             cr.translate(nx, ny);
 
-            drawing_ctx::with_discrete_layer(draw_ctx, node, values, clipping, |_cr| {
+            drawing_ctx::with_discrete_layer(draw_ctx, node, values, clipping, &mut |_cr| {
                 drawing_ctx::draw_node_from_stack(
                     draw_ctx,
                     &CascadedValues::new_from_values(&child, values),
diff --git a/rsvg_internals/src/text.rs b/rsvg_internals/src/text.rs
index 4f0bdc2d..d2bcfa83 100644
--- a/rsvg_internals/src/text.rs
+++ b/rsvg_internals/src/text.rs
@@ -657,7 +657,7 @@ fn render_children(
 ) {
     let values = cascaded.get();
 
-    drawing_ctx::with_discrete_layer(draw_ctx, node, values, clipping, |_cr| {
+    drawing_ctx::with_discrete_layer(draw_ctx, node, values, clipping, &mut |_cr| {
         for child in node.children() {
             render_child(&child, cascaded, draw_ctx, x, y, textonly, clipping);
         }


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