[librsvg: 5/7] filters: simplify getter in the context




commit d457e647878dfcc96b309c94dd088f128fa634df
Author: Paolo Borelli <pborelli gnome org>
Date:   Sun Nov 29 14:46:31 2020 +0100

    filters: simplify getter in the context

 src/filters/bounds.rs  |  2 +-
 src/filters/context.rs | 13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/filters/bounds.rs b/src/filters/bounds.rs
index 0d4a0a64..051a175c 100644
--- a/src/filters/bounds.rs
+++ b/src/filters/bounds.rs
@@ -107,7 +107,7 @@ impl<'a> BoundsBuilder<'a> {
 
         // If any of the properties were specified, we need to respect them.
         if self.x.is_some() || self.y.is_some() || self.width.is_some() || self.height.is_some() {
-            let params = self.ctx.get_view_params(draw_ctx);
+            let params = draw_ctx.push_coord_units(self.ctx.primitive_units());
             let values = self.ctx.get_computed_values_from_node_being_filtered();
 
             // These replacements are correct only because self.bbox is used with the
diff --git a/src/filters/context.rs b/src/filters/context.rs
index 23cbadfb..69544490 100644
--- a/src/filters/context.rs
+++ b/src/filters/context.rs
@@ -5,7 +5,7 @@ use std::f64;
 use crate::bbox::BoundingBox;
 use crate::coord_units::CoordUnits;
 use crate::document::AcquiredNodes;
-use crate::drawing_ctx::{DrawingCtx, ViewParams};
+use crate::drawing_ctx::DrawingCtx;
 use crate::filter::Filter;
 use crate::parsers::CustomIdent;
 use crate::properties::ComputedValues;
@@ -252,6 +252,12 @@ impl FilterContext {
         self.paffine
     }
 
+    /// Returns the primitive units.
+    #[inline]
+    pub fn primitive_units(&self) -> CoordUnits {
+        self.primitive_units
+    }
+
     /// Returns the filter effects region.
     #[inline]
     pub fn effects_region(&self) -> BoundingBox {
@@ -262,11 +268,6 @@ impl FilterContext {
         &self.computed_from_node_being_filtered
     }
 
-    /// Pushes the viewport size based on the value of `primitiveUnits`.
-    pub fn get_view_params(&self, draw_ctx: &mut DrawingCtx) -> ViewParams {
-        draw_ctx.push_coord_units(self.primitive_units)
-    }
-
     /// Retrieves the filter input surface according to the SVG rules.
     ///
     /// Does not take `processing_linear_rgb` into account.


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