[librsvg/librsvg-2.46] rect: add conversion to cairo::Rectangle



commit dea317e4edf06d53f92b01810ada43c963fa3b8a
Author: Paolo Borelli <pborelli gnome org>
Date:   Sun Oct 13 12:23:33 2019 +0200

    rect: add conversion to cairo::Rectangle

 rsvg_internals/src/rect.rs | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/rsvg_internals/src/rect.rs b/rsvg_internals/src/rect.rs
index bf7ff707..08c07b0b 100644
--- a/rsvg_internals/src/rect.rs
+++ b/rsvg_internals/src/rect.rs
@@ -166,6 +166,18 @@ impl From<cairo::Rectangle> for IRect {
     }
 }
 
+impl From<IRect> for cairo::Rectangle {
+    #[inline]
+    fn from(IRect { x0, y0, x1, y1 }: IRect) -> Self {
+        Self {
+            x: f64::from(x0),
+            y: f64::from(y0),
+            width: f64::from(x1 - x0),
+            height: f64::from(y1 - y0),
+        }
+    }
+}
+
 #[cfg(test)]
 mod tests {
     use super::*;


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