[librsvg/rustification] Use rsvg_node_foreach_child() instead of accessing children directly
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/rustification] Use rsvg_node_foreach_child() instead of accessing children directly
- Date: Wed, 7 Dec 2016 23:05:32 +0000 (UTC)
commit dc85a253d8f31df4bd9b442bded8d9ea0bd12505
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Dec 7 11:19:03 2016 -0600
Use rsvg_node_foreach_child() instead of accessing children directly
rsvg-filter.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/rsvg-filter.c b/rsvg-filter.c
index bc9d8c3..51a930e 100644
--- a/rsvg-filter.c
+++ b/rsvg-filter.c
@@ -544,6 +544,17 @@ node_is_filter_primitive (RsvgNode *node)
return type > RSVG_NODE_TYPE_FILTER_PRIMITIVE_FIRST && type < RSVG_NODE_TYPE_FILTER_PRIMITIVE_LAST;
}
+static gboolean
+render_child_if_filter_primitive (RsvgNode *node, gpointer data)
+{
+ RsvgFilterContext *filter_ctx = data;
+
+ if (node_is_filter_primitive (node))
+ rsvg_filter_primitive_render ((RsvgFilterPrimitive *) node, filter_ctx);
+
+ return TRUE;
+}
+
/**
* rsvg_filter_render:
* @self: a pointer to the filter to use
@@ -564,7 +575,6 @@ rsvg_filter_render (RsvgFilter *self,
char *channelmap)
{
RsvgFilterContext *ctx;
- RsvgFilterPrimitive *current;
guint i;
cairo_surface_t *output;
@@ -586,11 +596,7 @@ rsvg_filter_render (RsvgFilter *self,
for (i = 0; i < 4; i++)
ctx->channelmap[i] = channelmap[i] - '0';
- for (i = 0; i < self->super.children->len; i++) {
- current = g_ptr_array_index (self->super.children, i);
- if (node_is_filter_primitive ((RsvgNode *) current))
- rsvg_filter_primitive_render (current, ctx);
- }
+ rsvg_node_foreach_child ((RsvgNode *) self, render_child_if_filter_primitive, ctx);
output = ctx->lastresult.surface;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]