[librsvg: 1/17] ResizeStrategy.apply() - don't consume the input size




commit dfb331bbeccddbe8a555641b422c0bc2fd88eeb1
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Feb 21 11:53:49 2022 -0600

    ResizeStrategy.apply() - don't consume the input size
    
    And remove an awkward way of copying the natural_size in the Converter.
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/669>

 src/bin/rsvg-convert.rs | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/src/bin/rsvg-convert.rs b/src/bin/rsvg-convert.rs
index 30c218742..41f5919a3 100644
--- a/src/bin/rsvg-convert.rs
+++ b/src/bin/rsvg-convert.rs
@@ -105,7 +105,7 @@ enum ResizeStrategy {
 }
 
 impl ResizeStrategy {
-    pub fn apply(self, input: Size, keep_aspect_ratio: bool) -> Option<Size> {
+    pub fn apply(self, input: &Size, keep_aspect_ratio: bool) -> Option<Size> {
         if input.w == 0.0 || input.h == 0.0 {
             return None;
         }
@@ -674,10 +674,7 @@ impl Converter {
         input: &Input,
     ) -> Result<Size, Error> {
         strategy
-            .apply(
-                Size::new(natural_size.w, natural_size.h),
-                self.keep_aspect_ratio,
-            )
+            .apply(natural_size, self.keep_aspect_ratio)
             .ok_or_else(|| error!("The SVG {} has no dimensions", input))
     }
 


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