[librsvg: 44/95] pattern_resolve_fallbacks_and_set_pattern(): Use Rust types



commit 90c0930e3f6140e9e502f9d0d4ceba3d590e585b
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Feb 20 14:52:57 2018 -0600

    pattern_resolve_fallbacks_and_set_pattern(): Use Rust types

 rust/src/paint_server.rs |  2 +-
 rust/src/pattern.rs      | 11 +++--------
 2 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/rust/src/paint_server.rs b/rust/src/paint_server.rs
index f00499f1..a7ace81e 100644
--- a/rust/src/paint_server.rs
+++ b/rust/src/paint_server.rs
@@ -236,7 +236,7 @@ pub extern "C" fn _set_source_rsvg_paint_server(
                         c_bbox,
                     ).to_bool();
                 } else if node.get_type() == NodeType::Pattern {
-                    had_paint_server = pattern::pattern_resolve_fallbacks_and_set_pattern(node_ptr, c_ctx, 
c_bbox).to_bool();
+                    had_paint_server = pattern::pattern_resolve_fallbacks_and_set_pattern(node, c_ctx, 
c_bbox);
                 }
             }
 
diff --git a/rust/src/pattern.rs b/rust/src/pattern.rs
index 976d4669..03ece8a5 100644
--- a/rust/src/pattern.rs
+++ b/rust/src/pattern.rs
@@ -1,6 +1,4 @@
 use cairo;
-use glib_sys;
-use glib::translate::*;
 use libc;
 
 use std::cell::RefCell;
@@ -484,12 +482,9 @@ pub extern fn rsvg_node_pattern_new (_: *const libc::c_char, raw_parent: *const
                     Box::new (NodePattern::new ()))
 }
 
-pub fn pattern_resolve_fallbacks_and_set_pattern (raw_node: *const RsvgNode,
+pub fn pattern_resolve_fallbacks_and_set_pattern (node: &RsvgNode,
                                                   draw_ctx: *mut RsvgDrawingCtx,
-                                                  bbox:     RsvgBbox) -> glib_sys::gboolean {
-    assert! (!raw_node.is_null ());
-    let node: &RsvgNode = unsafe { & *raw_node };
-
+                                                  bbox:     RsvgBbox) -> bool {
     assert! (node.get_type () == NodeType::Pattern);
 
     let mut did_set_pattern = false;
@@ -499,5 +494,5 @@ pub fn pattern_resolve_fallbacks_and_set_pattern (raw_node: *const RsvgNode,
         did_set_pattern = resolve_fallbacks_and_set_pattern (pattern, draw_ctx, bbox);
     });
 
-    did_set_pattern.to_glib ()
+    did_set_pattern
 }


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