[librsvg: 1/4] Move RsvgDimensionData to c_api



commit 79a68b035cae42f88502c30999e85231fc216de8
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Apr 30 20:20:05 2020 -0500

    Move RsvgDimensionData to c_api
    
    It's not used in rsvg_internals anymore.

 librsvg/c_api.rs             | 27 +++++++++++++++++++++++++--
 rsvg_internals/src/handle.rs | 23 -----------------------
 rsvg_internals/src/lib.rs    |  4 +---
 3 files changed, 26 insertions(+), 28 deletions(-)
---
diff --git a/librsvg/c_api.rs b/librsvg/c_api.rs
index ee177119..9ce4c37f 100644
--- a/librsvg/c_api.rs
+++ b/librsvg/c_api.rs
@@ -34,8 +34,8 @@ use gobject_sys::{GEnumValue, GFlagsValue};
 
 use rsvg_internals::{
     rsvg_log, DefsLookupErrorKind, Dpi, Handle, IntrinsicDimensions, LoadOptions, LoadingError,
-    RenderingError, RsvgDimensionData, RsvgLength, RsvgPositionData, RsvgSizeFunc,
-    SharedImageSurface, SizeCallback, SurfaceType, ViewBox,
+    RenderingError, RsvgLength, RsvgPositionData, RsvgSizeFunc, SharedImageSurface, SizeCallback,
+    SurfaceType, ViewBox,
 };
 
 use crate::messages::{rsvg_g_critical, rsvg_g_warning};
@@ -468,6 +468,29 @@ pub fn checked_i32(x: f64) -> Result<i32, cairo::Status> {
     cast::i32(x).map_err(|_| cairo::Status::InvalidSize)
 }
 
+// Keep in sync with rsvg.h:RsvgDimensionData
+#[repr(C)]
+pub struct RsvgDimensionData {
+    pub width: libc::c_int,
+    pub height: libc::c_int,
+    pub em: f64,
+    pub ex: f64,
+}
+
+impl RsvgDimensionData {
+    // This is not #[derive(Default)] to make it clear that it
+    // shouldn't be the default value for anything; it is actually a
+    // special case we use to indicate an error to the public API.
+    pub fn empty() -> RsvgDimensionData {
+        RsvgDimensionData {
+            width: 0,
+            height: 0,
+            em: 0.0,
+            ex: 0.0,
+        }
+    }
+}
+
 impl CHandle {
     fn set_base_url(&self, url: &str) {
         let state = self.load_state.borrow();
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index 1219ea12..82a3d107 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -72,29 +72,6 @@ impl LoadOptions {
     }
 }
 
-// Keep in sync with rsvg.h:RsvgDimensionData
-#[repr(C)]
-pub struct RsvgDimensionData {
-    pub width: libc::c_int,
-    pub height: libc::c_int,
-    pub em: f64,
-    pub ex: f64,
-}
-
-impl RsvgDimensionData {
-    // This is not #[derive(Default)] to make it clear that it
-    // shouldn't be the default value for anything; it is actually a
-    // special case we use to indicate an error to the public API.
-    pub fn empty() -> RsvgDimensionData {
-        RsvgDimensionData {
-            width: 0,
-            height: 0,
-            em: 0.0,
-            ex: 0.0,
-        }
-    }
-}
-
 // Keep in sync with rsvg.h:RsvgPositionData
 #[repr(C)]
 pub struct RsvgPositionData {
diff --git a/rsvg_internals/src/lib.rs b/rsvg_internals/src/lib.rs
index b4aba3c9..95d17a43 100644
--- a/rsvg_internals/src/lib.rs
+++ b/rsvg_internals/src/lib.rs
@@ -53,9 +53,7 @@ pub use crate::dpi::{rsvg_rust_set_default_dpi_x_y, Dpi};
 
 pub use crate::error::{DefsLookupErrorKind, HrefError, LoadingError, RenderingError};
 
-pub use crate::handle::{
-    Handle, LoadOptions, RsvgDimensionData, RsvgPositionData, RsvgSizeFunc, SizeCallback,
-};
+pub use crate::handle::{Handle, LoadOptions, RsvgPositionData, RsvgSizeFunc, SizeCallback};
 
 pub use crate::length::{Length, LengthUnit, RsvgLength};
 


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