[librsvg: 44/90] NodeClipPath::to_cairo_context(): Move the short-circuit if there's no bounding box to the beginning



commit e164765e11dd5fc1aba647613172039ffc898db3
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Mar 14 19:10:27 2019 -0600

    NodeClipPath::to_cairo_context(): Move the short-circuit if there's no bounding box to the beginning

 rsvg_internals/src/clip_path.rs | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/rsvg_internals/src/clip_path.rs b/rsvg_internals/src/clip_path.rs
index 1c5e6669..a2698563 100644
--- a/rsvg_internals/src/clip_path.rs
+++ b/rsvg_internals/src/clip_path.rs
@@ -34,20 +34,20 @@ impl NodeClipPath {
         draw_ctx: &mut DrawingCtx,
         bbox: &BoundingBox,
     ) -> Result<(), RenderingError> {
-        let cascaded = node.get_cascaded_values();
-
         let clip_units = self.units.get();
 
+        if clip_units == ClipPathUnits(CoordUnits::ObjectBoundingBox) && bbox.rect.is_none() {
+            // The node being clipped is empty / doesn't have a
+            // bounding box, so there's nothing to clip!
+            return Ok(());
+        }
+
+        let cascaded = node.get_cascaded_values();
+
         draw_ctx.with_saved_matrix(&mut |dc| {
             let cr = dc.get_cairo_context();
 
             if clip_units == ClipPathUnits(CoordUnits::ObjectBoundingBox) {
-                if bbox.rect.is_none() {
-                    // The node being clipped is empty / doesn't have a
-                    // bounding box, so there's nothing to clip!
-                    return Ok(());
-                }
-
                 let rect = bbox.rect.as_ref().unwrap();
 
                 cr.transform(cairo::Matrix::new(


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