[librsvg/rustification] marker.rs: Use cairo_sys::cairo_path_t correctly
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/rustification] marker.rs: Use cairo_sys::cairo_path_t correctly
- Date: Wed, 2 Nov 2016 01:31:58 +0000 (UTC)
commit 078a6ad19a1ecb862f20fd1bdd7f4458cfd649ab
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Nov 1 17:03:05 2016 -0600
marker.rs: Use cairo_sys::cairo_path_t correctly
I was requesting the cairo-rs crate somewhat incorrectly in Cargo.toml,
and not requesting cairo-sys-rs at all. Thus, I thought I needed to
patch cairo-rs to let me access a cairo_path_t. It turns out it's
already available; one just has to declare the crate correctly...
rust/Cargo.toml | 7 ++++++-
rust/src/marker.rs | 7 +++++--
2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index dcbb3a1..d671baa 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -5,7 +5,12 @@ authors = ["Federico Mena Quintero <federico gnome org>"]
[dependencies]
libc = "0.2"
-cairo-rs = { git = "https://github.com/federicomenaquintero/cairo.git" }
+
+[dependencies.cairo-sys-rs]
+git = "https://github.com/gtk-rs/cairo.git"
+
+[dependencies.cairo-rs]
+git = "https://github.com/gtk-rs/cairo.git"
[lib]
name = "rsvg_internals"
diff --git a/rust/src/marker.rs b/rust/src/marker.rs
index 5004e10..658d68c 100644
--- a/rust/src/marker.rs
+++ b/rust/src/marker.rs
@@ -1,5 +1,6 @@
extern crate libc;
extern crate cairo;
+extern crate cairo_sys;
#[derive(Debug, PartialEq)]
pub enum Segment {
@@ -292,7 +293,7 @@ pub enum RsvgDrawingCtx {}
pub enum RsvgPathBuilder {}
extern "C" {
- fn rsvg_path_builder_copy_path (builder: *mut RsvgPathBuilder) -> *mut cairo::cairo_path_t;
+ fn rsvg_path_builder_copy_path (builder: *mut RsvgPathBuilder) -> *mut cairo_sys::cairo_path_t;
fn rsvg_marker_render (marker_name: *const libc::c_char,
xpos: f64,
ypos: f64,
@@ -367,11 +368,13 @@ pub extern fn rsvg_rust_render_markers (ctx: *mut RsvgDrawingCtx,
return;
}
- let cairopath: *mut cairo::cairo_path_t;
+ let cairopath: *mut cairo_sys::cairo_path_t;
unsafe { cairopath = rsvg_path_builder_copy_path (builder); }
let path = cairo::Path::wrap (cairopath);
+ /* FIXME: free the path with rsvg_cairo_path_destroy() */
+
/* Convert the path to a list of segments and bare points */
let segments = path_to_segments (path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]