[librsvg: 1/3] filters: avoid rect conversion roundtrip



commit 5267c04948bd7a6c6fc56b6fb5043fafa9cbdcb6
Author: Paolo Borelli <pborelli gnome org>
Date:   Mon Dec 9 11:42:48 2019 +0100

    filters: avoid rect conversion roundtrip
    
    Avoid f64 -> i32 -> f64 roundtrip.

 rsvg_internals/src/filters/bounds.rs | 2 +-
 rsvg_internals/src/filters/image.rs  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/rsvg_internals/src/filters/bounds.rs b/rsvg_internals/src/filters/bounds.rs
index 10094f9d..f757e99d 100644
--- a/rsvg_internals/src/filters/bounds.rs
+++ b/rsvg_internals/src/filters/bounds.rs
@@ -88,7 +88,7 @@ impl<'a> BoundsBuilder<'a> {
     ///
     /// Used by feImage.
     #[inline]
-    pub fn into_irect_without_clipping(self, draw_ctx: &mut DrawingCtx) -> IRect {
+    pub fn into_rect_without_clipping(self, draw_ctx: &mut DrawingCtx) -> cairo::Rectangle {
         self.apply_properties(draw_ctx).rect.unwrap().into()
     }
 
diff --git a/rsvg_internals/src/filters/image.rs b/rsvg_internals/src/filters/image.rs
index c3e13f67..42aef892 100644
--- a/rsvg_internals/src/filters/image.rs
+++ b/rsvg_internals/src/filters/image.rs
@@ -101,7 +101,7 @@ impl FeImage {
         ctx: &FilterContext,
         draw_ctx: &DrawingCtx,
         bounds: &IRect,
-        unclipped_bounds: &IRect,
+        unclipped_bounds: &cairo::Rectangle,
         href: &Href,
     ) -> Result<ImageSurface, FilterError> {
         let surface = if let Href::PlainUrl(ref url) = *href {
@@ -127,7 +127,7 @@ impl FeImage {
                 f64::from(surface.width()),
                 f64::from(surface.height()),
             ),
-            &cairo::Rectangle::from(*unclipped_bounds),
+            &unclipped_bounds,
         );
 
         if w.approx_eq_cairo(0.0) || h.approx_eq_cairo(0.0) {
@@ -197,7 +197,7 @@ impl FilterEffect for FeImage {
         if let Some(href) = self.href.as_ref() {
             let output_surface = match href {
                 Href::PlainUrl(_) => {
-                    let unclipped_bounds = bounds_builder.into_irect_without_clipping(draw_ctx);
+                    let unclipped_bounds = bounds_builder.into_rect_without_clipping(draw_ctx);
                     self.render_external_image(ctx, draw_ctx, &bounds, &unclipped_bounds, href)?
                 }
                 Href::WithFragment(ref frag) => self.render_node(ctx, draw_ctx, bounds, frag)?,


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