[librsvg: 2/10] Remove Length.get_unitless(); use plain length() from the filters code



commit 4c4796f911206686e604fea287a4153d76f943c0
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Nov 12 17:13:38 2019 -0600

    Remove Length.get_unitless(); use plain length() from the filters code

 rsvg_internals/src/filter.rs |  8 ++++----
 rsvg_internals/src/length.rs | 15 ---------------
 2 files changed, 4 insertions(+), 19 deletions(-)
---
diff --git a/rsvg_internals/src/filter.rs b/rsvg_internals/src/filter.rs
index d0914c1b..f68cdff3 100644
--- a/rsvg_internals/src/filter.rs
+++ b/rsvg_internals/src/filter.rs
@@ -77,10 +77,10 @@ impl Filter {
         // referencing node. No units are allowed (it's checked during attribute parsing).
         let rect = if self.filterunits == CoordUnits::ObjectBoundingBox {
             cairo::Rectangle {
-                x: self.x.get_unitless(),
-                y: self.y.get_unitless(),
-                width: self.width.get_unitless(),
-                height: self.height.get_unitless(),
+                x: self.x.length(),
+                y: self.y.length(),
+                width: self.width.length(),
+                height: self.height.length(),
             }
         } else {
             cairo::Rectangle {
diff --git a/rsvg_internals/src/length.rs b/rsvg_internals/src/length.rs
index 0c32ddd8..ca86deb9 100644
--- a/rsvg_internals/src/length.rs
+++ b/rsvg_internals/src/length.rs
@@ -125,14 +125,6 @@ macro_rules! define_length_type {
                 self.0.unit
             }
 
-            /// Extracts the numerical `Length.length` without considering units
-            ///
-            /// This function is meant to be used only by the filters code, which already
-            /// checks that the user-specified lengths have the correct units.
-            pub fn get_unitless(&self) -> f64 {
-                self.0.get_unitless()
-            }
-
             /// Extracts the interior [`Length`].
             ///
             /// [`Length`]: struct.Length.html
@@ -321,13 +313,6 @@ impl Length {
         Length { length: l, unit }
     }
 
-    /// Returns the raw length after asserting units are either default or percent.
-    #[inline]
-    pub(crate) fn get_unitless(&self) -> f64 {
-        assert!(self.unit == LengthUnit::Px || self.unit == LengthUnit::Percent);
-        self.length
-    }
-
     pub(crate) fn from_cssparser(parser: &mut Parser<'_, '_>) -> Result<Length, ValueErrorKind> {
         let length = {
             let token = parser.next().map_err(|_| {


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