[librsvg: 16/27] pattern.rs: use NormalizeParams




commit e50563abae14153bbace5a8f499432dfb9d5cbfd
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri May 7 21:08:50 2021 -0500

    pattern.rs: use NormalizeParams

 src/pattern.rs | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/src/pattern.rs b/src/pattern.rs
index 026d4aed..3c75362a 100644
--- a/src/pattern.rs
+++ b/src/pattern.rs
@@ -6,7 +6,7 @@ use crate::aspect_ratio::*;
 use crate::bbox::BoundingBox;
 use crate::coord_units::CoordUnits;
 use crate::document::{AcquiredNodes, NodeId, NodeStack};
-use crate::drawing_ctx::{DrawingCtx, ViewParams};
+use crate::drawing_ctx::DrawingCtx;
 use crate::element::{Draw, Element, ElementResult, SetAttributes};
 use crate::error::*;
 use crate::href::{is_href, set_href};
@@ -315,11 +315,11 @@ impl ResolvedPattern {
         }
     }
 
-    fn get_rect(&self, values: &ComputedValues, params: &ViewParams) -> Rect {
-        let x = self.x.normalize(&values, &params);
-        let y = self.y.normalize(&values, &params);
-        let w = self.width.normalize(&values, &params);
-        let h = self.height.normalize(&values, &params);
+    fn get_rect(&self, params: &NormalizeParams) -> Rect {
+        let x = self.x.to_user(params);
+        let y = self.y.to_user(params);
+        let w = self.width.to_user(params);
+        let h = self.height.to_user(params);
 
         Rect::new(x, y, x + w, y + h)
     }
@@ -332,9 +332,10 @@ impl ResolvedPattern {
     ) -> Option<UserSpacePattern> {
         let node_with_children = self.node_with_children()?;
 
-        let params = draw_ctx.push_coord_units(self.units.0);
+        let view_params = draw_ctx.push_coord_units(self.units.0);
+        let params = NormalizeParams::new(values, &view_params);
 
-        let rect = self.get_rect(values, &params);
+        let rect = self.get_rect(&params);
         let bbrect = bbox.rect.unwrap();
 
         // Create the pattern coordinate system


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