[librsvg: 70/95] rsvg_filter_primitive_blend_set_atts(): Parse attributes with the PHF
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 70/95] rsvg_filter_primitive_blend_set_atts(): Parse attributes with the PHF
- Date: Thu, 22 Feb 2018 03:19:01 +0000 (UTC)
commit b51d1794c01d947bb423283c7a4a2fae576f25d2
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Feb 21 15:09:47 2018 -0600
rsvg_filter_primitive_blend_set_atts(): Parse attributes with the PHF
rsvg-filter.c | 56 ++++++++++++++++++++++++++++++++++++++------------------
1 file changed, 38 insertions(+), 18 deletions(-)
---
diff --git a/rsvg-filter.c b/rsvg-filter.c
index 077503be..92c19c58 100644
--- a/rsvg-filter.c
+++ b/rsvg-filter.c
@@ -1084,28 +1084,48 @@ static void
rsvg_filter_primitive_blend_set_atts (RsvgNode *node, gpointer impl, RsvgHandle *handle, RsvgPropertyBag
atts)
{
RsvgFilterPrimitiveBlend *filter = impl;
+ RsvgPropertyBagIter *iter;
+ const char *key;
+ RsvgAttribute attr;
const char *value;
- if ((value = rsvg_property_bag_lookup (atts, "mode"))) {
- if (!strcmp (value, "multiply"))
- filter->mode = multiply;
- else if (!strcmp (value, "screen"))
- filter->mode = screen;
- else if (!strcmp (value, "darken"))
- filter->mode = darken;
- else if (!strcmp (value, "lighten"))
- filter->mode = lighten;
- else
- filter->mode = normal;
+ filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
+
+ iter = rsvg_property_bag_iter_begin (atts);
+
+ while (rsvg_property_bag_iter_next (iter, &key, &attr, &value)) {
+ switch (attr) {
+ case RSVG_ATTRIBUTE_MODE:
+ if (!strcmp (value, "multiply"))
+ filter->mode = multiply;
+ else if (!strcmp (value, "screen"))
+ filter->mode = screen;
+ else if (!strcmp (value, "darken"))
+ filter->mode = darken;
+ else if (!strcmp (value, "lighten"))
+ filter->mode = lighten;
+ else
+ filter->mode = normal;
+ break;
+
+ case RSVG_ATTRIBUTE_IN:
+ g_string_assign (filter->super.in, value);
+ break;
+
+ case RSVG_ATTRIBUTE_IN2:
+ g_string_assign (filter->in2, value);
+ break;
+
+ case RSVG_ATTRIBUTE_RESULT:
+ g_string_assign (filter->super.result, value);
+ break;
+
+ default:
+ break;
+ }
}
- if ((value = rsvg_property_bag_lookup (atts, "in")))
- g_string_assign (filter->super.in, value);
- if ((value = rsvg_property_bag_lookup (atts, "in2")))
- g_string_assign (filter->in2, value);
- if ((value = rsvg_property_bag_lookup (atts, "result")))
- g_string_assign (filter->super.result, value);
- filter_primitive_set_x_y_width_height_atts ((RsvgFilterPrimitive *) filter, atts);
+ rsvg_property_bag_iter_end (iter);
}
RsvgNode *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]