[librsvg] image: move lookup to an inner scope



commit cf023cd3ed82c72bdd62ff680b07bec9c1fb3ad8
Author: Paolo Borelli <pborelli gnome org>
Date:   Tue Jan 15 21:10:31 2019 +0100

    image: move lookup to an inner scope
    
    This also means we do not load the image if we are returning
    early.

 rsvg_internals/src/image.rs | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/rsvg_internals/src/image.rs b/rsvg_internals/src/image.rs
index ab551276..d1ebf1e1 100644
--- a/rsvg_internals/src/image.rs
+++ b/rsvg_internals/src/image.rs
@@ -82,12 +82,6 @@ impl NodeTrait for NodeImage {
         draw_ctx: &mut DrawingCtx,
         clipping: bool,
     ) -> Result<(), RenderingError> {
-        let surface = if let Some(Href::PlainUrl(ref url)) = *self.href.borrow() {
-            draw_ctx.lookup_image(&url)?
-        } else {
-            return Ok(());
-        };
-
         let values = cascaded.get();
         let params = draw_ctx.get_view_params();
 
@@ -101,6 +95,12 @@ impl NodeTrait for NodeImage {
         }
 
         draw_ctx.with_discrete_layer(node, values, clipping, &mut |dc| {
+            let surface = if let Some(Href::PlainUrl(ref url)) = *self.href.borrow() {
+                dc.lookup_image(&url)?
+            } else {
+                return Ok(());
+            };
+
             let aspect = self.aspect.get();
 
             if !values.is_overflow() && aspect.is_slice() {


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