[librsvg/librsvg-2.46] shared_surface: use rect conversion to shorten code



commit 8d6f24f839124f9c5d84cf8534845543d6934c57
Author: Paolo Borelli <pborelli gnome org>
Date:   Sun Oct 13 12:24:18 2019 +0200

    shared_surface: use rect conversion to shorten code

 rsvg_internals/src/surface_utils/shared_surface.rs | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
---
diff --git a/rsvg_internals/src/surface_utils/shared_surface.rs 
b/rsvg_internals/src/surface_utils/shared_surface.rs
index e30aa9db..67782d1c 100644
--- a/rsvg_internals/src/surface_utils/shared_surface.rs
+++ b/rsvg_internals/src/surface_utils/shared_surface.rs
@@ -322,12 +322,8 @@ impl SharedImageSurface {
         let output_surface = ImageSurface::create(cairo::Format::ARgb32, self.width, self.height)?;
 
         let cr = cairo::Context::new(&output_surface);
-        cr.rectangle(
-            bounds.x0 as f64,
-            bounds.y0 as f64,
-            (bounds.x1 - bounds.x0) as f64,
-            (bounds.y1 - bounds.y0) as f64,
-        );
+        let r = cairo::Rectangle::from(bounds);
+        cr.rectangle(r.x, r.y, r.width, r.height);
         cr.clip();
 
         cr.set_source_surface(&self.surface, 0f64, 0f64);
@@ -350,12 +346,8 @@ impl SharedImageSurface {
 
         {
             let cr = cairo::Context::new(&output_surface);
-            cr.rectangle(
-                bounds.x0 as f64,
-                bounds.y0 as f64,
-                (bounds.x1 - bounds.x0) as f64,
-                (bounds.y1 - bounds.y0) as f64,
-            );
+            let r = cairo::Rectangle::from(bounds);
+            cr.rectangle(r.x, r.y, r.width, r.height);
             cr.clip();
 
             cr.scale(x, y);


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