[librsvg] feImage: Pass the bounding boxes to render_external_image()



commit d594bf98aabfe4b58936e65c301b68172770d4ff
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Jan 25 21:04:20 2019 -0600

    feImage: Pass the bounding boxes to render_external_image()
    
    Don't compute them inside there.

 rsvg_internals/src/filters/image.rs | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/rsvg_internals/src/filters/image.rs b/rsvg_internals/src/filters/image.rs
index 7c41f813..05fb792e 100644
--- a/rsvg_internals/src/filters/image.rs
+++ b/rsvg_internals/src/filters/image.rs
@@ -14,7 +14,6 @@ use property_bag::PropertyBag;
 use rect::IRect;
 use surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
 
-use super::bounds::BoundsBuilder;
 use super::context::{FilterContext, FilterOutput, FilterResult};
 use super::{Filter, FilterError, Primitive};
 
@@ -104,8 +103,9 @@ impl Image {
     fn render_external_image(
         &self,
         ctx: &FilterContext,
-        draw_ctx: &mut DrawingCtx,
-        bounds_builder: BoundsBuilder<'_>,
+        draw_ctx: &DrawingCtx,
+        bounds: &IRect,
+        unclipped_bounds: &IRect,
         href: &Href,
     ) -> Result<ImageSurface, FilterError> {
         let surface = if let Href::PlainUrl(ref url) = *href {
@@ -124,15 +124,14 @@ impl Image {
         )?;
 
         // TODO: this goes through a f64->i32->f64 conversion.
-        let render_bounds = bounds_builder.into_irect_without_clipping(draw_ctx);
         let aspect = self.aspect.get();
         let (x, y, w, h) = aspect.compute(
             f64::from(surface.width()),
             f64::from(surface.height()),
-            f64::from(render_bounds.x0),
-            f64::from(render_bounds.y0),
-            f64::from(render_bounds.x1 - render_bounds.x0),
-            f64::from(render_bounds.y1 - render_bounds.y0),
+            f64::from(unclipped_bounds.x0),
+            f64::from(unclipped_bounds.y0),
+            f64::from(unclipped_bounds.x1 - unclipped_bounds.x0),
+            f64::from(unclipped_bounds.y1 - unclipped_bounds.y0),
         );
 
         if w.approx_eq_cairo(&0.0) || h.approx_eq_cairo(&0.0) {
@@ -151,7 +150,6 @@ impl Image {
         matrix.invert();
         ptn.set_matrix(matrix);
 
-        let bounds = bounds_builder.into_irect(draw_ctx);
         let cr = cairo::Context::new(&output_surface);
         cr.rectangle(
             f64::from(bounds.x0),
@@ -208,7 +206,8 @@ impl Filter for Image {
         if let Some(href) = href_opt {
             let output_surface = match *href {
                 Href::PlainUrl(_) => {
-                    self.render_external_image(ctx, draw_ctx, bounds_builder, href)?
+                    let unclipped_bounds = bounds_builder.into_irect_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]