[librsvg] viewbox.rs: Rust equivalent to RsvgViewBox



commit 6417cc6df3d52265db7506ceb341a45cdc9dd8ed
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Jan 27 15:17:15 2017 -0600

    viewbox.rs: Rust equivalent to RsvgViewBox

 rsvg-private.h      |    1 +
 rust/src/lib.rs     |    6 ++++++
 rust/src/viewbox.rs |   21 +++++++++++++++++++++
 3 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/rsvg-private.h b/rsvg-private.h
index 2a92791..b5139f9 100644
--- a/rsvg-private.h
+++ b/rsvg-private.h
@@ -180,6 +180,7 @@ struct RsvgHandlePrivate {
     gboolean is_testing; /* Are we being run from the test suite? */
 };
 
+/* Keep this in sync with rust/src/viewbox.rs::RsvgViewBox */
 typedef struct {
     cairo_rectangle_t rect;
     gboolean active;
diff --git a/rust/src/lib.rs b/rust/src/lib.rs
index e224aad..37b787a 100644
--- a/rust/src/lib.rs
+++ b/rust/src/lib.rs
@@ -54,6 +54,10 @@ pub use length::{
     rsvg_length_hand_normalize,
 };
 
+pub use viewbox::{
+    RsvgViewBox
+};
+
 
 mod aspect_ratio;
 mod bbox;
@@ -69,3 +73,5 @@ mod property_bag;
 mod state;
 mod shapes;
 mod strtod;
+mod util;
+mod viewbox;
diff --git a/rust/src/viewbox.rs b/rust/src/viewbox.rs
new file mode 100644
index 0000000..1799d22
--- /dev/null
+++ b/rust/src/viewbox.rs
@@ -0,0 +1,21 @@
+extern crate cairo;
+
+/* Keep this in sync with rsvg-private.h:RsvgViewBox */
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct RsvgViewBox {
+    pub rect:   cairo::Rectangle,
+    pub active: bool
+}
+
+impl RsvgViewBox {
+    pub fn new_inactive () -> RsvgViewBox {
+        RsvgViewBox {
+            rect: cairo::Rectangle { x: 0.0,
+                                     y: 0.0,
+                                     width: 0.0,
+                                     height: 0.0 },
+            active: false
+        }
+    }
+}


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