[librsvg: 46/90] NodeMask::generate_cairo_mask(): Move the short-circuit if there's no bounding box to the beginning
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 46/90] NodeMask::generate_cairo_mask(): Move the short-circuit if there's no bounding box to the beginning
- Date: Tue, 26 Mar 2019 19:15:56 +0000 (UTC)
commit 2f67f2d5316c175b357954a59bfd499dda814d3d
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Mar 14 19:16:54 2019 -0600
NodeMask::generate_cairo_mask(): Move the short-circuit if there's no bounding box to the beginning
rsvg_internals/src/mask.rs | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/rsvg_internals/src/mask.rs b/rsvg_internals/src/mask.rs
index dc80821d..d996b64b 100644
--- a/rsvg_internals/src/mask.rs
+++ b/rsvg_internals/src/mask.rs
@@ -55,6 +55,14 @@ impl NodeMask {
draw_ctx: &mut DrawingCtx,
bbox: &BoundingBox,
) -> Result<(), RenderingError> {
+ if bbox.rect.is_none() {
+ // The node being masked is empty / doesn't have a
+ // bounding box, so there's nothing to mask!
+ return Ok(());
+ }
+
+ let bbox_rect = bbox.rect.as_ref().unwrap();
+
let cascaded = node.get_cascaded_values();
let values = cascaded.get();
@@ -81,16 +89,6 @@ impl NodeMask {
// Use a scope because mask_cr needs to release the
// reference to the surface before we access the pixels
{
- let bbox_rect = {
- if let Some(ref rect) = bbox.rect {
- *rect
- } else {
- // The node being masked is empty / doesn't have a
- // bounding box, so there's nothing to mask!
- return Ok(());
- }
- };
-
let save_cr = draw_ctx.get_cairo_context();
let mask_cr = cairo::Context::new(&surface);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]