[librsvg] Length::normalize(): Inline into its only caller (the macro to create Length* types)
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Length::normalize(): Inline into its only caller (the macro to create Length* types)
- Date: Tue, 22 Jan 2019 01:48:56 +0000 (UTC)
commit 6fb0b65b41a89e310a1cd73e00a92074657f5773
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Jan 21 19:26:33 2019 -0600
Length::normalize(): Inline into its only caller (the macro to create Length* types)
rsvg_internals/src/length.rs | 38 ++++++++++++++++++--------------------
1 file changed, 18 insertions(+), 20 deletions(-)
---
diff --git a/rsvg_internals/src/length.rs b/rsvg_internals/src/length.rs
index 1144cdad..8f71f50a 100644
--- a/rsvg_internals/src/length.rs
+++ b/rsvg_internals/src/length.rs
@@ -66,7 +66,24 @@ macro_rules! define_length_type {
}
pub fn normalize(&self, values: &ComputedValues, params: &ViewParams) -> f64 {
- self.0.normalize(values, params)
+ match self.unit() {
+ LengthUnit::Default => self.length(),
+
+ LengthUnit::Percent => {
+ self.length()
+ * $dir.scaling_factor(params.view_box_width, params.view_box_height)
+ }
+
+ LengthUnit::FontEm => self.length() * font_size_from_values(values, params),
+
+ LengthUnit::FontEx => {
+ self.length() * font_size_from_values(values, params) / 2.0
+ }
+
+ LengthUnit::Inch => {
+ self.length() * $dir.scaling_factor(params.dpi_x, params.dpi_y)
+ }
+ }
}
pub fn hand_normalize(
@@ -170,25 +187,6 @@ impl Length {
}
}
- pub fn normalize(&self, values: &ComputedValues, params: &ViewParams) -> f64 {
- match self.unit {
- LengthUnit::Default => self.length,
-
- LengthUnit::Percent => {
- self.length
- * self
- .dir
- .scaling_factor(params.view_box_width, params.view_box_height)
- }
-
- LengthUnit::FontEm => self.length * font_size_from_values(values, params),
-
- LengthUnit::FontEx => self.length * font_size_from_values(values, params) / 2.0,
-
- LengthUnit::Inch => self.length * self.dir.scaling_factor(params.dpi_x, params.dpi_y),
- }
- }
-
/// Returns the raw length after asserting units are either default or percent.
#[inline]
pub fn get_unitless(&self) -> f64 {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]