[librsvg: 5/8] BoundingBox::with_ink_rect() - new method, analogous to with_ink_extents()



commit 8420e174b416e88d5a168db3fb861fd4b84ffb1c
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Sep 25 18:12:15 2018 -0500

    BoundingBox::with_ink_rect() - new method, analogous to with_ink_extents()

 rsvg_internals/src/bbox.rs | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/rsvg_internals/src/bbox.rs b/rsvg_internals/src/bbox.rs
index d5a66ebf..e4a80f96 100644
--- a/rsvg_internals/src/bbox.rs
+++ b/rsvg_internals/src/bbox.rs
@@ -23,14 +23,16 @@ impl BoundingBox {
         BoundingBox { rect, ..self }
     }
 
+    pub fn with_ink_rect(self, ink_rect: Option<cairo::Rectangle>) -> BoundingBox {
+        BoundingBox { ink_rect, ..self }
+    }
+
     pub fn with_extents(self, extents: (f64, f64, f64, f64)) -> BoundingBox {
-        let rect = rect_from_extents(extents);
-        BoundingBox { rect, ..self }
+        self.with_rect(rect_from_extents(extents))
     }
 
     pub fn with_ink_extents(self, extents: (f64, f64, f64, f64)) -> BoundingBox {
-        let ink_rect = rect_from_extents(extents);
-        BoundingBox { ink_rect, ..self }
+        self.with_ink_rect(rect_from_extents(extents))
     }
 
     fn combine(&mut self, src: &BoundingBox, clip: bool) {


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