[librsvg: 8/13] Use the transform passed to draw_fn instead of asking DrawingCtx::get_transform




commit 2efc8196e1c0185340abcf55c4d86a4786d0e1bb
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Nov 4 20:35:09 2021 -0600

    Use the transform passed to draw_fn instead of asking DrawingCtx::get_transform
    
    With this, DrawingCtx::get_transform can be private again.
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/626>

 src/drawing_ctx.rs | 9 +++------
 src/text.rs        | 4 ++--
 2 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index 8bbed0fb9..fc796fe2e 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -344,9 +344,7 @@ impl DrawingCtx {
         self.measuring
     }
 
-    // FIXME: this is public just so that text.rs can access it.  Maybe the draw_fn passed to 
with_discrete_layer should
-    // obtain the current transform as an argument?
-    pub fn get_transform(&self) -> Transform {
+    fn get_transform(&self) -> Transform {
         Transform::from(self.cr.matrix())
     }
 
@@ -1239,11 +1237,10 @@ impl DrawingCtx {
             values,
             clipping,
             None,
-            &mut |an, dc, _transform| {
+            &mut |an, dc, transform| {
                 let cr = dc.cr.clone();
-                let transform = dc.get_transform();
                 let mut path_helper =
-                    PathHelper::new(&cr, transform, &shape.path, shape.stroke.line_cap);
+                    PathHelper::new(&cr, *transform, &shape.path, shape.stroke.line_cap);
 
                 if clipping {
                     if shape.is_visible {
diff --git a/src/text.rs b/src/text.rs
index 33ac8c331..42bab987f 100644
--- a/src/text.rs
+++ b/src/text.rs
@@ -765,10 +765,10 @@ impl Draw for Text {
             values,
             clipping,
             None,
-            &mut |an, dc, _transform| {
+            &mut |an, dc, transform| {
                 let layout_context = LayoutContext {
                     writing_mode: values.writing_mode(),
-                    transform: dc.get_transform(),
+                    transform: *transform,
                     font_options: dc.get_font_options(),
                 };
 


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