[librsvg: 34/45] Make sure we always pass a Some() to get_node_of_type()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 34/45] Make sure we always pass a Some() to get_node_of_type()
- Date: Tue, 1 Oct 2019 15:09:47 +0000 (UTC)
commit e5bffeafa26538d35af95d6290e48cb8bf8ca693
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Sep 30 13:54:18 2019 -0500
Make sure we always pass a Some() to get_node_of_type()
rsvg_internals/src/pattern.rs | 36 ++++++++++++++++++++----------------
1 file changed, 20 insertions(+), 16 deletions(-)
---
diff --git a/rsvg_internals/src/pattern.rs b/rsvg_internals/src/pattern.rs
index 83c1cb5d..eeb43ebc 100644
--- a/rsvg_internals/src/pattern.rs
+++ b/rsvg_internals/src/pattern.rs
@@ -151,26 +151,30 @@ impl PaintSource for NodePattern {
let mut stack = NodeStack::new();
while !result.is_resolved() {
- if let Some(acquired) = draw_ctx
- .acquired_nodes()
- .get_node_of_type(result.fallback.as_ref(), NodeType::Pattern)
- {
- let a_node = acquired.get();
-
- if stack.contains(a_node) {
- return Err(PaintServerError::CircularReference(
- result.fallback.as_ref().unwrap().clone(),
- ));
- }
+ if let Some(ref fallback) = result.fallback {
+ if let Some(acquired) = draw_ctx
+ .acquired_nodes()
+ .get_node_of_type(Some(fallback), NodeType::Pattern)
+ {
+ let a_node = acquired.get();
+
+ if stack.contains(a_node) {
+ return Err(PaintServerError::CircularReference(
+ fallback.clone(),
+ ));
+ }
- let node_data = a_node.borrow();
+ let node_data = a_node.borrow();
- let fallback_pattern = node_data.get_impl::<NodePattern>();
- *fallback_pattern.node.borrow_mut() = Some(a_node.downgrade());
+ let fallback_pattern = node_data.get_impl::<NodePattern>();
+ *fallback_pattern.node.borrow_mut() = Some(a_node.downgrade());
- result.resolve_from_fallback(fallback_pattern);
+ result.resolve_from_fallback(fallback_pattern);
- stack.push(a_node);
+ stack.push(a_node);
+ } else {
+ result.resolve_from_defaults();
+ }
} else {
result.resolve_from_defaults();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]