[librsvg: 1/3] DrawingCtx.initial_transform_with_offset - remove this function; use the plain initial transform




commit 1ced44e8e909c66c156c1535691253646f00bd39
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Nov 10 10:46:05 2021 -0600

    DrawingCtx.initial_transform_with_offset - remove this function; use the plain initial transform
    
    Now that draw_tree() creates an initial transform and viewport so that
    the latter has (0, 0) at the origin, we don't need to offset the
    initial transform passed to CompositingAffines::new().  We can use the
    plain initial transform as computed by draw_tree() at the beginning of
    the drawing process.
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/629>

 src/drawing_ctx.rs | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index fc796fe2e..af45c3ec1 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -730,7 +730,7 @@ impl DrawingCtx {
 
                     let affines = CompositingAffines::new(
                         affine_at_start,
-                        self.initial_transform_with_offset(),
+                        self.initial_viewport.transform,
                         self.cr_stack.borrow().len(),
                     );
 
@@ -908,14 +908,6 @@ impl DrawingCtx {
         }
     }
 
-    fn initial_transform_with_offset(&self) -> Transform {
-        let rect = self.toplevel_viewport();
-
-        self.initial_viewport
-            .transform
-            .pre_translate(rect.x0, rect.y0)
-    }
-
     /// Run the drawing function with the specified opacity
     fn with_alpha(
         &mut self,
@@ -1530,7 +1522,7 @@ impl DrawingCtx {
             for (depth, draw) in self.cr_stack.borrow().iter().enumerate() {
                 let affines = CompositingAffines::new(
                     Transform::from(draw.matrix()),
-                    self.initial_transform_with_offset(),
+                    self.initial_viewport.transform,
                     depth,
                 );
 


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