[librsvg] drawing_ctx: use iterator instead of recursive function
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] drawing_ctx: use iterator instead of recursive function
- Date: Mon, 30 Dec 2019 20:43:27 +0000 (UTC)
commit d91ca5a66f3e8141728bbd00ef39bd377cdbfbb1
Author: Paolo Borelli <pborelli gnome org>
Date: Mon Dec 30 21:04:30 2019 +0100
drawing_ctx: use iterator instead of recursive function
rsvg_internals/src/drawing_ctx.rs | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/rsvg_internals/src/drawing_ctx.rs b/rsvg_internals/src/drawing_ctx.rs
index 63122c74..a9f60bf5 100644
--- a/rsvg_internals/src/drawing_ctx.rs
+++ b/rsvg_internals/src/drawing_ctx.rs
@@ -163,7 +163,9 @@ impl DrawingCtx {
};
if let Some(node) = node {
- draw_ctx.add_node_and_ancestors_to_stack(node);
+ for n in node.ancestors() {
+ draw_ctx.drawsub_stack.push(n.clone());
+ }
}
draw_ctx
@@ -876,13 +878,6 @@ impl DrawingCtx {
res
}
-
- pub fn add_node_and_ancestors_to_stack(&mut self, node: &RsvgNode) {
- self.drawsub_stack.push(node.clone());
- if let Some(ref parent) = node.parent() {
- self.add_node_and_ancestors_to_stack(parent);
- }
- }
}
#[derive(Debug)]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]