[librsvg: 21/90] Split with_discrete_layer() into two cases



commit 02a8dac73911d823e439ab572d781340b712646a
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Mar 11 15:51:56 2019 -0600

    Split with_discrete_layer() into two cases
    
    One for needs_temporary_surface and one for not.

 rsvg_internals/src/drawing_ctx.rs | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index 73376731..a33dab75 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -448,7 +448,8 @@ impl DrawingCtx {
                 && clip_in_object_space.is_none()
                 && enable_background == EnableBackground::Accumulate);
 
-            let prev_bbox = if needs_temporary_surface {
+
+            let res = if needs_temporary_surface {
                 let surface = self.create_surface_for_toplevel_viewport().map_err(|e| {
                     self.cr.restore();
                     e
@@ -463,14 +464,8 @@ impl DrawingCtx {
                 let prev_bbox = self.bbox;
                 self.bbox = BoundingBox::new(&affine);
 
-                prev_bbox
-            } else {
-                self.bbox
-            };
-
-            let mut res = draw_fn(self);
+                let mut res = draw_fn(self);
 
-            if needs_temporary_surface {
                 let child_surface = cairo::ImageSurface::from(self.cr.get_target()).unwrap();
 
                 let filter_result_surface = if let Some(filter_uri) = filter {
@@ -524,7 +519,11 @@ impl DrawingCtx {
                 let bbox = self.bbox;
                 self.bbox = prev_bbox;
                 self.bbox.insert(&bbox);
-            }
+
+                res
+            } else {
+                draw_fn(self)
+            };
 
             self.cr.restore();
 


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